Jedi: TypeError with jedi._compatibility.finalize (Python 2.7.16)

Created on 27 Sep 2019  路  4Comments  路  Source: davidhalter/jedi

There seems to be a problem with the py2 compat finalizer:

https://github.com/davidhalter/jedi/blob/9cdc4d6039d0df70aa759fa23371ea92c5c8fc72/jedi/_compatibility.py#L668-L672

Via https://github.com/davidhalter/jedi-vim/issues/953:

Exception TypeError: '__call__() takes exactly 1 argument (2 given)' in <jedi._compatibility.finalize object at 0x0A62C190> ignored```
bug low-prio

All 4 comments

I will be so happy when I finally get to drop Python 2. :)

This was the weirdest bug ever. It's very much unclear where the call came from. It must be something inside Python2.7, however I'm very much confused about this.

Since it's Python 2.7 I'll just leave it like this, but I'm still wondering why this happened.

Now I get it:

weakref.ref(obj, callback) [...] If callback is provided and not None, and the returned weakref object is still alive, the callback will be called when the object is about to be finalized; the weak reference object will be passed as the only parameter to the callback; the referent will no longer be available.

https://docs.python.org/3/library/weakref.html#weakref.ref

Was this page helpful?
0 / 5 - 0 ratings