Skip to content
Merged
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
13 changes: 13 additions & 0 deletions bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3618,6 +3618,19 @@ static struct InitConvFactories_t {
gf[CCOMPLEX_F " ptr"] = gf["std::complex<float> ptr"];
gf[CCOMPLEX_D " ptr"] = gf["std::complex<double> ptr"];

// We always need these converters when cppyy is based on an unpatched
// ROOT, because the "long long" types are always converted to Long64_t
// and ULong64_t already at the ROOT Meta level.
// See https://github.com/root-project/root/issues/15872#issuecomment-2174092763
gf["Long64_t"] = gf["long long"];
gf["Long64_t ptr"] = gf["long long ptr"];
gf["Long64_t&"] = gf["long long&"];
gf["const Long64_t&"] = gf["const long long&"];
gf["ULong64_t"] = gf["unsigned long long"];
gf["ULong64_t ptr"] = gf["unsigned long long ptr"];
gf["ULong64_t&"] = gf["unsigned long long&"];
gf["const ULong64_t&"] = gf["const unsigned long long&"];

// factories for special cases
gf["nullptr_t"] = (cf_t)+[](cdims_t) { static NullptrConverter c{}; return &c;};
gf["const char*"] = (cf_t)+[](cdims_t) { return new CStringConverter{}; };
Expand Down
11 changes: 11 additions & 0 deletions bindings/pyroot/cppyy/CPyCppyy/src/Executors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,17 @@ struct InitExecFactories_t {
gf[CCOMPLEX_F " ptr"] = gf["std::complex<float> ptr"];
gf[CCOMPLEX_D " ptr"] = gf["std::complex<double> ptr"];

// We always need these executors when cppyy is based on an unpatched
// ROOT, because the "long long" types are always converted to Long64_t
// and ULong64_t already at the ROOT Meta level.
// See https://github.com/root-project/root/issues/15872#issuecomment-2174092763
gf["Long64_t"] = gf["long long"];
gf["Long64_t&"] = gf["long long&"];
gf["Long64_t ptr"] = gf["long long ptr"];
gf["ULong64_t"] = gf["unsigned long long"];
gf["ULong64_t&"] = gf["unsigned long long&"];
gf["ULong64_t ptr"] = gf["unsigned long long ptr"];

// factories for special cases
gf["const char*"] = (ef_t)+[](cdims_t) { static CStringExecutor e{}; return &e; };
gf["char*"] = gf["const char*"];
Expand Down
7 changes: 1 addition & 6 deletions bindings/pyroot/cppyy/CPyCppyy/src/Pythonize.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,7 @@ static bool FillVector(PyObject* vecin, PyObject* args, ItemGetter* getter)
// reserve memory as applicable
if (0 < sz) {
PyObject* res = PyObject_CallMethod(vecin, (char*)"reserve", (char*)"n", sz);
// TODO: Actually this "res" should never be nullptr, but somehow this
// call can fail on Windows 64 bit, resulting in "res" being a nullptr.
// This needs to be fixed, and then we can use again Py_DECREF(res),
// which doesn't do the nullptr check. Alternatively, there should be a
// proper error if calling reserve() fails.
Py_XDECREF(res);
Py_DECREF(res);
} else // i.e. sz == 0, so empty container: done
return true;

Expand Down
4 changes: 2 additions & 2 deletions bindings/pyroot/cppyy/cppyy/test/test_numba.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, pytest

Check failure on line 1 in bindings/pyroot/cppyy/cppyy/test/test_numba.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

bindings/pyroot/cppyy/cppyy/test/test_numba.py:1:8: F401 `os` imported but unused

Check failure on line 1 in bindings/pyroot/cppyy/cppyy/test/test_numba.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E401)

bindings/pyroot/cppyy/cppyy/test/test_numba.py:1:1: E401 Multiple imports on one line
import math, time

Check failure on line 2 in bindings/pyroot/cppyy/cppyy/test/test_numba.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E401)

bindings/pyroot/cppyy/cppyy/test/test_numba.py:2:1: E401 Multiple imports on one line
from pytest import mark, raises
from support import setup_make, IS_MAC, IS_WINDOWS

Check failure on line 4 in bindings/pyroot/cppyy/cppyy/test/test_numba.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

bindings/pyroot/cppyy/cppyy/test/test_numba.py:4:21: F401 `support.setup_make` imported but unused

Check failure on line 4 in bindings/pyroot/cppyy/cppyy/test/test_numba.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

bindings/pyroot/cppyy/cppyy/test/test_numba.py:1:1: I001 Import block is un-sorted or un-formatted
Expand All @@ -13,7 +13,7 @@
class TestREFLEX:
def setup_class(cls):
import cppyy
import cppyy.reflex

Check failure on line 16 in bindings/pyroot/cppyy/cppyy/test/test_numba.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

bindings/pyroot/cppyy/cppyy/test/test_numba.py:16:16: F401 `cppyy.reflex` imported but unused

def test01_instance_box_unbox(self):
"""Access to box/unbox methods"""
Expand Down Expand Up @@ -69,16 +69,16 @@
assert ns.MyData_d1.__dict__['m_int'].__cpp_reflex__(r.TYPE) == 'int'
assert ns.MyData_d1.__dict__['m_double'].__cpp_reflex__(r.TYPE) == 'double'

d = ns.MyData_d1(); daddr = cppyy.addressof(d)

Check failure on line 72 in bindings/pyroot/cppyy/cppyy/test/test_numba.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E702)

