summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-10-28 23:01:21 (GMT)
committerYury Selivanov <yury@magic.io>2016-10-28 23:01:21 (GMT)
commit684ef2c88882d4c1aaf325fd0a5845740f22c8b7 (patch)
treeb762605c9a3d9c62ee6a9eeaa66ee62823fe7129 /Objects/dictobject.c
parent833c626e6739f7610593e7831166af6d2e064d74 (diff)
downloadcpython-684ef2c88882d4c1aaf325fd0a5845740f22c8b7.zip
cpython-684ef2c88882d4c1aaf325fd0a5845740f22c8b7.tar.gz
cpython-684ef2c88882d4c1aaf325fd0a5845740f22c8b7.tar.bz2
Issue #28544: Pass `PyObject*` to _PyDict_Pop, not `PyDictObject*`
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 9f98f68..62ca484 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -1768,13 +1768,17 @@ PyDict_Next(PyObject *op, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue)
/* Internal version of dict.pop(). */
PyObject *
-_PyDict_Pop(PyDictObject *mp, PyObject *key, PyObject *deflt)
+_PyDict_Pop(PyObject *dict, PyObject *key, PyObject *deflt)
{
Py_hash_t hash;
Py_ssize_t ix, hashpos;
PyObject *old_value, *old_key;
PyDictKeyEntry *ep;
PyObject **value_addr;
+ PyDictObject *mp;
+
+ assert(PyDict_Check(dict));
+ mp = (PyDictObject *)dict;
if (mp->ma_used == 0) {
if (deflt) {
@@ -2836,7 +2840,7 @@ dict_pop(PyDictObject *mp, PyObject *args)
if(!PyArg_UnpackTuple(args, "pop", 1, 2, &key, &deflt))
return NULL;
- return _PyDict_Pop(mp, key, deflt);
+ return _PyDict_Pop((PyObject*)mp, key, deflt);
}
static PyObject *