mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-26 04:08:13 +08:00
gdb/python: remove Python 2/3 compatibility macros
New in this version: - Rebase on master, fix a few more issues that appeared. python-internal.h contains a number of macros that helped make the code work with both Python 2 and 3. Remove them and adjust the code to use the Python 3 functions. Change-Id: I99a3d80067fb2d65de4f69f6473ba6ffd16efb2d
This commit is contained in:
@ -89,15 +89,6 @@
|
||||
|
||||
#define Py_TPFLAGS_CHECKTYPES 0
|
||||
|
||||
#define PyInt_Check PyLong_Check
|
||||
#define PyInt_AsLong PyLong_AsLong
|
||||
#define PyInt_AsSsize_t PyLong_AsSsize_t
|
||||
|
||||
#define PyString_FromString PyUnicode_FromString
|
||||
#define PyString_Decode PyUnicode_Decode
|
||||
#define PyString_FromFormat PyUnicode_FromFormat
|
||||
#define PyString_Check PyUnicode_Check
|
||||
|
||||
/* If Python.h does not define WITH_THREAD, then the various
|
||||
GIL-related functions will not be defined. However,
|
||||
PyGILState_STATE will be. */
|
||||
@ -141,19 +132,6 @@ typedef long Py_hash_t;
|
||||
#define PyMem_RawMalloc PyMem_Malloc
|
||||
#endif
|
||||
|
||||
/* Python 2.6 did not wrap Py_DECREF in 'do {...} while (0)', leading
|
||||
to 'suggest explicit braces to avoid ambiguous ‘else’' gcc errors.
|
||||
Wrap it ourselves, so that callers don't need to care. */
|
||||
|
||||
static inline void
|
||||
gdb_Py_DECREF (void *op) /* ARI: editCase function */
|
||||
{
|
||||
Py_DECREF (op);
|
||||
}
|
||||
|
||||
#undef Py_DECREF
|
||||
#define Py_DECREF(op) gdb_Py_DECREF (op)
|
||||
|
||||
/* PyObject_CallMethod's 'method' and 'format' parameters were missing
|
||||
the 'const' qualifier before Python 3.4. Hence, we wrap the
|
||||
function in our own version to avoid errors with string literals.
|
||||
|
Reference in New Issue
Block a user