bindings/pyroot/cppyy/cppyy/test/test_numba.py:72:27: E702 Multiple statements on one line (semicolon)
assert ns.MyData_d1.__dict__['m_int'].__cpp_reflex__(r.OFFSET) == 0
assert ns.MyData_d1.__dict__['m_double'].__cpp_reflex__(r.OFFSET) == cppyy.addressof(d, 'm_double') - daddr


@mark.skipif(has_numba == False, reason="numba not found")

Check failure on line 77 in bindings/pyroot/cppyy/cppyy/test/test_numba.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E712)

bindings/pyroot/cppyy/cppyy/test/test_numba.py:77:14: E712 Avoid equality comparisons to `False`; use `not has_numba:` for false checks
class TestNUMBA:
def setup_class(cls):
import cppyy
import cppyy.numba_ext

Check failure on line 81 in bindings/pyroot/cppyy/cppyy/test/test_numba.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

bindings/pyroot/cppyy/cppyy/test/test_numba.py:81:16: F401 `cppyy.numba_ext` imported but unused

def compare(self, go_slow, go_fast, N, *args):
t0 = time.time()
Expand Down Expand Up @@ -309,8 +309,8 @@
val = getattr(nl[ntype], m)()
assert access_field(getattr(ns, 'M%d'%i)(val)) == val

@mark.xfail(reason = "Numba tests comparing execution times are sensitive and fail sporadically. \
Fails on OS X")
@mark.xfail(run=False, reason = "Numba tests comparing execution times are sensitive and fail sporadically. \
Fails on OS X and Windows 64 bit")
def test08_object_returns(self):
"""Numba-JITing of a function that returns an object"""

Expand Down Expand Up @@ -372,9 +372,9 @@

@mark.xfail(condition=IS_MAC | IS_WINDOWS, reason="Fails on macOS and Windows")
def test10_returning_a_reference(self):
import cppyy
import numpy as np
import numba

Check failure on line 377 in bindings/pyroot/cppyy/cppyy/test/test_numba.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

bindings/pyroot/cppyy/cppyy/test/test_numba.py:375:9: I001 Import block is un-sorted or un-formatted

cppyy.cppdef("""
int64_t& ref_add(int64_t x, int64_t y) {
Expand Down
10 changes: 5 additions & 5 deletions bindings/pyroot/cppyy/cppyy/test/test_stltypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def test04_vector_iteration(self):

v.__destruct__()

@mark.xfail(run=False, condition=WINDOWS_BITS == 64, reason="Fails on Windows 64 bit")
@mark.xfail(condition=WINDOWS_BITS == 64, reason="Fails on Windows 64 bit")
def test05_push_back_iterables_with_iadd(self):
"""Test usage of += of iterable on push_back-able container"""

Expand Down Expand Up @@ -447,7 +447,7 @@ def test09_vector_of_string(self):

raises(TypeError, cppyy.gbl.std.vector["std::string"], "abc")

@mark.xfail(run=False, condition=WINDOWS_BITS == 64, reason="Fails on Windows 64 bit")
@mark.xfail(condition=WINDOWS_BITS == 64, reason="Fails on Windows 64 bit")
def test10_vector_std_distance(self):
"""Use of std::distance with vector"""

Expand All @@ -459,7 +459,7 @@ def test10_vector_std_distance(self):
assert std.distance(v.begin(), v.end()) == v.size()
assert std.distance[type(v).iterator](v.begin(), v.end()) == v.size()

@mark.xfail(run=False, condition=WINDOWS_BITS == 64, reason="Fails on Windows 64 bit")
@mark.xfail(condition=WINDOWS_BITS == 64, reason="Fails on Windows 64 bit")
def test11_vector_of_pair(self):
"""Use of std::vector<std::pair>"""

Expand Down Expand Up @@ -570,7 +570,7 @@ def test13_vector_smartptr_iteration(self):
i += 1
assert i == len(result)

@mark.xfail(run=False, condition=WINDOWS_BITS == 64, reason="Fails on Windows 64 bit")
@mark.xfail(condition=WINDOWS_BITS == 64, reason="Fails on Windows 64 bit")
def test14_vector_of_vector_of_(self):
"""Nested vectors"""

Expand All @@ -586,7 +586,7 @@ def test14_vector_of_vector_of_(self):
assert vv[1][0] == 3
assert vv[1][1] == 4

@mark.xfail(run=False, condition=WINDOWS_BITS == 64, reason="Fails on Windows 64 bit")
@mark.xfail(condition=WINDOWS_BITS == 64, reason="Fails on Windows 64 bit")
def test15_vector_slicing(self):
"""Advanced test of vector slicing"""

Expand Down
14 changes: 0 additions & 14 deletions bindings/pyroot/pythonizations/python/ROOT/_facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ def _fallback_getattr(self, name):
def _register_converters_and_executors(self):

converter_aliases = {
"Long64_t": "long long",
"Long64_t ptr": "long long ptr",
"Long64_t&": "long long&",
"const Long64_t&": "const long long&",
"ULong64_t": "unsigned long long",
"ULong64_t ptr": "unsigned long long ptr",
"ULong64_t&": "unsigned long long&",
"const ULong64_t&": "const unsigned long long&",
"Float16_t": "float",
"const Float16_t&": "const float&",
"Double32_t": "double",
Expand All @@ -158,12 +150,6 @@ def _register_converters_and_executors(self):
}

executor_aliases = {
"Long64_t": "long long",
"Long64_t&": "long long&",
"Long64_t ptr": "long long ptr",
"ULong64_t": "unsigned long long",
"ULong64_t&": "unsigned long long&",
"ULong64_t ptr": "unsigned long long ptr",
"Float16_t": "float",
"Float16_t&": "float&",
"Double32_t": "double",
Expand Down
Loading