Skip to content

Commit cc8de7d

Browse files
authored
Updates for Python 3.13: Add new tp_versions_used field (#1190)
1 parent 357aa44 commit cc8de7d

File tree

7 files changed

+114
-100
lines changed

7 files changed

+114
-100
lines changed

src/sst/core/model/python/pymacros.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ REENABLE_WARNING
4646
#define SST_TP_WATCHED
4747
#endif
4848

49+
#if PY_MINOR_VERSION >= 13
50+
#define SST_TP_VERSIONS_USED 0,
51+
#else
52+
#define SST_TP_VERSIONS_USED
53+
#endif
54+
4955
// Number protocol macros
5056
#define SST_NB_DIVIDE(x)
5157
#define SST_NB_COERCE

src/sst/core/model/python/pymodel.cc

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -88,56 +88,57 @@ DISABLE_WARN_DEPRECATED_DECLARATION
8888
#endif
8989
#endif
9090
static PyTypeObject ModuleLoaderType = {
91-
SST_PY_OBJ_HEAD "ModuleLoader", /* tp_name */
92-
sizeof(ModuleLoaderPy_t), /* tp_basicsize */
93-
0, /* tp_itemsize */
94-
nullptr, /* tp_dealloc */
95-
0, /* tp_vectorcall_offset */
96-
nullptr, /* tp_getattr */
97-
nullptr, /* tp_setattr */
98-
nullptr, /* tp_as_sync */
99-
nullptr, /* tp_repr */
100-
nullptr, /* tp_as_number */
101-
nullptr, /* tp_as_sequence */
102-
nullptr, /* tp_as_mapping */
103-
nullptr, /* tp_hash */
104-
nullptr, /* tp_call */
105-
nullptr, /* tp_str */
106-
nullptr, /* tp_getattro */
107-
nullptr, /* tp_setattro */
108-
nullptr, /* tp_as_buffer */
109-
Py_TPFLAGS_DEFAULT, /* tp_flags */
110-
"SST Module Loader", /* tp_doc */
111-
nullptr, /* tp_traverse */
112-
nullptr, /* tp_clear */
113-
nullptr, /* tp_rich_compare */
114-
0, /* tp_weaklistoffset */
115-
nullptr, /* tp_iter */
116-
nullptr, /* tp_iternext */
117-
mlMethods, /* tp_methods */
118-
nullptr, /* tp_members */
119-
nullptr, /* tp_getset */
120-
nullptr, /* tp_base */
121-
nullptr, /* tp_dict */
122-
nullptr, /* tp_descr_get */
123-
nullptr, /* tp_descr_set */
124-
0, /* tp_dictoffset */
125-
nullptr, /* tp_init */
126-
nullptr, /* tp_alloc */
127-
nullptr, /* tp_new */
128-
nullptr, /* tp_free */
129-
nullptr, /* tp_is_gc */
130-
nullptr, /* tp_bases */
131-
nullptr, /* tp_mro */
132-
nullptr, /* tp_cache */
133-
nullptr, /* tp_subclasses */
134-
nullptr, /* tp_weaklist */
135-
nullptr, /* tp_del */
136-
0, /* tp_version_tag */
137-
nullptr, /* tp_finalize */
138-
SST_TP_VECTORCALL /* Python3.8+ */
139-
SST_TP_PRINT_DEP /* Python3.8 only */
140-
SST_TP_WATCHED /* Python3.12+ */
91+
SST_PY_OBJ_HEAD "ModuleLoader", /* tp_name */
92+
sizeof(ModuleLoaderPy_t), /* tp_basicsize */
93+
0, /* tp_itemsize */
94+
nullptr, /* tp_dealloc */
95+
0, /* tp_vectorcall_offset */
96+
nullptr, /* tp_getattr */
97+
nullptr, /* tp_setattr */
98+
nullptr, /* tp_as_sync */
99+
nullptr, /* tp_repr */
100+
nullptr, /* tp_as_number */
101+
nullptr, /* tp_as_sequence */
102+
nullptr, /* tp_as_mapping */
103+
nullptr, /* tp_hash */
104+
nullptr, /* tp_call */
105+
nullptr, /* tp_str */
106+
nullptr, /* tp_getattro */
107+
nullptr, /* tp_setattro */
108+
nullptr, /* tp_as_buffer */
109+
Py_TPFLAGS_DEFAULT, /* tp_flags */
110+
"SST Module Loader", /* tp_doc */
111+
nullptr, /* tp_traverse */
112+
nullptr, /* tp_clear */
113+
nullptr, /* tp_rich_compare */
114+
0, /* tp_weaklistoffset */
115+
nullptr, /* tp_iter */
116+
nullptr, /* tp_iternext */
117+
mlMethods, /* tp_methods */
118+
nullptr, /* tp_members */
119+
nullptr, /* tp_getset */
120+
nullptr, /* tp_base */
121+
nullptr, /* tp_dict */
122+
nullptr, /* tp_descr_get */
123+
nullptr, /* tp_descr_set */
124+
0, /* tp_dictoffset */
125+
nullptr, /* tp_init */
126+
nullptr, /* tp_alloc */
127+
nullptr, /* tp_new */
128+
nullptr, /* tp_free */
129+
nullptr, /* tp_is_gc */
130+
nullptr, /* tp_bases */
131+
nullptr, /* tp_mro */
132+
nullptr, /* tp_cache */
133+
nullptr, /* tp_subclasses */
134+
nullptr, /* tp_weaklist */
135+
nullptr, /* tp_del */
136+
0, /* tp_version_tag */
137+
nullptr, /* tp_finalize */
138+
SST_TP_VECTORCALL /* Python3.8+ */
139+
SST_TP_PRINT_DEP /* Python3.8 only */
140+
SST_TP_WATCHED /* Python3.12+ */
141+
SST_TP_VERSIONS_USED /* Python3.13+ */
141142
};
142143
#if PY_MAJOR_VERSION == 3
143144
#if PY_MINOR_VERSION == 8

src/sst/core/model/python/pymodel_comp.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ PyTypeObject PyModel_ComponentType = {
615615
SST_TP_VECTORCALL /* Python3.8+ */
616616
SST_TP_PRINT_DEP /* Python3.8 only */
617617
SST_TP_WATCHED /* Python3.12+ only */
618+
SST_TP_VERSIONS_USED /* Python3.13+ only */
618619
};
619620
#if PY_MAJOR_VERSION == 3
620621
#if PY_MINOR_VERSION == 8
@@ -726,6 +727,7 @@ PyTypeObject PyModel_SubComponentType = {
726727
SST_TP_VECTORCALL /* Python3.8+ */
727728
SST_TP_PRINT_DEP /* Python3.8 only */
728729
SST_TP_WATCHED /* Python3.12+ */
730+
SST_TP_VERSIONS_USED /* Python3.13+ only */
729731
};
730732
#if PY_MAJOR_VERSION == 3
731733
#if PY_MINOR_VERSION == 8

src/sst/core/model/python/pymodel_link.cc

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -144,56 +144,57 @@ DISABLE_WARN_DEPRECATED_DECLARATION
144144
#endif
145145
#endif
146146
PyTypeObject PyModel_LinkType = {
147-
SST_PY_OBJ_HEAD "sst.Link", /* tp_name */
148-
sizeof(LinkPy_t), /* tp_basicsize */
149-
0, /* tp_itemsize */
150-
(destructor)linkDealloc, /* tp_dealloc */
151-
0, /* tp_vectorcall_offset */
152-
nullptr, /* tp_getattr */
153-
nullptr, /* tp_setattr */
154-
nullptr, /* tp_as_sync */
155-
nullptr, /* tp_repr */
156-
nullptr, /* tp_as_number */
157-
nullptr, /* tp_as_sequence */
158-
nullptr, /* tp_as_mapping */
159-
nullptr, /* tp_hash */
160-
nullptr, /* tp_call */
161-
nullptr, /* tp_str */
162-
nullptr, /* tp_getattro */
163-
nullptr, /* tp_setattro */
164-
nullptr, /* tp_as_buffer */
165-
Py_TPFLAGS_DEFAULT, /* tp_flags */
166-
"SST Link", /* tp_doc */
167-
nullptr, /* tp_traverse */
168-
nullptr, /* tp_clear */
169-
nullptr, /* tp_richcompare */
170-
0, /* tp_weaklistoffset */
171-
nullptr, /* tp_iter */
172-
nullptr, /* tp_iternext */
173-
linkMethods, /* tp_methods */
174-
nullptr, /* tp_members */
175-
nullptr, /* tp_getset */
176-
nullptr, /* tp_base */
177-
nullptr, /* tp_dict */
178-
nullptr, /* tp_descr_get */
179-
nullptr, /* tp_descr_set */
180-
0, /* tp_dictoffset */
181-
(initproc)linkInit, /* tp_init */
182-
nullptr, /* tp_alloc */
183-
nullptr, /* tp_new */
184-
nullptr, /* tp_free */
185-
nullptr, /* tp_is_gc */
186-
nullptr, /* tp_bases */
187-
nullptr, /* tp_mro */
188-
nullptr, /* tp_cache */
189-
nullptr, /* tp_subclasses */
190-
nullptr, /* tp_weaklist */
191-
nullptr, /* tp_del */
192-
0, /* tp_version_tag */
193-
nullptr, /* tp_finalize */
194-
SST_TP_VECTORCALL /* Python3.8+ */
195-
SST_TP_PRINT_DEP /* Python3.8 only */
196-
SST_TP_WATCHED /* Python3.12+ */
147+
SST_PY_OBJ_HEAD "sst.Link", /* tp_name */
148+
sizeof(LinkPy_t), /* tp_basicsize */
149+
0, /* tp_itemsize */
150+
(destructor)linkDealloc, /* tp_dealloc */
151+
0, /* tp_vectorcall_offset */
152+
nullptr, /* tp_getattr */
153+
nullptr, /* tp_setattr */
154+
nullptr, /* tp_as_sync */
155+
nullptr, /* tp_repr */
156+
nullptr, /* tp_as_number */
157+
nullptr, /* tp_as_sequence */
158+
nullptr, /* tp_as_mapping */
159+
nullptr, /* tp_hash */
160+
nullptr, /* tp_call */
161+
nullptr, /* tp_str */
162+
nullptr, /* tp_getattro */
163+
nullptr, /* tp_setattro */
164+
nullptr, /* tp_as_buffer */
165+
Py_TPFLAGS_DEFAULT, /* tp_flags */
166+
"SST Link", /* tp_doc */
167+
nullptr, /* tp_traverse */
168+
nullptr, /* tp_clear */
169+
nullptr, /* tp_richcompare */
170+
0, /* tp_weaklistoffset */
171+
nullptr, /* tp_iter */
172+
nullptr, /* tp_iternext */
173+
linkMethods, /* tp_methods */
174+
nullptr, /* tp_members */
175+
nullptr, /* tp_getset */
176+
nullptr, /* tp_base */
177+
nullptr, /* tp_dict */
178+
nullptr, /* tp_descr_get */
179+
nullptr, /* tp_descr_set */
180+
0, /* tp_dictoffset */
181+
(initproc)linkInit, /* tp_init */
182+
nullptr, /* tp_alloc */
183+
nullptr, /* tp_new */
184+
nullptr, /* tp_free */
185+
nullptr, /* tp_is_gc */
186+
nullptr, /* tp_bases */
187+
nullptr, /* tp_mro */
188+
nullptr, /* tp_cache */
189+
nullptr, /* tp_subclasses */
190+
nullptr, /* tp_weaklist */
191+
nullptr, /* tp_del */
192+
0, /* tp_version_tag */
193+
nullptr, /* tp_finalize */
194+
SST_TP_VECTORCALL /* Python3.8+ */
195+
SST_TP_PRINT_DEP /* Python3.8 only */
196+
SST_TP_WATCHED /* Python3.12+ */
197+
SST_TP_VERSIONS_USED /* Python3.13+ only */
197198
};
198199
#if PY_MAJOR_VERSION == 3
199200
#if PY_MINOR_VERSION == 8

src/sst/core/model/python/pymodel_stat.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ PyTypeObject PyModel_StatType = {
221221
SST_TP_VECTORCALL /* Python3.8+ */
222222
SST_TP_PRINT_DEP /* Python3.8 only */
223223
SST_TP_WATCHED /* Python3.12+ */
224+
SST_TP_VERSIONS_USED /* Python3.13+ only */
224225
};
225226
#if PY_MAJOR_VERSION == 3
226227
#if PY_MINOR_VERSION == 8

src/sst/core/model/python/pymodel_statgroup.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ PyTypeObject PyModel_StatGroupType = {
214214
SST_TP_VECTORCALL /* Python3.8+ */
215215
SST_TP_PRINT_DEP /* Python3.8 only */
216216
SST_TP_WATCHED /* Python3.12+ */
217+
SST_TP_VERSIONS_USED /* Python3.13+ only */
217218
};
218219
#if PY_MAJOR_VERSION == 3
219220
#if PY_MINOR_VERSION == 8
@@ -347,6 +348,7 @@ PyTypeObject PyModel_StatOutputType = {
347348
SST_TP_VECTORCALL /* Python3.8+ */
348349
SST_TP_PRINT_DEP /* Python3.8 only */
349350
SST_TP_WATCHED /* Python3.12+ */
351+
SST_TP_VERSIONS_USED /* Python3.13+ only */
350352
};
351353
#if PY_MAJOR_VERSION == 3
352354
#if PY_MINOR_VERSION == 8

src/sst/core/model/python/pymodel_unitalgebra.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ PyTypeObject PyModel_UnitAlgebraType = {
505505
SST_TP_VECTORCALL /* Python3.8+ */
506506
SST_TP_PRINT_DEP /* Python3.8 only */
507507
SST_TP_WATCHED /* Python3.12+ */
508+
SST_TP_VERSIONS_USED /* Python3.13+ only */
508509
};
509510

510511
#if PY_MAJOR_VERSION == 3

0 commit comments

Comments
 (0)