1- From 24b94cde0a5fa6b46be05359b7218af9bb295d87 Mon Sep 17 00:00:00 2001
1+ From 039221ce3b4122e41fd2b07cc1274e0af1be648c Mon Sep 17 00:00:00 2001
22From: Jonas Rembser <
[email protected] >
3- Date: Tue, 12 Mar 2024 01:59:37 +0100
3+ Date: Fri, 28 Mar 2025 15:37:19 +0100
44Subject: [PATCH 1/2] [CPyCppyy] Adapt to no `std::` in ROOT
55
6+ This reverts commit e44748ee03467a37d9faf8feabc01bc1c6e6be0a.
67---
7- .../pyroot/cppyy/CPyCppyy/src/Converters.cxx | 20 +++++++++++- -------
8- .../pyroot/cppyy/CPyCppyy/src/Executors.cxx | 2 ++
9- .../pyroot/cppyy/CPyCppyy/src/Pythonize.cxx | 8 ++++ ----
10- 3 files changed, 18 insertions(+), 12 deletions(-)
8+ .../pyroot/cppyy/CPyCppyy/src/Converters.cxx | 23 ++++++++++++ -------
9+ .../pyroot/cppyy/CPyCppyy/src/Executors.cxx | 7 ++++ ++
10+ .../pyroot/cppyy/CPyCppyy/src/Pythonize.cxx | 8 +++----
11+ 3 files changed, 26 insertions(+), 12 deletions(-)
1112
1213diff --git a/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx b/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx
13- index efd404aebe..4ac294745c 100644
14+ index ad67ccf19b..4cef37e74e 100644
1415--- a/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx
1516+++ b/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx
16- @@ -3164 ,7 +3164 ,7 @@ CPyCppyy::Converter* CPyCppyy::CreateConverter(const std::string& fullType, cdim
17+ @@ -3270 ,7 +3270 ,7 @@ CPyCppyy::Converter* CPyCppyy::CreateConverter(const std::string& fullType, cdim
1718 }
1819
1920 //-- special case: initializer list
@@ -22,7 +23,7 @@ index efd404aebe..4ac294745c 100644
2223 // get the type of the list and create a converter (TODO: get hold of value_type?)
2324 auto pos = realType.find('<');
2425 std::string value_type = realType.substr(pos+1, realType.size()-pos-2);
25- @@ -3175 ,8 +3175 ,9 @@ CPyCppyy::Converter* CPyCppyy::CreateConverter(const std::string& fullType, cdim
26+ @@ -3281 ,8 +3281 ,9 @@ CPyCppyy::Converter* CPyCppyy::CreateConverter(const std::string& fullType, cdim
2627 bool control = cpd == "&" || isConst;
2728
2829 //-- special case: std::function
@@ -34,7 +35,7 @@ index efd404aebe..4ac294745c 100644
3435
3536 // get actual converter for normal passing
3637 Converter* cnv = selectInstanceCnv(
37- @@ -3184 ,14 +3185 ,14 @@ CPyCppyy::Converter* CPyCppyy::CreateConverter(const std::string& fullType, cdim
38+ @@ -3290 ,14 +3291 ,14 @@ CPyCppyy::Converter* CPyCppyy::CreateConverter(const std::string& fullType, cdim
3839
3940 if (cnv) {
4041 // get the type of the underlying (TODO: use target_type?)
@@ -53,7 +54,7 @@ index efd404aebe..4ac294745c 100644
5354 } else if (cnv->HasState())
5455 delete cnv;
5556 }
56- @@ -3301 ,7 +3302 ,7 @@ std::string::size_type dims2stringsz(cdims_t d) {
57+ @@ -3424 ,7 +3425 ,7 @@ std::string::size_type dims2stringsz(cdims_t d) {
5758 return (d && d.ndim() != UNKNOWN_SIZE) ? d[0] : std::string::npos;
5859 }
5960
@@ -62,22 +63,55 @@ index efd404aebe..4ac294745c 100644
6263 #define WSTRING1 "std::basic_string<wchar_t>"
6364 #define WSTRING2 "std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>"
6465
65- @@ -3484,7 +3485,10 @@ public:
66+ @@ -3541,8 +3542,11 @@ public:
67+ gf["const signed char&"] = gf["const char&"];
68+ #if (__cplusplus > 201402L) || (defined(_MSC_VER) && _MSVC_LANG > 201402L)
69+ gf["std::byte"] = gf["uint8_t"];
70+ + gf["byte"] = gf["uint8_t"];
71+ gf["const std::byte&"] = gf["const uint8_t&"];
72+ + gf["const byte&"] = gf["const uint8_t&"];
73+ gf["std::byte&"] = gf["uint8_t&"];
74+ + gf["byte&"] = gf["uint8_t&"];
75+ #endif
76+ gf["std::int8_t"] = gf["int8_t"];
77+ gf["const std::int8_t&"] = gf["const int8_t&"];
78+ @@ -3596,7 +3600,10 @@ public:
6679 gf["char ptr"] = gf["char*[]"];
6780 gf["std::string"] = (cf_t)+[](cdims_t) { return new STLStringConverter{}; };
6881 gf["const std::string&"] = gf["std::string"];
6982+ gf["string"] = gf["std::string"];
7083+ gf["const string&"] = gf["std::string"];
7184 gf["std::string&&"] = (cf_t)+[](cdims_t) { return new STLStringMoveConverter{}; };
7285+ gf["string&&"] = gf["std::string&&"];
73- #if __cplusplus > 201402L
86+ #if ( __cplusplus > 201402L) || (defined(_MSC_VER) && _MSVC_LANG > 201402L)
7487 gf["std::string_view"] = (cf_t)+[](cdims_t) { return new STLStringViewConverter{}; };
7588 gf[STRINGVIEW] = gf["std::string_view"];
7689diff --git a/bindings/pyroot/cppyy/CPyCppyy/src/Executors.cxx b/bindings/pyroot/cppyy/CPyCppyy/src/Executors.cxx
77- index 9692fc8535..70d8f72596 100644
90+ index 483df5d3fb..954be57848 100644
7891--- a/bindings/pyroot/cppyy/CPyCppyy/src/Executors.cxx
7992+++ b/bindings/pyroot/cppyy/CPyCppyy/src/Executors.cxx
80- @@ -1088,7 +1088,9 @@ public:
93+ @@ -1022,6 +1022,8 @@ public:
94+ #if (__cplusplus > 201402L) || (defined(_MSC_VER) && _MSVC_LANG > 201402L)
95+ gf["std::byte ptr"] = (ef_t)+[](cdims_t d) { return new ByteArrayExecutor{d}; };
96+ gf["const std::byte ptr"] = gf["std::byte ptr"];
97+ + gf["byte ptr"] = gf["std::byte ptr"];
98+ + gf["const byte ptr"] = gf["std::byte ptr"];
99+ #endif
100+ gf["int8_t ptr"] = (ef_t)+[](cdims_t d) { return new Int8ArrayExecutor{d}; };
101+ gf["uint8_t ptr"] = (ef_t)+[](cdims_t d) { return new UInt8ArrayExecutor{d}; };
102+ @@ -1046,8 +1048,11 @@ public:
103+ gf["internal_enum_type_t ptr"] = gf["int ptr"];
104+ #if (__cplusplus > 201402L) || (defined(_MSC_VER) && _MSVC_LANG > 201402L)
105+ gf["std::byte"] = gf["uint8_t"];
106+ + gf["byte"] = gf["uint8_t"];
107+ gf["std::byte&"] = gf["uint8_t&"];
108+ + gf["byte&"] = gf["uint8_t&"];
109+ gf["const std::byte&"] = gf["const uint8_t&"];
110+ + gf["const byte&"] = gf["const uint8_t&"];
111+ #endif
112+ gf["std::int8_t"] = gf["int8_t"];
113+ gf["std::int8_t&"] = gf["int8_t&"];
114+ @@ -1082,7 +1087,9 @@ public:
81115 gf["char16_t*"] = (ef_t)+[](cdims_t) { static CString16Executor e{}; return &e;};
82116 gf["char32_t*"] = (ef_t)+[](cdims_t) { static CString32Executor e{}; return &e;};
83117 gf["std::string"] = (ef_t)+[](cdims_t) { static STLStringExecutor e{}; return &e; };
@@ -88,7 +122,7 @@ index 9692fc8535..70d8f72596 100644
88122 gf[WSTRING1] = gf["std::wstring"];
89123 gf[WSTRING2] = gf["std::wstring"];
90124diff --git a/bindings/pyroot/cppyy/CPyCppyy/src/Pythonize.cxx b/bindings/pyroot/cppyy/CPyCppyy/src/Pythonize.cxx
91- index c1720cf3f2..ae0e31cac8 100644
125+ index dd63ceb40c..9b87905bab 100644
92126--- a/bindings/pyroot/cppyy/CPyCppyy/src/Pythonize.cxx
93127+++ b/bindings/pyroot/cppyy/CPyCppyy/src/Pythonize.cxx
94128@@ -67,7 +67,7 @@ PyObject* GetAttrDirect(PyObject* pyclass, PyObject* pyname) {
@@ -100,7 +134,7 @@ index c1720cf3f2..ae0e31cac8 100644
100134 }
101135
102136 // to prevent compiler warnings about const char* -> char*
103- @@ -1873 ,7 +1873 ,7 @@ bool CPyCppyy::Pythonize(PyObject* pyclass, const std::string& name)
137+ @@ -1882 ,7 +1882 ,7 @@ bool CPyCppyy::Pythonize(PyObject* pyclass, const std::string& name)
104138 Utility::AddToClass(pyclass, "__iter__", (PyCFunction)PyObject_SelfIter, METH_NOARGS);
105139 }
106140
@@ -109,7 +143,7 @@ index c1720cf3f2..ae0e31cac8 100644
109143 Utility::AddToClass(pyclass, "__repr__", (PyCFunction)STLStringRepr, METH_NOARGS);
110144 Utility::AddToClass(pyclass, "__str__", (PyCFunction)STLStringStr, METH_NOARGS);
111145 Utility::AddToClass(pyclass, "__bytes__", (PyCFunction)STLStringBytes, METH_NOARGS);
112- @@ -1894 ,12 +1894 ,12 @@ bool CPyCppyy::Pythonize(PyObject* pyclass, const std::string& name)
146+ @@ -1903 ,12 +1903 ,12 @@ bool CPyCppyy::Pythonize(PyObject* pyclass, const std::string& name)
113147 ((PyTypeObject*)pyclass)->tp_hash = (hashfunc)STLStringHash;
114148 }
115149
@@ -125,60 +159,5 @@ index c1720cf3f2..ae0e31cac8 100644
125159 Utility::AddToClass(pyclass, "__str__", (PyCFunction)STLWStringStr, METH_NOARGS);
126160 Utility::AddToClass(pyclass, "__bytes__", (PyCFunction)STLWStringBytes, METH_NOARGS);
127161- -
128- 2.44.0
129-
130- From ef0836c23c850ce3113d5a7ff5787dee9e094099 Mon Sep 17 00:00:00 2001
131- From: Aaron Jomy <
[email protected] >
132- Date: Tue, 21 Jan 2025 14:09:03 +0100
133- Subject: [PATCH 2/2] [PyROOT] Add executors and converters for `std::byte`
134-
135- Fixes issue: https://github.com/root-project/root/issues/17442
136- ---
137- bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx | 3 +++
138- bindings/pyroot/cppyy/CPyCppyy/src/Executors.cxx | 5 +++++
139- 2 files changed, 8 insertions(+)
140-
141- diff --git a/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx b/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx
142- index c127604a6e..21d3d4aa73 100644
143- --- a/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx
144- +++ b/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx
145- @@ -3522,8 +3522,11 @@ public:
146- gf["const signed char&"] = gf["const char&"];
147- #if __cplusplus > 201402L
148- gf["std::byte"] = gf["uint8_t"];
149- + gf["byte"] = gf["uint8_t"];
150- gf["const std::byte&"] = gf["const uint8_t&"];
151- + gf["const byte&"] = gf["const uint8_t&"];
152- gf["std::byte&"] = gf["uint8_t&"];
153- + gf["byte&"] = gf["uint8_t&"];
154- #endif
155- gf["std::int8_t"] = gf["int8_t"];
156- gf["const std::int8_t&"] = gf["const int8_t&"];
157- diff --git a/bindings/pyroot/cppyy/CPyCppyy/src/Executors.cxx b/bindings/pyroot/cppyy/CPyCppyy/src/Executors.cxx
158- index 5e94846771..edefcf5b5b 100644
159- --- a/bindings/pyroot/cppyy/CPyCppyy/src/Executors.cxx
160- +++ b/bindings/pyroot/cppyy/CPyCppyy/src/Executors.cxx
161- @@ -1022,6 +1022,8 @@ public:
162- #if __cplusplus > 201402L
163- gf["std::byte ptr"] = (ef_t)+[](cdims_t d) { return new ByteArrayExecutor{d}; };
164- gf["const std::byte ptr"] = gf["std::byte ptr"];
165- + gf["byte ptr"] = gf["std::byte ptr"];
166- + gf["const byte ptr"] = gf["std::byte ptr"];
167- #endif
168- gf["int8_t ptr"] = (ef_t)+[](cdims_t d) { return new Int8ArrayExecutor{d}; };
169- gf["uint8_t ptr"] = (ef_t)+[](cdims_t d) { return new UInt8ArrayExecutor{d}; };
170- @@ -1046,8 +1048,11 @@ public:
171- gf["internal_enum_type_t ptr"] = gf["int ptr"];
172- #if __cplusplus > 201402L
173- gf["std::byte"] = gf["uint8_t"];
174- + gf["byte"] = gf["uint8_t"];
175- gf["std::byte&"] = gf["uint8_t&"];
176- + gf["byte&"] = gf["uint8_t&"];
177- gf["const std::byte&"] = gf["const uint8_t&"];
178- + gf["const byte&"] = gf["const uint8_t&"];
179- #endif
180- gf["std::int8_t"] = gf["int8_t"];
181- gf["std::int8_t&"] = gf["int8_t&"];
182- - -
183- 2.43.0
162+ 2.48.1
184163
0 commit comments