pythonpyramid

Python 3.13 property() now inherits __name__ from callable


While trying to build Pyramid with Python 3.13b2 I see some tests are failing. The problem seems to be a change in Python behavior.

With Python 3.12 I get:

>>> def worker(obj):
...     pass
...
>>> hasattr(property(worker), '__name__')
False

While Python 3.13 returns:

>>> def worker(obj):
...     pass
...
>>> hasattr(property(worker), '__name__')
True
>>> property(worker).__name__
'worker'

I've filed a bug report to Pyramid, but I'm unsure if the correct behavior is the one from 3.12 or it is from 3.13. Should I file a bug against Python instead?


Solution

  • This is a deliberate change, visible in the Python changelog under Python 3.13.0 alpha 5:

    • gh-101860: Expose __name__ attribute on property.

    (It'd be pretty unlikely to make this kind of change by accident.)