FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix tests on python3.14t by vstinner · Pull Request #166 · python/pythoncapi-compat · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .py  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
24 changes: 19 additions & 5 deletions tests/test_pythoncapi_compat.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
except ImportError:
# Python 2
faulthandler = None
try:
import sysconfig
except ImportError:
# Python 3.1 and older
sysconfig = None

# test.utils
from utils import run_command, command_stdout
Expand Down Expand Up @@ -49,9 +54,7 @@ def display_title(title):
if not VERBOSE:
return

ver = sys.version_info
title = "Python %s.%s: %s" % (ver.major, ver.minor, title)

title = "%s: %s" % (python_version(), title)
print(title)
print("=" * len(title))
print()
Expand Down Expand Up @@ -94,10 +97,13 @@ def _run_tests(tests, verbose):
test_func()


_HAS_CLEAR_INTERNAL_CACHES = hasattr(sys, '_clear_internal_caches')
_HAS_CLEAR_TYPE_CACHE = hasattr(sys, '_clear_type_cache')

def _refleak_cleanup():
if _HAS_CLEAR_TYPE_CACHE:
if _HAS_CLEAR_INTERNAL_CACHES:
sys._clear_internal_caches()
elif _HAS_CLEAR_TYPE_CACHE:
sys._clear_type_cache()
gc.collect()

Expand Down Expand Up @@ -134,10 +140,18 @@ def python_version():
python_impl = "PyPy"
else:
python_impl = 'Python'
return "%s %s.%s (%s build)" % (python_impl, ver.major, ver.minor, build)
pyver = "%s.%s" % (ver.major, ver.minor)
if ver >= (3, 13):
if sysconfig.get_config_var('Py_GIL_DISABLED'):
# Free-threaded build
pyver += "t"
return "%s %s (%s build)" % (python_impl, pyver, build)


def run_tests(module_name, lang):
if VERBOSE:
print("")

title = "Test %s (%s)" % (module_name, lang)
display_title(title)

Expand Down
3 changes: 3 additions & 0 deletions tests/test_pythoncapi_compat_cext.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2624,6 +2624,9 @@ module_exec(PyObject *module)
#if PY_VERSION_HEX >= 0x03050000
static PyModuleDef_Slot module_slots[] = {
{Py_mod_exec, _Py_CAST(void*, module_exec)},
#if PY_VERSION_HEX >= 0x030D0000
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
#endif
{0, _Py_NULL}
};
#endif
Expand Down
Loading

Back | FazBrowse Home | New Git URL