diff --git a/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py b/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py index c8dd458bfdd70..74876a6aed8c7 100644 --- a/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py +++ b/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py @@ -153,12 +153,19 @@ def __init__(self, ptrcls, maker): def __call__(self, ptr): return py_make_smartptr(type(ptr), self.ptrcls)(ptr) def __getitem__(self, cls): + # For the builtin types that directly map to C++ types, we get the name + # immediately so we don't reach the fallback in the end. + # See also Utility::ConstructTemplateArgs() in CPyCpyy. + if cls is int: + cls = "int" + elif cls is float: + cls = "float" try: if not cls.__module__ == int.__module__: return py_make_smartptr(cls, self.ptrcls) except AttributeError: pass - if isinstance(cls, str) and not cls in ('int', 'float'): + if isinstance(cls, str): return py_make_smartptr(getattr(gbl, cls), self.ptrcls) return self.maker[cls] diff --git a/bindings/pyroot/cppyy/cppyy/test/test_cpp11features.py b/bindings/pyroot/cppyy/cppyy/test/test_cpp11features.py index 71c30153dfe02..e3ca315d3034c 100644 --- a/bindings/pyroot/cppyy/cppyy/test/test_cpp11features.py +++ b/bindings/pyroot/cppyy/cppyy/test/test_cpp11features.py @@ -438,7 +438,6 @@ def test14_shared_ptr_passing(self): gc.collect() assert TestSmartPtr.s_counter == 0 - @mark.xfail(strict=True, condition=IS_WINDOWS | IS_MAC_ARM, reason='ValueError: Could not find "make_unique"') def test15_unique_ptr_template_deduction(self): """Argument type deduction with std::unique_ptr""" @@ -458,7 +457,6 @@ def test15_unique_ptr_template_deduction(self): with raises(ValueError): # not an RValue cppyy.gbl.UniqueTempl.returnptr[int](uptr_in) - @mark.xfail(strict=True, condition=IS_WINDOWS | IS_MAC_ARM, reason='TypeError: Could not find "make_unique"') def test16_unique_ptr_moves(self): """std::unique_ptr requires moves"""