mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Implement PyObject_DelItemString. Fixes #498915.
This commit is contained in:
parent
7731ed47cb
commit
b0d71d0ec6
2 changed files with 26 additions and 0 deletions
|
@ -445,6 +445,14 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
statement: o[key]=v.
|
statement: o[key]=v.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DL_IMPORT(int) PyObject_DelItemString(PyObject *o, char *key);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Remove the mapping for object, key, from the object *o.
|
||||||
|
Returns -1 on failure. This is equivalent to
|
||||||
|
the Python statement: del o[key].
|
||||||
|
*/
|
||||||
|
|
||||||
DL_IMPORT(int) PyObject_DelItem(PyObject *o, PyObject *key);
|
DL_IMPORT(int) PyObject_DelItem(PyObject *o, PyObject *key);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -174,6 +174,24 @@ PyObject_DelItem(PyObject *o, PyObject *key)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
PyObject_DelItemString(PyObject *o, char *key)
|
||||||
|
{
|
||||||
|
PyObject *okey;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (o == NULL || key == NULL) {
|
||||||
|
null_error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
okey = PyString_FromString(key);
|
||||||
|
if (okey == NULL)
|
||||||
|
return -1;
|
||||||
|
ret = PyObject_DelItem(o, okey);
|
||||||
|
Py_DECREF(okey);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int PyObject_AsCharBuffer(PyObject *obj,
|
int PyObject_AsCharBuffer(PyObject *obj,
|
||||||
const char **buffer,
|
const char **buffer,
|
||||||
int *buffer_len)
|
int *buffer_len)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue