(self)
| 1181 | self.assertTrue(sys._is_gil_enabled()) |
| 1182 | |
| 1183 | def test_is_finalizing(self): |
| 1184 | self.assertIs(sys.is_finalizing(), False) |
| 1185 | # Don't use the atexit module because _Py_Finalizing is only set |
| 1186 | # after calling atexit callbacks |
| 1187 | code = """if 1: |
| 1188 | import sys |
| 1189 | |
| 1190 | class AtExit: |
| 1191 | is_finalizing = sys.is_finalizing |
| 1192 | print = print |
| 1193 | |
| 1194 | def __del__(self): |
| 1195 | self.print(self.is_finalizing(), flush=True) |
| 1196 | |
| 1197 | # Keep a reference in the __main__ module namespace, so the |
| 1198 | # AtExit destructor will be called at Python exit |
| 1199 | ref = AtExit() |
| 1200 | """ |
| 1201 | rc, stdout, stderr = assert_python_ok('-c', code) |
| 1202 | self.assertEqual(stdout.rstrip(), b'True') |
| 1203 | |
| 1204 | def test_issue20602(self): |
| 1205 | # sys.flags and sys.float_info were wiped during shutdown. |
nothing calls this directly
no test coverage detected