summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-06 17:58:22 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-06 17:58:22 (GMT)
commit5fd2e5ae8ae3dfaaf96d9771eb6f3fcacc4d3b31 (patch)
tree284086fc6eaa8624d69335bc0c8dc7b206939d87 /Objects
parent7a07e451a4f0a7c5b68af76f5ac6a6b1c2b10210 (diff)
downloadcpython-5fd2e5ae8ae3dfaaf96d9771eb6f3fcacc4d3b31.zip
cpython-5fd2e5ae8ae3dfaaf96d9771eb6f3fcacc4d3b31.tar.gz
cpython-5fd2e5ae8ae3dfaaf96d9771eb6f3fcacc4d3b31.tar.bz2
Issue #19512: Add a new _PyDict_DelItemId() function, similar to
PyDict_DelItemString() but using an identifier for the key
Diffstat (limited to 'Objects')
-rw-r--r--Objects/dictobject.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 2424176..a5072c8 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -2736,6 +2736,15 @@ PyDict_SetItemString(PyObject *v, const char *key, PyObject *item)
}
int
+_PyDict_DelItemId(PyObject *v, _Py_Identifier *key)
+{
+ PyObject *kv = _PyUnicode_FromId(key); /* borrowed */
+ if (kv == NULL)
+ return -1;
+ return PyDict_DelItem(v, kv);
+}
+
+int
PyDict_DelItemString(PyObject *v, const char *key)
{
PyObject *kv;