Skip to content

Commit ef41182

Browse files
authored
gh-117142: Port _ctypes to multi-phase init (GH-117181)
1 parent 4bb7d12 commit ef41182

File tree

10 files changed

+1125
-178
lines changed

10 files changed

+1125
-178
lines changed

Lib/test/test_ctypes/test_refcounts.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import unittest
55
from test import support
66
from test.support import import_helper
7+
from test.support import script_helper
78
_ctypes_test = import_helper.import_module("_ctypes_test")
89

910

@@ -110,5 +111,18 @@ def func():
110111
func()
111112

112113

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+
113127
if __name__ == '__main__':
114128
unittest.main()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Convert :mod:`!_ctypes` to multi-phase initialisation (:pep:`489`).

0 commit comments

Comments
 (0)