Skip to content

Commit

Permalink
Updates for Python 3.13: Add new tp_versions_used field (sstsimulator…
Browse files Browse the repository at this point in the history
  • Loading branch information
gvoskuilen authored Jan 7, 2025
1 parent 357aa44 commit cc8de7d
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 100 deletions.
6 changes: 6 additions & 0 deletions src/sst/core/model/python/pymacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ REENABLE_WARNING
#define SST_TP_WATCHED
#endif

#if PY_MINOR_VERSION >= 13
#define SST_TP_VERSIONS_USED 0,
#else
#define SST_TP_VERSIONS_USED
#endif

// Number protocol macros
#define SST_NB_DIVIDE(x)
#define SST_NB_COERCE
Expand Down
101 changes: 51 additions & 50 deletions src/sst/core/model/python/pymodel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,56 +88,57 @@ DISABLE_WARN_DEPRECATED_DECLARATION
#endif
#endif
static PyTypeObject ModuleLoaderType = {
SST_PY_OBJ_HEAD "ModuleLoader", /* tp_name */
sizeof(ModuleLoaderPy_t), /* tp_basicsize */
0, /* tp_itemsize */
nullptr, /* tp_dealloc */
0, /* tp_vectorcall_offset */
nullptr, /* tp_getattr */
nullptr, /* tp_setattr */
nullptr, /* tp_as_sync */
nullptr, /* tp_repr */
nullptr, /* tp_as_number */
nullptr, /* tp_as_sequence */
nullptr, /* tp_as_mapping */
nullptr, /* tp_hash */
nullptr, /* tp_call */
nullptr, /* tp_str */
nullptr, /* tp_getattro */
nullptr, /* tp_setattro */
nullptr, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"SST Module Loader", /* tp_doc */
nullptr, /* tp_traverse */
nullptr, /* tp_clear */
nullptr, /* tp_rich_compare */
0, /* tp_weaklistoffset */
nullptr, /* tp_iter */
nullptr, /* tp_iternext */
mlMethods, /* tp_methods */
nullptr, /* tp_members */
nullptr, /* tp_getset */
nullptr, /* tp_base */
nullptr, /* tp_dict */
nullptr, /* tp_descr_get */
nullptr, /* tp_descr_set */
0, /* tp_dictoffset */
nullptr, /* tp_init */
nullptr, /* tp_alloc */
nullptr, /* tp_new */
nullptr, /* tp_free */
nullptr, /* tp_is_gc */
nullptr, /* tp_bases */
nullptr, /* tp_mro */
nullptr, /* tp_cache */
nullptr, /* tp_subclasses */
nullptr, /* tp_weaklist */
nullptr, /* tp_del */
0, /* tp_version_tag */
nullptr, /* tp_finalize */
SST_TP_VECTORCALL /* Python3.8+ */
SST_TP_PRINT_DEP /* Python3.8 only */
SST_TP_WATCHED /* Python3.12+ */
SST_PY_OBJ_HEAD "ModuleLoader", /* tp_name */
sizeof(ModuleLoaderPy_t), /* tp_basicsize */
0, /* tp_itemsize */
nullptr, /* tp_dealloc */
0, /* tp_vectorcall_offset */
nullptr, /* tp_getattr */
nullptr, /* tp_setattr */
nullptr, /* tp_as_sync */
nullptr, /* tp_repr */
nullptr, /* tp_as_number */
nullptr, /* tp_as_sequence */
nullptr, /* tp_as_mapping */
nullptr, /* tp_hash */
nullptr, /* tp_call */
nullptr, /* tp_str */
nullptr, /* tp_getattro */
nullptr, /* tp_setattro */
nullptr, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"SST Module Loader", /* tp_doc */
nullptr, /* tp_traverse */
nullptr, /* tp_clear */
nullptr, /* tp_rich_compare */
0, /* tp_weaklistoffset */
nullptr, /* tp_iter */
nullptr, /* tp_iternext */
mlMethods, /* tp_methods */
nullptr, /* tp_members */
nullptr, /* tp_getset */
nullptr, /* tp_base */
nullptr, /* tp_dict */
nullptr, /* tp_descr_get */
nullptr, /* tp_descr_set */
0, /* tp_dictoffset */
nullptr, /* tp_init */
nullptr, /* tp_alloc */
nullptr, /* tp_new */
nullptr, /* tp_free */
nullptr, /* tp_is_gc */
nullptr, /* tp_bases */
nullptr, /* tp_mro */
nullptr, /* tp_cache */
nullptr, /* tp_subclasses */
nullptr, /* tp_weaklist */
nullptr, /* tp_del */
0, /* tp_version_tag */
nullptr, /* tp_finalize */
SST_TP_VECTORCALL /* Python3.8+ */
SST_TP_PRINT_DEP /* Python3.8 only */
SST_TP_WATCHED /* Python3.12+ */
SST_TP_VERSIONS_USED /* Python3.13+ */
};
#if PY_MAJOR_VERSION == 3
#if PY_MINOR_VERSION == 8
Expand Down
2 changes: 2 additions & 0 deletions src/sst/core/model/python/pymodel_comp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ PyTypeObject PyModel_ComponentType = {
SST_TP_VECTORCALL /* Python3.8+ */
SST_TP_PRINT_DEP /* Python3.8 only */
SST_TP_WATCHED /* Python3.12+ only */
SST_TP_VERSIONS_USED /* Python3.13+ only */
};
#if PY_MAJOR_VERSION == 3
#if PY_MINOR_VERSION == 8
Expand Down Expand Up @@ -726,6 +727,7 @@ PyTypeObject PyModel_SubComponentType = {
SST_TP_VECTORCALL /* Python3.8+ */
SST_TP_PRINT_DEP /* Python3.8 only */
SST_TP_WATCHED /* Python3.12+ */
SST_TP_VERSIONS_USED /* Python3.13+ only */
};
#if PY_MAJOR_VERSION == 3
#if PY_MINOR_VERSION == 8
Expand Down
101 changes: 51 additions & 50 deletions src/sst/core/model/python/pymodel_link.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,56 +144,57 @@ DISABLE_WARN_DEPRECATED_DECLARATION
#endif
#endif
PyTypeObject PyModel_LinkType = {
SST_PY_OBJ_HEAD "sst.Link", /* tp_name */
sizeof(LinkPy_t), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)linkDealloc, /* tp_dealloc */
0, /* tp_vectorcall_offset */
nullptr, /* tp_getattr */
nullptr, /* tp_setattr */
nullptr, /* tp_as_sync */
nullptr, /* tp_repr */
nullptr, /* tp_as_number */
nullptr, /* tp_as_sequence */
nullptr, /* tp_as_mapping */
nullptr, /* tp_hash */
nullptr, /* tp_call */
nullptr, /* tp_str */
nullptr, /* tp_getattro */
nullptr, /* tp_setattro */
nullptr, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"SST Link", /* tp_doc */
nullptr, /* tp_traverse */
nullptr, /* tp_clear */
nullptr, /* tp_richcompare */
0, /* tp_weaklistoffset */
nullptr, /* tp_iter */
nullptr, /* tp_iternext */
linkMethods, /* tp_methods */
nullptr, /* tp_members */
nullptr, /* tp_getset */
nullptr, /* tp_base */
nullptr, /* tp_dict */
nullptr, /* tp_descr_get */
nullptr, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)linkInit, /* tp_init */
nullptr, /* tp_alloc */
nullptr, /* tp_new */
nullptr, /* tp_free */
nullptr, /* tp_is_gc */
nullptr, /* tp_bases */
nullptr, /* tp_mro */
nullptr, /* tp_cache */
nullptr, /* tp_subclasses */
nullptr, /* tp_weaklist */
nullptr, /* tp_del */
0, /* tp_version_tag */
nullptr, /* tp_finalize */
SST_TP_VECTORCALL /* Python3.8+ */
SST_TP_PRINT_DEP /* Python3.8 only */
SST_TP_WATCHED /* Python3.12+ */
SST_PY_OBJ_HEAD "sst.Link", /* tp_name */
sizeof(LinkPy_t), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)linkDealloc, /* tp_dealloc */
0, /* tp_vectorcall_offset */
nullptr, /* tp_getattr */
nullptr, /* tp_setattr */
nullptr, /* tp_as_sync */
nullptr, /* tp_repr */
nullptr, /* tp_as_number */
nullptr, /* tp_as_sequence */
nullptr, /* tp_as_mapping */
nullptr, /* tp_hash */
nullptr, /* tp_call */
nullptr, /* tp_str */
nullptr, /* tp_getattro */
nullptr, /* tp_setattro */
nullptr, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"SST Link", /* tp_doc */
nullptr, /* tp_traverse */
nullptr, /* tp_clear */
nullptr, /* tp_richcompare */
0, /* tp_weaklistoffset */
nullptr, /* tp_iter */
nullptr, /* tp_iternext */
linkMethods, /* tp_methods */
nullptr, /* tp_members */
nullptr, /* tp_getset */
nullptr, /* tp_base */
nullptr, /* tp_dict */
nullptr, /* tp_descr_get */
nullptr, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)linkInit, /* tp_init */
nullptr, /* tp_alloc */
nullptr, /* tp_new */
nullptr, /* tp_free */
nullptr, /* tp_is_gc */
nullptr, /* tp_bases */
nullptr, /* tp_mro */
nullptr, /* tp_cache */
nullptr, /* tp_subclasses */
nullptr, /* tp_weaklist */
nullptr, /* tp_del */
0, /* tp_version_tag */
nullptr, /* tp_finalize */
SST_TP_VECTORCALL /* Python3.8+ */
SST_TP_PRINT_DEP /* Python3.8 only */
SST_TP_WATCHED /* Python3.12+ */
SST_TP_VERSIONS_USED /* Python3.13+ only */
};
#if PY_MAJOR_VERSION == 3
#if PY_MINOR_VERSION == 8
Expand Down
1 change: 1 addition & 0 deletions src/sst/core/model/python/pymodel_stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ PyTypeObject PyModel_StatType = {
SST_TP_VECTORCALL /* Python3.8+ */
SST_TP_PRINT_DEP /* Python3.8 only */
SST_TP_WATCHED /* Python3.12+ */
SST_TP_VERSIONS_USED /* Python3.13+ only */
};
#if PY_MAJOR_VERSION == 3
#if PY_MINOR_VERSION == 8
Expand Down
2 changes: 2 additions & 0 deletions src/sst/core/model/python/pymodel_statgroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ PyTypeObject PyModel_StatGroupType = {
SST_TP_VECTORCALL /* Python3.8+ */
SST_TP_PRINT_DEP /* Python3.8 only */
SST_TP_WATCHED /* Python3.12+ */
SST_TP_VERSIONS_USED /* Python3.13+ only */
};
#if PY_MAJOR_VERSION == 3
#if PY_MINOR_VERSION == 8
Expand Down Expand Up @@ -347,6 +348,7 @@ PyTypeObject PyModel_StatOutputType = {
SST_TP_VECTORCALL /* Python3.8+ */
SST_TP_PRINT_DEP /* Python3.8 only */
SST_TP_WATCHED /* Python3.12+ */
SST_TP_VERSIONS_USED /* Python3.13+ only */
};
#if PY_MAJOR_VERSION == 3
#if PY_MINOR_VERSION == 8
Expand Down
1 change: 1 addition & 0 deletions src/sst/core/model/python/pymodel_unitalgebra.cc
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ PyTypeObject PyModel_UnitAlgebraType = {
SST_TP_VECTORCALL /* Python3.8+ */
SST_TP_PRINT_DEP /* Python3.8 only */
SST_TP_WATCHED /* Python3.12+ */
SST_TP_VERSIONS_USED /* Python3.13+ only */
};

#if PY_MAJOR_VERSION == 3
Expand Down

0 comments on commit cc8de7d

Please sign in to comment.