mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 14:59:27 +00:00
fix: Python 3.13t with GIL (#5139)
* ci: try Python 3.13t Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * fix: support Python 3.13t Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * fix: patch PyPy Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * tests: one more int cast Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * tests: cleanup Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * refactor: use named constant in tests for immortal refcounts Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * docs: move comment about free threaded Python Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from pybind11_tests import PYBIND11_REFCNT_IMMORTAL
|
||||
from pybind11_tests import kwargs_and_defaults as m
|
||||
|
||||
|
||||
@@ -384,7 +385,7 @@ def test_args_refcount():
|
||||
myval = 54321
|
||||
expected = refcount(myval)
|
||||
assert m.arg_refcount_h(myval) == expected
|
||||
assert m.arg_refcount_o(myval) == expected + 1
|
||||
assert m.arg_refcount_o(myval) in {expected + 1, PYBIND11_REFCNT_IMMORTAL}
|
||||
assert m.arg_refcount_h(myval) == expected
|
||||
assert refcount(myval) == expected
|
||||
|
||||
@@ -420,6 +421,7 @@ def test_args_refcount():
|
||||
# for the `py::args`; in the previous case, we could simply inc_ref and pass on Python's input
|
||||
# tuple without having to inc_ref the individual elements, but here we can't, hence the extra
|
||||
# refs.
|
||||
assert m.mixed_args_refcount(myval, myval, myval) == (exp3 + 3, exp3 + 3, exp3 + 3)
|
||||
exp3_3 = PYBIND11_REFCNT_IMMORTAL if exp3 == PYBIND11_REFCNT_IMMORTAL else exp3 + 3
|
||||
assert m.mixed_args_refcount(myval, myval, myval) == (exp3_3, exp3_3, exp3_3)
|
||||
|
||||
assert m.class_default_argument() == "<class 'decimal.Decimal'>"
|
||||
|
||||
Reference in New Issue
Block a user