(original) (raw)
On 7 Nov 2013 04:06, "victor.stinner" <python-checkins@python.org> wrote:
\>
\> http://hg.python.org/cpython/rev/69071054b42f
\> changeset: � 86968:69071054b42f
\> user: � � � �Victor Stinner <victor.stinner@gmail.com>
\> date: � � � �Wed Nov 06 18:58:22 2013 +0100
\> summary:
\> � Issue #19512: Add a new \_PyDict\_DelItemId() function, similar to
\> PyDict\_DelItemString() but using an identifier for the key
\>
\> files:
\> � Include/dictobject.h | �1 +
\> � Objects/dictobject.c | �9 +++++++++
\> � 2 files changed, 10 insertions(+), 0 deletions(-)
\>
\>
\> diff --git a/Include/dictobject.h b/Include/dictobject.h
\> --- a/Include/dictobject.h
\> +++ b/Include/dictobject.h
\> @@ -109,6 +109,7 @@
\> �PyAPI\_FUNC(int) PyDict\_SetItemString(PyObject \*dp, const char \*key, PyObject \*item);
\> �PyAPI\_FUNC(int) \_PyDict\_SetItemId(PyObject \*dp, struct \_Py\_Identifier \*key, PyObject \*item);
\> �PyAPI\_FUNC(int) PyDict\_DelItemString(PyObject \*dp, const char \*key);
\> +PyAPI\_FUNC(int) \_PyDict\_DelItemId(PyObject \*mp, struct \_Py\_Identifier \*key);
As a private API, this shouldn't be part of the stable ABI.
Cheers,
Nick.
>
\> �#ifndef Py\_LIMITED\_API
\> �int \_PyObjectDict\_SetItem(PyTypeObject \*tp, PyObject \*\*dictptr, PyObject \*name, PyObject \*value);
\> diff --git a/Objects/dictobject.c b/Objects/dictobject.c
\> --- a/Objects/dictobject.c
\> +++ b/Objects/dictobject.c
\> @@ -2736,6 +2736,15 @@
\> �}
\>
\> �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;
\>
\> --
\> Repository URL: http://hg.python.org/cpython
\>
\> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\> Python-checkins mailing list
\> Python-checkins@python.org
\> https://mail.python.org/mailman/listinfo/python-checkins
\>