Bug report
Bug description:
With the merge of gh-142843, the test case test__interpchannels.ChannelTests.test_send_recv_different_interpreters_and_threads is now failing with reference leaks. A minimal reproducer is below. If the sys.flags object has deferred reference counting enabled in the sub-interpreter, it leaks.
importgcimportsysimport_interpretersdeftest_leak():
id1=_interpreters.create()
deff():
# enable deferred ref counts for sys.flags, causes a leak, even with# an explicit gc.collect() call_interpreters.run_string(
id1,
'import sys, _testcapi; _testcapi.pyobject_enable_deferred_refcount(sys.flags)\n',
)
f()
_interpreters.destroy(id1)
defmain():
foriinrange(4):
test_leak()
gc.collect()
old_refs=sys.gettotalrefcount()
foriinrange(10):
test_leak()
gc.collect()
refs=sys.gettotalrefcount()
print(f'refs {refs} diff {refs-old_refs}')
old_refs=refsif__name__=='__main__':
main()CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
With the merge of gh-142843, the test case
test__interpchannels.ChannelTests.test_send_recv_different_interpreters_and_threadsis now failing with reference leaks. A minimal reproducer is below. If thesys.flagsobject has deferred reference counting enabled in the sub-interpreter, it leaks.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs