Skip to content

Commit 9f7ad99

Browse files
committed
Revert "[PyROOT] Use GetOptional family of C Python API where necessary"
This reverts commit 0a823d9. The idea is to show @wlav the test failures without that commit.
1 parent 277f876 commit 9f7ad99

File tree

2 files changed

+0
-10
lines changed

2 files changed

+0
-10
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,7 @@ bool CPyCppyy::InsertDispatcher(CPPScope* klass, PyObject* bases, PyObject* dct,
492492
// Python class to keep the inheritance tree intact)
493493
for (const auto& name : protected_names) {
494494
PyObject* disp_dct = PyObject_GetAttr(disp_proxy, PyStrings::gDict);
495-
#if PY_VERSION_HEX < 0x30d00f0
496495
PyObject* pyf = PyMapping_GetItemString(disp_dct, (char*)name.c_str());
497-
#else
498-
PyObject* pyf = nullptr;
499-
PyMapping_GetOptionalItemString(disp_dct, (char*)name.c_str(), &pyf);
500-
#endif
501496
if (pyf) {
502497
PyObject_SetAttrString((PyObject*)klass, (char*)name.c_str(), pyf);
503498
Py_DECREF(pyf);

bindings/tpython/src/TPyClassGenerator.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,7 @@ TClass *TPyClassGenerator::GetClass(const char *name, Bool_t load, Bool_t silent
8787
std::string func_name = PyUnicode_AsUTF8(key);
8888

8989
// figure out number of variables required
90-
#if PY_VERSION_HEX < 0x30d00f0
9190
PyObject *func_code = PyObject_GetAttrString(attr, (char *)"func_code");
92-
#else
93-
PyObject *func_code = nullptr;
94-
PyObject_GetOptionalAttrString(attr, (char *)"func_code", &func_code);
95-
#endif
9691
PyObject *var_names = func_code ? PyObject_GetAttrString(func_code, (char *)"co_varnames") : NULL;
9792
int nVars = var_names ? PyTuple_GET_SIZE(var_names) : 0 /* TODO: probably large number, all default? */;
9893
if (nVars < 0)

0 commit comments

Comments
 (0)