28 May
2021
28 May
'21
4:55 a.m.
[Pablo]
Tim, check this out:
import re, gc x = re.compile("x") gc.get_referents(x.__class__)[-1]
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 :-)