[Pablo]
> Tim, check this out:
>
> >>> import re, gc
> >>> x = re.compile("x")
> >>> gc.get_referents(x.__class__)[-1]
> <module '_sre' (built-in)>

Cool! So presumably this constructs a cycle involving a pattern object:

import re
p = re.compile("ab*c")
import _sre
_sre.WOWZA = p

Indeed, under the current main branch:

>>> import gc
>>> gc.get_referents(type(p))[-1].WOWZA is p
True

Then again, type objects are in cycles regardless:

>>> type(p).__mro__[0] is type(p)
True
>>> dict.__mro__[0] is dict
True
>>> int.__mro__[0] is int
True

Etc.

I suppose I could ask why heap types were fiddled to point to their
module objects too - but that's really got nothing to do with getting
the release done, so I won't :-)
_______________________________________________
python-committers mailing list -- python-committers@python.org
To unsubscribe send an email to python-committers-le...@python.org
https://mail.python.org/mailman3/lists/python-committers.python.org/
Message archived at 
https://mail.python.org/archives/list/python-committers@python.org/message/PBBMXNUG3RGQNK4Z6YMJV3Z6OC73ZQPC/
Code of Conduct: https://www.python.org/psf/codeofconduct/

Reply via email to