Skip to content

Commit

Permalink
Use PyObject_Free instead of deprecated macros
Browse files Browse the repository at this point in the history
Python 3.10 comments the macros PyObject_Del and PyObject_DEL as deprecated
  • Loading branch information
wsfulton committed Mar 18, 2024
1 parent 03fc872 commit 45186fc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Lib/python/builtin.swg
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap
if (PyType_IS_GC(a->ob_type)) {
PyObject_GC_Del(a);
} else {
PyObject_Del(a);
PyObject_Free(a);
}
}

Expand Down
4 changes: 0 additions & 4 deletions Lib/python/pyhead.swg
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ SWIG_Python_str_FromChar(const char *c)
#endif
}

#ifndef PyObject_DEL
# define PyObject_DEL PyObject_Del
#endif

/* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */
# define SWIGPY_USE_CAPSULE
#ifdef SWIGPYTHON_BUILTIN
Expand Down
6 changes: 3 additions & 3 deletions Lib/python/pyrun.swg
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ SwigPyObject_dealloc(PyObject *v)
#ifdef SWIGPYTHON_BUILTIN
Py_DecRef(sobj->dict);
#endif
PyObject_DEL(v);
PyObject_Free(v);
}

SWIGRUNTIME PyObject*
Expand Down Expand Up @@ -1155,7 +1155,7 @@ SwigPyPacked_dealloc(PyObject *v)
SwigPyPacked *sobj = (SwigPyPacked *) v;
free(sobj->pack);
}
PyObject_DEL(v);
PyObject_Free(v);
}

SWIGRUNTIME PyTypeObject*
Expand Down Expand Up @@ -1284,7 +1284,7 @@ SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
sobj->ty = ty;
sobj->size = size;
} else {
PyObject_DEL((PyObject *) sobj);
PyObject_Free((PyObject *)sobj);
sobj = 0;
}
}
Expand Down

0 comments on commit 45186fc

Please sign in to comment.