From 9fb94bb621dae7c5fe6cc724aac9eeb114469a43 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 25 Dec 2019 14:30:08 +0100 Subject: [PATCH] Fix python 2 environment finalizing, fixes #1412 --- jedi/_compatibility.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index 065fde89..709cd518 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -665,7 +665,13 @@ if not is_py3: info.weakref = weakref.ref(obj, self) self._registry[self] = info - def __call__(self): + # To me it's an absolute mystery why in Python 2 we need _=None. It + # makes really no sense since it's never really called. Then again it + # might be called by Python 2.7 itself, but weakref.finalize is not + # documented in Python 2 and therefore shouldn't be randomly called. + # We never call this stuff with a parameter and therefore this + # parameter should not be needed. But it is. ~dave + def __call__(self, _=None): """Return func(*args, **kwargs) if alive.""" info = self._registry.pop(self, None) if info: