mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-35059: Add _PyObject_CAST() macro (GH-10645)
Add _PyObject_CAST() and _PyVarObject_CAST() macros to cast argument to PyObject* and PyVarObject* properly.
This commit is contained in:
parent
271753a27a
commit
2ff8fb7639
5 changed files with 29 additions and 23 deletions
|
@ -27,13 +27,13 @@ PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item);
|
|||
PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key);
|
||||
|
||||
/* wrappers around PyDict* functions */
|
||||
#define PyODict_GetItem(od, key) PyDict_GetItem((PyObject *)od, key)
|
||||
#define PyODict_GetItem(od, key) PyDict_GetItem(_PyObject_CAST(od), key)
|
||||
#define PyODict_GetItemWithError(od, key) \
|
||||
PyDict_GetItemWithError((PyObject *)od, key)
|
||||
#define PyODict_Contains(od, key) PyDict_Contains((PyObject *)od, key)
|
||||
#define PyODict_Size(od) PyDict_Size((PyObject *)od)
|
||||
PyDict_GetItemWithError(_PyObject_CAST(od), key)
|
||||
#define PyODict_Contains(od, key) PyDict_Contains(_PyObject_CAST(od), key)
|
||||
#define PyODict_Size(od) PyDict_Size(_PyObject_CAST(od))
|
||||
#define PyODict_GetItemString(od, key) \
|
||||
PyDict_GetItemString((PyObject *)od, key)
|
||||
PyDict_GetItemString(_PyObject_CAST(od), key)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue