Skip to content

Commit d0f4d6d

Browse files
tests/test_general.py: test_4392(): cope with free threaded python.
Return codes from python are slightly different because of extra warning.
1 parent ee268f7 commit d0f4d6d

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

tests/test_general.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,7 +2004,7 @@ def test_4392():
20042004
print('test_4392(): not running on Pyodide - cannot run child processes.')
20052005
return
20062006

2007-
print()
2007+
print('', flush=1)
20082008
path = os.path.normpath(f'{__file__}/../../tests/test_4392.py')
20092009
with open(path, 'w') as f:
20102010
f.write('import pymupdf\n')
@@ -2024,15 +2024,22 @@ def test_4392():
20242024
e3 = subprocess.run(command, shell=1, check=0).returncode
20252025
print(f'{e3=}')
20262026

2027-
print(f'{e1=} {e2=} {e3=}')
2027+
print(f'{e1=} {e2=} {e3=}', flush=1)
20282028

2029-
print(f'{pymupdf.swig_version=}')
2030-
print(f'{pymupdf.swig_version_tuple=}')
2029+
print(f'{pymupdf.swig_version=}', flush=1)
2030+
print(f'{pymupdf.swig_version_tuple=}', flush=1)
20312031

20322032
assert e1 == 5
20332033
if pymupdf.swig_version_tuple >= (4, 4):
2034-
assert e2 == 5
2035-
assert e3 == 0
2034+
if sysconfig.get_config_var('Py_GIL_DISABLED') == 1:
2035+
assert e2 == 4
2036+
else:
2037+
assert e2 == 5
2038+
if sysconfig.get_config_var('Py_GIL_DISABLED') == 1:
2039+
# GIL warning results in failure because of -Werror.
2040+
assert e3 == 1
2041+
else:
2042+
assert e3 == 0
20362043
else:
20372044
# We get SEGV's etc with older swig.
20382045
if platform.system() == 'Windows':

0 commit comments

Comments
 (0)