(self)
| 1178 | gc.unfreeze() |
| 1179 | |
| 1180 | def test_deferred_refcount_frozen(self): |
| 1181 | # Also from GH-126312: objects that use deferred reference counting |
| 1182 | # weren't ignored if they were frozen. Unfortunately, it's pretty |
| 1183 | # difficult to come up with a case that triggers this. |
| 1184 | # |
| 1185 | # Calling gc.collect() while the garbage collector is frozen doesn't |
| 1186 | # trigger this normally, but it *does* if it's inside unittest for whatever |
| 1187 | # reason. We can't call unittest from inside a test, so it has to be |
| 1188 | # in a subprocess. |
| 1189 | source = textwrap.dedent(""" |
| 1190 | import gc |
| 1191 | import unittest |
| 1192 | |
| 1193 | |
| 1194 | class Test(unittest.TestCase): |
| 1195 | def test_something(self): |
| 1196 | gc.freeze() |
| 1197 | gc.collect() |
| 1198 | gc.unfreeze() |
| 1199 | |
| 1200 | |
| 1201 | if __name__ == "__main__": |
| 1202 | unittest.main() |
| 1203 | """) |
| 1204 | assert_python_ok("-c", source) |
| 1205 | |
| 1206 | def test_do_not_cleanup_type_subclasses_before_finalization(self): |
| 1207 | # See https://github.com/python/cpython/issues/135552 |
nothing calls this directly
no test coverage detected