Skip to content
Draft
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
9 changes: 8 additions & 1 deletion bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'include', # load and jit a header file
'c_include', # load and jit a C header file
'load_library', # load a shared library
'nullptr', # unique pointer representing NULL

Check failure on line 43 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:43:5: F405 `nullptr` may be undefined, or defined from star imports

Check failure on line 43 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:43:5: F405 `nullptr` may be undefined, or defined from star imports
'sizeof', # size of a C++ type
'typeid', # typeid of a C++ type
'multi', # helper for multiple inheritance
Expand All @@ -64,27 +64,27 @@
ispypy = False

from . import _typemap
from ._version import __version__

Check failure on line 67 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:67:23: F401 `._version.__version__` imported but unused; consider removing, adding to `__all__`, or using a redundant alias

Check failure on line 67 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:67:23: F401 `._version.__version__` imported but unused; consider removing, adding to `__all__`, or using a redundant alias

# import separately instead of in the above try/except block for easier to
# understand tracebacks
if ispypy:
from ._pypy_cppyy import *

Check failure on line 72 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F403)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:72:5: F403 `from ._pypy_cppyy import *` used; unable to detect undefined names

Check failure on line 72 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F403)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:72:5: F403 `from ._pypy_cppyy import *` used; unable to detect undefined names
else:
from ._cpython_cppyy import *

Check failure on line 74 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F403)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:74:5: F403 `from ._cpython_cppyy import *` used; unable to detect undefined names

Check failure on line 74 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F403)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:74:5: F403 `from ._cpython_cppyy import *` used; unable to detect undefined names


#- allow importing from gbl --------------------------------------------------
sys.modules['cppyy.gbl'] = gbl

Check failure on line 78 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:78:28: F405 `gbl` may be undefined, or defined from star imports

Check failure on line 78 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:78:28: F405 `gbl` may be undefined, or defined from star imports
sys.modules['cppyy.gbl.std'] = gbl.std

Check failure on line 79 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:79:32: F405 `gbl` may be undefined, or defined from star imports

Check failure on line 79 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:79:32: F405 `gbl` may be undefined, or defined from star imports


#- external typemap ----------------------------------------------------------
_typemap.initialize(_backend) # also creates (u)int8_t mapper

Check failure on line 83 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:83:21: F405 `_backend` may be undefined, or defined from star imports

Check failure on line 83 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:83:21: F405 `_backend` may be undefined, or defined from star imports

try:
gbl.std.int8_t = gbl.int8_t # ensures same _integer_ type

Check failure on line 86 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:86:23: F405 `gbl` may be undefined, or defined from star imports

Check failure on line 86 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:86:5: F405 `gbl` may be undefined, or defined from star imports

Check failure on line 86 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:86:23: F405 `gbl` may be undefined, or defined from star imports

Check failure on line 86 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:86:5: F405 `gbl` may be undefined, or defined from star imports
gbl.std.uint8_t = gbl.uint8_t

Check failure on line 87 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:87:5: F405 `gbl` may be undefined, or defined from star imports

Check failure on line 87 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:87:5: F405 `gbl` may be undefined, or defined from star imports
except (AttributeError, TypeError):
pass

Expand Down Expand Up @@ -153,12 +153,19 @@
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]

Expand Down
2 changes: 0 additions & 2 deletions bindings/pyroot/cppyy/cppyy/test/test_cpp11features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>"')
def test15_unique_ptr_template_deduction(self):
"""Argument type deduction with std::unique_ptr"""

Expand All @@ -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<int>"')
def test16_unique_ptr_moves(self):
"""std::unique_ptr requires moves"""

Expand Down
Loading