Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free-threding (no-gil) support #269

Merged
merged 4 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ classifiers =
Development Status :: 5 - Production/Stable
License :: OSI Approved :: BSD License
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
project_urls =
Expand All @@ -33,7 +32,7 @@ project_urls =

[options]
zip_safe = false
python_requires = >= 3.6
python_requires = >= 3.8
packages = find:
package_dir =
=src
Expand Down Expand Up @@ -70,19 +69,19 @@ norecursedirs = .tox venv

[tox:tox]
envlist =
py{36,37,38,39,310,311,312}
py{36,37,38,39,310,311,312}-{without,install,disable}-extensions,
py{38,39,310,311,312,313,314}
py{38,39,310,311,312,313,314}-{without,install,disable}-extensions,
pypy-without-extensions

[gh-actions]
python =
3.6: py36, py36-without-extensions, py36-install-extensions, py36-disable-extensions
3.7: py37, py37-without-extensions, py37-install-extensions, py37-disable-extensions
3.8: py38, py38-without-extensions, py38-install-extensions, py38-disable-extensions
3.9: py39, py39-without-extensions, py39-install-extensions, py39-disable-extensions
3.10: py310, py310-without-extensions, py310-install-extensions, py310-disable-extensions
3.11: py311, py311-without-extensions, py311-install-extensions, py311-disable-extensions
3.12: py312, py312-without-extensions, py312-install-extensions, py312-disable-extensions
3.13: py313, py313-without-extensions, py313-install-extensions, py313-disable-extensions
3.14: py314, py314-without-extensions, py314-install-extensions, py314-disable-extensions
pypy-3.8: pypy-without-extensions
pypy-3.9: pypy-without-extensions
pypy-3.10: pypy-without-extensions
Expand All @@ -92,7 +91,7 @@ deps =
coverage
pytest
install_command =
py311,py311-{without,install,disable}-extensions: python -m pip install --no-binary coverage {opts} {packages}
python -m pip install --no-binary coverage {opts} {packages}
commands =
python -m coverage run --rcfile {toxinidir}/setup.cfg -m pytest -v {posargs} {toxinidir}/tests
setenv =
Expand Down
18 changes: 10 additions & 8 deletions tests/test_outer_classmethod.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,20 @@ def test_class_call_function(self):
# first argument with the actual arguments following that. This
# was only finally fixed in Python 3.9. For more details see:
# https://bugs.python.org/issue19072
# Starting with Python 3.13 the old behavior is back.
# For more details see https://github.com/python/cpython/issues/89519

_args = (1, 2)
_kwargs = {'one': 1, 'two': 2}

@wrapt.decorator
def _decorator(wrapped, instance, args, kwargs):
if PYXY < (3, 9):
self.assertEqual(instance, None)
self.assertEqual(args, (Class,)+_args)
else:
if (3, 9) <= PYXY < (3, 13):
self.assertEqual(instance, Class)
self.assertEqual(args, _args)
else:
self.assertEqual(instance, None)
self.assertEqual(args, (Class,)+_args)

self.assertEqual(kwargs, _kwargs)
self.assertEqual(wrapped.__module__, _function.__module__)
Expand Down Expand Up @@ -176,12 +178,12 @@ def test_instance_call_function(self):

@wrapt.decorator
def _decorator(wrapped, instance, args, kwargs):
if PYXY < (3, 9):
self.assertEqual(instance, None)
self.assertEqual(args, (Class,)+_args)
else:
if (3, 9) <= PYXY < (3, 13):
self.assertEqual(instance, Class)
self.assertEqual(args, _args)
else:
self.assertEqual(instance, None)
self.assertEqual(args, (Class,)+_args)

self.assertEqual(kwargs, _kwargs)
self.assertEqual(wrapped.__module__, _function.__module__)
Expand Down
26 changes: 14 additions & 12 deletions tests/test_synchronized_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,36 +165,38 @@ def test_synchronized_outer_classmethod(self):
# function to the class before calling and just calls it direct,
# explicitly passing the class as first argument. For more
# details see: https://bugs.python.org/issue19072
# Starting with Python 3.13 the old behavior is back.
# For more details see https://github.com/python/cpython/issues/89519

if PYXY < (3, 9):
_lock0 = getattr(C4.function2, '_synchronized_lock', None)
else:
if (3, 9) <= PYXY < (3, 13):
_lock0 = getattr(C4, '_synchronized_lock', None)
else:
_lock0 = getattr(C4.function2, '_synchronized_lock', None)
self.assertEqual(_lock0, None)

c4.function2()

if PYXY < (3, 9):
_lock1 = getattr(C4.function2, '_synchronized_lock', None)
else:
if (3, 9) <= PYXY < (3, 13):
_lock1 = getattr(C4, '_synchronized_lock', None)
else:
_lock1 = getattr(C4.function2, '_synchronized_lock', None)
self.assertNotEqual(_lock1, None)

C4.function2()

if PYXY < (3, 9):
_lock2 = getattr(C4.function2, '_synchronized_lock', None)
else:
if (3, 9) <= PYXY < (3, 13):
_lock2 = getattr(C4, '_synchronized_lock', None)
else:
_lock2 = getattr(C4.function2, '_synchronized_lock', None)
self.assertNotEqual(_lock2, None)
self.assertEqual(_lock2, _lock1)

C4.function2()

if PYXY < (3, 9):
_lock3 = getattr(C4.function2, '_synchronized_lock', None)
else:
if (3, 9) <= PYXY < (3, 13):
_lock3 = getattr(C4, '_synchronized_lock', None)
else:
_lock3 = getattr(C4.function2, '_synchronized_lock', None)
self.assertNotEqual(_lock3, None)
self.assertEqual(_lock3, _lock2)

Expand Down
Loading