Serhiy Storchaka <[email protected]> added the comment:
Guido's Time Machine strikes back.
>>> import gc
>>> def f(): pass
...
>>> gc.get_referents(f)
[<code object f at 0x7f45f5d366c0, file "<stdin>", line 1>, {'__name__':
'__main__', '__doc__': None, '__package__': None, '__loader__': <class
'_frozen_importlib.BuiltinImporter'>, '__spec__': None, '__annotations__': {},
'__builtins__': <module 'builtins' (built-in)>, 'gc': <module 'gc' (built-in)>,
'f': <function f at 0x7f45f5dd3b90>}, '__main__', None, 'f', 'f']
>>> f.__annotations__
{}
>>> gc.get_referents(f)
[<code object f at 0x7f45f5d366c0, file "<stdin>", line 1>, {'__name__':
'__main__', '__doc__': None, '__package__': None, '__loader__': <class
'_frozen_importlib.BuiltinImporter'>, '__spec__': None, '__annotations__': {},
'__builtins__': <module 'builtins' (built-in)>, 'gc': <module 'gc' (built-in)>,
'f': <function f at 0x7f45f5dd3b90>}, '__main__', None, 'f', {}, 'f']
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37949>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com