1 cdef extern from "Python.h":
3 ############################################################################
5 ############################################################################
7 bint PyMapping_Check(object o)
8 # Return 1 if the object provides mapping protocol, and 0
9 # otherwise. This function always succeeds.
11 Py_ssize_t PyMapping_Length(object o) except -1
12 # Returns the number of keys in object o on success, and -1 on
13 # failure. For objects that do not provide mapping protocol, this
14 # is equivalent to the Python expression "len(o)".
16 int PyMapping_DelItemString(object o, char *key) except -1
17 # Remove the mapping for object key from the object o. Return -1
18 # on failure. This is equivalent to the Python statement "del
21 int PyMapping_DelItem(object o, object key) except -1
22 # Remove the mapping for object key from the object o. Return -1
23 # on failure. This is equivalent to the Python statement "del
26 bint PyMapping_HasKeyString(object o, char *key)
27 # On success, return 1 if the mapping object has the key key and 0
28 # otherwise. This is equivalent to the Python expression
29 # "o.has_key(key)". This function always succeeds.
31 bint PyMapping_HasKey(object o, object key)
32 # Return 1 if the mapping object has the key key and 0
33 # otherwise. This is equivalent to the Python expression
34 # "o.has_key(key)". This function always succeeds.
36 object PyMapping_Keys(object o)
37 # Return value: New reference.
38 # On success, return a list of the keys in object o. On failure,
39 # return NULL. This is equivalent to the Python expression
42 object PyMapping_Values(object o)
43 # Return value: New reference.
44 # On success, return a list of the values in object o. On failure,
45 # return NULL. This is equivalent to the Python expression
48 object PyMapping_Items(object o)
49 # Return value: New reference.
50 # On success, return a list of the items in object o, where each
51 # item is a tuple containing a key-value pair. On failure, return
52 # NULL. This is equivalent to the Python expression "o.items()".
54 object PyMapping_GetItemString(object o, char *key)
55 # Return value: New reference.
56 # Return element of o corresponding to the object key or NULL on
57 # failure. This is the equivalent of the Python expression
60 int PyMapping_SetItemString(object o, char *key, object v) except -1
61 # Map the object key to the value v in object o. Returns -1 on
62 # failure. This is the equivalent of the Python statement "o[key]