Skip to content

Commit

Permalink
Avoid false positives in GIL test when user runs with '-Xgil-1'
Browse files Browse the repository at this point in the history
Issue #608
  • Loading branch information
ronaldoussoren committed Jul 14, 2024
1 parent 614a956 commit e8df357
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pyobjc-core/Lib/PyObjCTools/TestSupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,9 +1112,16 @@ def assertFreeThreadedIfConfigured(self):
Assert that the process is running in free-threaded mode when
the interpreter was configured as such.
"""

if not _get_config_var("Py_GIL_DISABLED"):
# Not a free threaded build
return

if "gil" in _sys._xoptions and _sys._xoptions["gil"]:
# User runs with '-Xgil=1'
return

# Check that the GIL is actually disabled
self.assertFalse(_sys._is_gil_enabled(), "GIL is enabled")

def _validateCallableMetadata(
Expand Down

0 comments on commit e8df357

Please sign in to comment.