aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/pybind11/tests/test_call_policies.py
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2022-09-14 09:28:47 +0200
committergatecat <gatecat@ds0.me>2022-09-14 09:28:47 +0200
commita72f898ff4c4237424c468044a6db9d6953b541e (patch)
tree1c4a543f661dd1b281aecf4660388491702fa8d8 /3rdparty/pybind11/tests/test_call_policies.py
parentf1349e114f3a16ccd002e8513339e18f5be4d31b (diff)
downloadnextpnr-a72f898ff4c4237424c468044a6db9d6953b541e.tar.gz
nextpnr-a72f898ff4c4237424c468044a6db9d6953b541e.tar.bz2
nextpnr-a72f898ff4c4237424c468044a6db9d6953b541e.zip
3rdparty: Bump vendored pybind11 version for py3.11 support
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to '3rdparty/pybind11/tests/test_call_policies.py')
-rw-r--r--3rdparty/pybind11/tests/test_call_policies.py34
1 files changed, 31 insertions, 3 deletions
diff --git a/3rdparty/pybind11/tests/test_call_policies.py b/3rdparty/pybind11/tests/test_call_policies.py
index e0413d14..61605641 100644
--- a/3rdparty/pybind11/tests/test_call_policies.py
+++ b/3rdparty/pybind11/tests/test_call_policies.py
@@ -1,10 +1,8 @@
-# -*- coding: utf-8 -*-
import pytest
import env # noqa: F401
-
-from pybind11_tests import call_policies as m
from pybind11_tests import ConstructorStats
+from pybind11_tests import call_policies as m
@pytest.mark.xfail("env.PYPY", reason="sometimes comes out 1 off on PyPy", strict=False)
@@ -46,6 +44,19 @@ def test_keep_alive_argument(capture):
"""
)
+ p = m.Parent()
+ c = m.Child()
+ assert ConstructorStats.detail_reg_inst() == n_inst + 2
+ m.free_function(p, c)
+ del c
+ assert ConstructorStats.detail_reg_inst() == n_inst + 2
+ del p
+ assert ConstructorStats.detail_reg_inst() == n_inst
+
+ with pytest.raises(RuntimeError) as excinfo:
+ m.invalid_arg_index()
+ assert str(excinfo.value) == "Could not activate keep_alive!"
+
def test_keep_alive_return_value(capture):
n_inst = ConstructorStats.detail_reg_inst()
@@ -85,6 +96,23 @@ def test_keep_alive_return_value(capture):
"""
)
+ p = m.Parent()
+ assert ConstructorStats.detail_reg_inst() == n_inst + 1
+ with capture:
+ m.Parent.staticFunction(p)
+ assert ConstructorStats.detail_reg_inst() == n_inst + 2
+ assert capture == "Allocating child."
+ with capture:
+ del p
+ assert ConstructorStats.detail_reg_inst() == n_inst
+ assert (
+ capture
+ == """
+ Releasing parent.
+ Releasing child.
+ """
+ )
+
# https://foss.heptapod.net/pypy/pypy/-/issues/2447
@pytest.mark.xfail("env.PYPY", reason="_PyObject_GetDictPtr is unimplemented")