There was an error while loading. Please reload this page.
1 parent 4bb7d12 commit ef41182Copy full SHA for ef41182
10 files changed
Lib/test/test_ctypes/test_refcounts.py
@@ -4,6 +4,7 @@
4
import unittest
5
from test import support
6
from test.support import import_helper
7
+from test.support import script_helper
8
_ctypes_test = import_helper.import_module("_ctypes_test")
9
10
@@ -110,5 +111,18 @@ def func():
110
111
func()
112
113
114
+class ModuleIsolationTest(unittest.TestCase):
115
+ def test_finalize(self):
116
+ # check if gc_decref() succeeds
117
+ script = (
118
+ "import ctypes;"
119
+ "import sys;"
120
+ "del sys.modules['_ctypes'];"
121
+ "import _ctypes;"
122
+ "exit()"
123
+ )
124
+ script_helper.assert_python_ok("-c", script)
125
+
126
127
if __name__ == '__main__':
128
unittest.main()
Misc/NEWS.d/next/Library/2024-03-29-12-21-40.gh-issue-117142.U0agfh.rst
@@ -0,0 +1 @@
1
+Convert :mod:`!_ctypes` to multi-phase initialisation (:pep:`489`).
0 commit comments