Skip to content

Commit 22ab6ae

Browse files
committed
[PyROOT] Add executors and converters for std::byte
1 parent fa8fac5 commit 22ab6ae

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3522,8 +3522,11 @@ static struct InitConvFactories_t {
35223522
gf["const signed char&"] = gf["const char&"];
35233523
#if __cplusplus > 201402L
35243524
gf["std::byte"] = gf["uint8_t"];
3525+
gf["byte"] = gf["uint8_t"];
35253526
gf["const std::byte&"] = gf["const uint8_t&"];
3527+
gf["const byte&"] = gf["const uint8_t&"];
35263528
gf["std::byte&"] = gf["uint8_t&"];
3529+
gf["byte&"] = gf["uint8_t&"];
35273530
#endif
35283531
gf["std::int8_t"] = gf["int8_t"];
35293532
gf["const std::int8_t&"] = gf["const int8_t&"];

bindings/pyroot/cppyy/CPyCppyy/src/Executors.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,8 @@ struct InitExecFactories_t {
10221022
#if __cplusplus > 201402L
10231023
gf["std::byte ptr"] = (ef_t)+[](cdims_t d) { return new ByteArrayExecutor{d}; };
10241024
gf["const std::byte ptr"] = gf["std::byte ptr"];
1025+
gf["byte ptr"] = gf["std::byte ptr"];
1026+
gf["const byte ptr"] = gf["std::byte ptr"];
10251027
#endif
10261028
gf["int8_t ptr"] = (ef_t)+[](cdims_t d) { return new Int8ArrayExecutor{d}; };
10271029
gf["uint8_t ptr"] = (ef_t)+[](cdims_t d) { return new UInt8ArrayExecutor{d}; };
@@ -1046,8 +1048,11 @@ struct InitExecFactories_t {
10461048
gf["internal_enum_type_t ptr"] = gf["int ptr"];
10471049
#if __cplusplus > 201402L
10481050
gf["std::byte"] = gf["uint8_t"];
1051+
gf["byte"] = gf["uint8_t"];
10491052
gf["std::byte&"] = gf["uint8_t&"];
1053+
gf["byte&"] = gf["uint8_t&"];
10501054
gf["const std::byte&"] = gf["const uint8_t&"];
1055+
gf["const byte&"] = gf["const uint8_t&"];
10511056
#endif
10521057
gf["std::int8_t"] = gf["int8_t"];
10531058
gf["std::int8_t&"] = gf["int8_t&"];

bindings/pyroot/cppyy/patches/CPyCppyy-Adapt-to-no-std-in-ROOT.patch

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 24b94cde0a5fa6b46be05359b7218af9bb295d87 Mon Sep 17 00:00:00 2001
22
From: Jonas Rembser <jonas.rembser@cern.ch>
33
Date: Tue, 12 Mar 2024 01:59:37 +0100
4-
Subject: [PATCH] [CPyCppyy] Adapt to no `std::` in ROOT
4+
Subject: [PATCH 1/2] [CPyCppyy] Adapt to no `std::` in ROOT
55

66
---
77
.../pyroot/cppyy/CPyCppyy/src/Converters.cxx | 20 +++++++++++--------
@@ -127,3 +127,58 @@ index c1720cf3f2..ae0e31cac8 100644
127127
--
128128
2.44.0
129129

130+
From ef0836c23c850ce3113d5a7ff5787dee9e094099 Mon Sep 17 00:00:00 2001
131+
From: Aaron Jomy <aaron.jomy@cern.ch>
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
184+

0 commit comments

Comments
 (0)