Issue #28544: Pass `PyObject*` to _PyDict_Pop, not `PyDictObject*`
This commit is contained in:
parent
833c626e67
commit
684ef2c888
|
@ -112,7 +112,7 @@ PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
|
||||||
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
|
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
|
||||||
Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys);
|
Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys);
|
||||||
Py_ssize_t _PyDict_SizeOf(PyDictObject *);
|
Py_ssize_t _PyDict_SizeOf(PyDictObject *);
|
||||||
PyAPI_FUNC(PyObject *) _PyDict_Pop(PyDictObject *, PyObject *, PyObject *);
|
PyAPI_FUNC(PyObject *) _PyDict_Pop(PyObject *, PyObject *, PyObject *);
|
||||||
PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
|
PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
|
||||||
#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL)
|
#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL)
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ _Py_IDENTIFIER(_wakeup);
|
||||||
|
|
||||||
/* State of the _asyncio module */
|
/* State of the _asyncio module */
|
||||||
static PyObject *all_tasks;
|
static PyObject *all_tasks;
|
||||||
static PyDictObject *current_tasks;
|
static PyObject *current_tasks;
|
||||||
static PyObject *traceback_extract_stack;
|
static PyObject *traceback_extract_stack;
|
||||||
static PyObject *asyncio_get_event_loop;
|
static PyObject *asyncio_get_event_loop;
|
||||||
static PyObject *asyncio_future_repr_info_func;
|
static PyObject *asyncio_future_repr_info_func;
|
||||||
|
@ -1429,11 +1429,11 @@ _asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = PyDict_GetItem((PyObject*)current_tasks, loop);
|
res = PyDict_GetItem(current_tasks, loop);
|
||||||
Py_DECREF(loop);
|
Py_DECREF(loop);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res = PyDict_GetItem((PyObject*)current_tasks, loop);
|
res = PyDict_GetItem(current_tasks, loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == NULL) {
|
if (res == NULL) {
|
||||||
|
@ -2235,7 +2235,7 @@ task_step(TaskObj *task, PyObject *exc)
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
PyObject *ot;
|
PyObject *ot;
|
||||||
|
|
||||||
if (PyDict_SetItem((PyObject *)current_tasks,
|
if (PyDict_SetItem(current_tasks,
|
||||||
task->task_loop, (PyObject*)task) == -1)
|
task->task_loop, (PyObject*)task) == -1)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2385,7 +2385,7 @@ module_init(void)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
current_tasks = (PyDictObject *)PyDict_New();
|
current_tasks = PyDict_New();
|
||||||
if (current_tasks == NULL) {
|
if (current_tasks == NULL) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1768,13 +1768,17 @@ PyDict_Next(PyObject *op, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue)
|
||||||
|
|
||||||
/* Internal version of dict.pop(). */
|
/* Internal version of dict.pop(). */
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyDict_Pop(PyDictObject *mp, PyObject *key, PyObject *deflt)
|
_PyDict_Pop(PyObject *dict, PyObject *key, PyObject *deflt)
|
||||||
{
|
{
|
||||||
Py_hash_t hash;
|
Py_hash_t hash;
|
||||||
Py_ssize_t ix, hashpos;
|
Py_ssize_t ix, hashpos;
|
||||||
PyObject *old_value, *old_key;
|
PyObject *old_value, *old_key;
|
||||||
PyDictKeyEntry *ep;
|
PyDictKeyEntry *ep;
|
||||||
PyObject **value_addr;
|
PyObject **value_addr;
|
||||||
|
PyDictObject *mp;
|
||||||
|
|
||||||
|
assert(PyDict_Check(dict));
|
||||||
|
mp = (PyDictObject *)dict;
|
||||||
|
|
||||||
if (mp->ma_used == 0) {
|
if (mp->ma_used == 0) {
|
||||||
if (deflt) {
|
if (deflt) {
|
||||||
|
@ -2836,7 +2840,7 @@ dict_pop(PyDictObject *mp, PyObject *args)
|
||||||
if(!PyArg_UnpackTuple(args, "pop", 1, 2, &key, &deflt))
|
if(!PyArg_UnpackTuple(args, "pop", 1, 2, &key, &deflt))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return _PyDict_Pop(mp, key, deflt);
|
return _PyDict_Pop((PyObject*)mp, key, deflt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
Loading…
Reference in New Issue