File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
bindings/pyroot/pythonizations/test Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,17 @@ class NumbaDeclareSimple(unittest.TestCase):
2121 def test_refcount_decorator (self ):
2222 """
2323 Test refcount of decorator
24+
25+ In case of Python < 3.14, we expect a refcount of 2, because the call
26+ to sys.getrefcount can create an additional reference itself. Starting
27+ from Python 3.14, we expect a refcount of 1 because there were changes
28+ to the interpreter to avoid some unnecessary ref counts. See also:
29+ https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-refcount
2430 """
2531 x = ROOT .Numba .Declare (["float" ], "float" )
2632 gc .collect ()
27- self .assertEqual (sys .getrefcount (x ), 2 )
33+ extra_ref_count = int (sys .version_info < (3 , 14 ))
34+ self .assertEqual (sys .getrefcount (x ), 1 + extra_ref_count )
2835
2936 def test_refcount_pycallable (self ):
3037 """
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ def test_refcount(self):
7676 """
7777 Check refcounts of associated PyObjects
7878
79- In case of Python <= 3.14, we expect a refcount of 2 for the data dict,
79+ In case of Python < 3.14, we expect a refcount of 2 for the data dict,
8080 because the call to sys.getrefcount creates a second reference by
8181 itself. Starting from Python 3.14, we expect a refcount of 1 because
8282 there were changes to the interpreter to avoid some unnecessary ref
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ def test_refcount(self):
123123 """
124124 Test reference count of returned RVec
125125
126- In case of Python <= 3.14, we expect a refcount of 2 for the RVec
126+ In case of Python < 3.14, we expect a refcount of 2 for the RVec
127127 because the call to sys.getrefcount creates a second reference by
128128 itself. Starting from Python 3.14, we expect a refcount of 1 because
129129 there were changes to the interpreter to avoid some unnecessary ref
You can’t perform that action at this time.
0 commit comments