summaryrefslogtreecommitdiff
path: root/Cython/Includes/cpython/dict.pxd
diff options
context:
space:
mode:
Diffstat (limited to 'Cython/Includes/cpython/dict.pxd')
-rw-r--r--Cython/Includes/cpython/dict.pxd21
1 files changed, 21 insertions, 0 deletions
diff --git a/Cython/Includes/cpython/dict.pxd b/Cython/Includes/cpython/dict.pxd
index 16dd5e145..979dd392a 100644
--- a/Cython/Includes/cpython/dict.pxd
+++ b/Cython/Includes/cpython/dict.pxd
@@ -1,6 +1,13 @@
from .object cimport PyObject
+from .pyport cimport uint64_t
cdef extern from "Python.h":
+ # On Python 2, PyDict_GetItemWithError is called _PyDict_GetItemWithError
+ """
+ #if PY_MAJOR_VERSION <= 2
+ #define PyDict_GetItemWithError _PyDict_GetItemWithError
+ #endif
+ """
############################################################################
# 7.4.1 Dictionary Objects
@@ -72,11 +79,25 @@ cdef extern from "Python.h":
# NULL if the key key is not present, but without setting an
# exception.
+ PyObject* PyDict_GetItemWithError(object p, object key) except? NULL
+ # Return value: Borrowed reference.
+ # Variant of PyDict_GetItem() that does not suppress exceptions. Return
+ # NULL with an exception set if an exception occurred. Return NULL
+ # without an exception set if the key wasn’t present.
+
PyObject* PyDict_GetItemString(object p, const char *key)
# Return value: Borrowed reference.
# This is the same as PyDict_GetItem(), but key is specified as a
# char*, rather than a PyObject*.
+ PyObject* PyDict_SetDefault(object p, object key, object default) except NULL
+ # Return value: Borrowed reference.
+ # This is the same as the Python-level dict.setdefault(). If present, it
+ # returns the value corresponding to key from the dictionary p. If the key
+ # is not in the dict, it is inserted with value defaultobj and defaultobj
+ # is returned. This function evaluates the hash function of key only once,
+ # instead of evaluating it independently for the lookup and the insertion.
+
list PyDict_Items(object p)
# Return value: New reference.
# Return a PyListObject containing all the items from the