diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2010-01-11 23:17:10 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2010-01-11 23:17:10 (GMT) |
commit | 69eb51697c65f8a1009e51f80f3d7abcc62b7344 (patch) | |
tree | 4dba5e0e40d26847db55be34617db0442d50fba2 /Include | |
parent | 7a8df802851ae997d65a5022224eddfa3843e06e (diff) | |
download | cpython-69eb51697c65f8a1009e51f80f3d7abcc62b7344.zip cpython-69eb51697c65f8a1009e51f80f3d7abcc62b7344.tar.gz cpython-69eb51697c65f8a1009e51f80f3d7abcc62b7344.tar.bz2 |
Issue #1967: Backport dictionary views.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/dictobject.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Include/dictobject.h b/Include/dictobject.h index 06e0a7e..dfd42dc 100644 --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -89,10 +89,22 @@ struct _dictobject { }; PyAPI_DATA(PyTypeObject) PyDict_Type; +PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; +PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; +PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; +PyAPI_DATA(PyTypeObject) PyDictKeys_Type; +PyAPI_DATA(PyTypeObject) PyDictItems_Type; +PyAPI_DATA(PyTypeObject) PyDictValues_Type; #define PyDict_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) +#define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type) +#define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type) +#define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type) +/* This excludes Values, since they are not sets. */ +# define PyDictViewSet_Check(op) \ + (PyDictKeys_Check(op) || PyDictItems_Check(op)) PyAPI_FUNC(PyObject *) PyDict_New(void); PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); |