davidhalter / jedi

Awesome autocompletion, static analysis and refactoring library for python
http://jedi.readthedocs.io
Other
5.82k stars 507 forks source link

Python 3.13.0b3+ `functools.partial` being a descriptor messes with signatures #2012

Open PeterJCLaw opened 4 months ago

PeterJCLaw commented 4 months ago

As we found out on #2003, in Python 3.13+ functools.partial is now a descriptor. In turn this means that Interpreter (which uses a mix of access to real objects and code analysis) fails to resolve a suitable name for partially applied functions and ends up using the __repr__ instead.

The specific issue is that DirectObjectAccess.py__name__ is confused by the result of its inspect.ismethoddescriptor check.

See also discussion on #2003, from which this is broken out.

davidhalter commented 4 months ago

Just as a small addition: I feel like this is a general issue with descriptors and I'm not really sure we can fix that for the general case. Since the names of the descriptor are not really the name that the signature should have...