Skip to content

Commit 4585595

Browse files
committed
[Python] Update sync-upstream script for cppyyy syncups
1 parent c7c7d20 commit 4585595

File tree

3 files changed

+78
-83
lines changed

3 files changed

+78
-83
lines changed
Lines changed: 53 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
From 24b94cde0a5fa6b46be05359b7218af9bb295d87 Mon Sep 17 00:00:00 2001
1+
From 039221ce3b4122e41fd2b07cc1274e0af1be648c Mon Sep 17 00:00:00 2001
22
From: Jonas Rembser <[email protected]>
3-
Date: Tue, 12 Mar 2024 01:59:37 +0100
3+
Date: Fri, 28 Mar 2025 15:37:19 +0100
44
Subject: [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

1213
diff --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"];
7689
diff --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"];
90124
diff --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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
From 1e235725934294f6c85197d07103f0b48ce55f83 Mon Sep 17 00:00:00 2001
1+
From cd89b6f484be55cdea7cdf677a9fe60ff89468e4 Mon Sep 17 00:00:00 2001
22
From: Jonas Rembser <[email protected]>
3-
Date: Sat, 10 Aug 2024 15:44:23 +0200
3+
Date: Fri, 28 Mar 2025 15:34:10 +0100
44
Subject: [PATCH] [CPyCppyy] Add `TString` converters
55

66
---
@@ -9,18 +9,18 @@ Subject: [PATCH] [CPyCppyy] Add `TString` converters
99
2 files changed, 8 insertions(+)
1010

1111
diff --git a/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx b/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx
12-
index dd1752ff629..0a8bce36923 100644
12+
index 7f7a49ed3b..ad67ccf19b 100644
1313
--- a/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx
1414
+++ b/bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx
15-
@@ -1889,6 +1889,7 @@ bool CPyCppyy::name##Converter::ToMemory( \
15+
@@ -1931,6 +1931,7 @@ bool CPyCppyy::name##Converter::ToMemory( \
1616
return InstanceConverter::ToMemory(value, address, ctxt); \
1717
}
1818

1919
+CPPYY_IMPL_STRING_AS_PRIMITIVE_CONVERTER(TString, TString, Data, Length)
2020
CPPYY_IMPL_STRING_AS_PRIMITIVE_CONVERTER(STLString, std::string, c_str, size)
2121

2222

23-
@@ -3503,6 +3504,9 @@ public:
23+
@@ -3569,6 +3570,9 @@ public:
2424
gf[CCOMPLEX_D " ptr"] = gf["std::complex<double> ptr"];
2525

2626
// factories for special cases
@@ -31,7 +31,7 @@ index dd1752ff629..0a8bce36923 100644
3131
gf["const char*"] = (cf_t)+[](cdims_t) { return new CStringConverter{}; };
3232
gf["const signed char*"] = gf["const char*"];
3333
diff --git a/bindings/pyroot/cppyy/CPyCppyy/src/DeclareConverters.h b/bindings/pyroot/cppyy/CPyCppyy/src/DeclareConverters.h
34-
index 5fab4ad6ebf..609e130e2fc 100644
34+
index 3edf4b281a..b3a4246045 100644
3535
--- a/bindings/pyroot/cppyy/CPyCppyy/src/DeclareConverters.h
3636
+++ b/bindings/pyroot/cppyy/CPyCppyy/src/DeclareConverters.h
3737
@@ -9,6 +9,9 @@
@@ -44,14 +44,14 @@ index 5fab4ad6ebf..609e130e2fc 100644
4444

4545
namespace CPyCppyy {
4646

47-
@@ -365,6 +368,7 @@ protected: \
47+
@@ -370,6 +373,7 @@ protected: \
4848
strtype fBuffer; \
4949
}
5050

5151
+CPPYY_DECLARE_STRING_CONVERTER(TString, TString);
5252
CPPYY_DECLARE_STRING_CONVERTER(STLString, std::string);
5353
CPPYY_DECLARE_STRING_CONVERTER(STLWString, std::wstring);
54-
#if __cplusplus > 201402L
54+
#if (__cplusplus > 201402L) || (defined(_MSC_VER) && _MSVC_LANG > 201402L)
5555
--
56-
2.46.0
56+
2.48.1
5757

bindings/pyroot/cppyy/sync-upstream

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ git clone https://github.com/wlav/cppyy.git
1919

2020
cd CPyCppyy/
2121
git reset --hard 519071905e5d6590e924932c20d3a8e4a7eeff13
22+
23+
24+
cd CPyCppyy
25+
26+
git remote rename origin wlav
27+
git remote add guitargeek https://github.com/guitargeek/CPyCppyy.git
28+
git fetch guitargeek
29+
30+
git checkout -b sync
31+
32+
rebase_topic () {
33+
git rebase sync $1 && git branch -D sync && git checkout -b sync
34+
}
35+
36+
rebase_topic guitargeek/py_errors
37+
2238
cd ../
2339

2440
cd cppyy/

0 commit comments

Comments
 (0)