MCPcopy Index your code
hub / github.com/python/cpython / requires_singlephase_init

Function requires_singlephase_init

Lib/test/test_import/__init__.py:169–181  ·  view source on GitHub ↗

Decorator to skip if single-phase init modules are not supported.

(meth)

Source from the content-addressed store, hash-verified

167
168
169def requires_singlephase_init(meth):
170 """Decorator to skip if single-phase init modules are not supported."""
171 if not isinstance(meth, type):
172 def meth(self, _meth=meth):
173 try:
174 return _meth(self)
175 finally:
176 restore__testsinglephase()
177 meth = cpython_only(meth)
178 msg = "gh-117694: free-threaded build does not currently support single-phase init modules in sub-interpreters"
179 meth = requires_gil_enabled(msg)(meth)
180 return unittest.skipIf(_testsinglephase is None,
181 'test requires _testsinglephase module')(meth)
182
183
184def requires_subinterpreters(meth):

Callers

nothing calls this directly

Calls 2

cpython_onlyFunction · 0.90
requires_gil_enabledFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…