Commit ab03e674 authored by Lisandro Dalcin's avatar Lisandro Dalcin

a few fixes for Py2.3 set support

parent 6ab8a67a
...@@ -178,13 +178,19 @@ proto = """ ...@@ -178,13 +178,19 @@ proto = """
(ob)->ob_type == &PyFrozenSet_Type) (ob)->ob_type == &PyFrozenSet_Type)
#define PySet_New(iterable) \\ #define PySet_New(iterable) \\
PyObject_CallFunctionObjArgs((PyObject *)PySet_Type, iterable, NULL) PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL)
#define Pyx_PyFrozenSet_New(iterable) \\ #define Pyx_PyFrozenSet_New(iterable) \\
PyObject_CallFunctionObjArgs((PyObject *)PyFrozenSet_Type, iterable, NULL) PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL)
#define PySet_Size(anyset) \\
PyObject_Size((anyset))
#define PySet_Contains(anyset, key) \\
PySequence_Contains((anyset), (key))
#define PySet_Size(anyset) PyObject_Size(anyset) #define PySet_Pop(set) \\
#define PySet_Contains(anyset, key) PySequence_Contains(anyset, key) PyObject_CallMethod(set, "pop", NULL)
#define PySet_Pop(set) PyObject_CallMethod(set, "pop", NULL)
static INLINE int PySet_Clear(PyObject *set) { static INLINE int PySet_Clear(PyObject *set) {
PyObject *ret = PyObject_CallMethod(set, "clear", NULL); PyObject *ret = PyObject_CallMethod(set, "clear", NULL);
...@@ -218,13 +224,11 @@ static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL; ...@@ -218,13 +224,11 @@ static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL;
#define PyAnySet_Check(ob) \\ #define PyAnySet_Check(ob) \\
(PyAnySet_CheckExact(ob) || \\ (PyAnySet_CheckExact(ob) || \\
PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \\ PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \\
PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type)) PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))
#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type) #define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)
/* ---------------------------------------------------------------- */
static int __Pyx_Py23SetsImport(void) { static int __Pyx_Py23SetsImport(void) {
PyObject *sets=0, *Set=0, *ImmutableSet=0; PyObject *sets=0, *Set=0, *ImmutableSet=0;
...@@ -254,10 +258,8 @@ static int __Pyx_Py23SetsImport(void) { ...@@ -254,10 +258,8 @@ static int __Pyx_Py23SetsImport(void) {
return -1; return -1;
} }
/* ---------------------------------------------------------------- */
#else #else
static int py23sets_import(void) { return 0; } static int __Pyx_Py23SetsImport(void) { return 0; }
#endif /* !Py_SETOBJECT_H */ #endif /* !Py_SETOBJECT_H */
#endif /* < Py2.4 */ #endif /* < Py2.4 */
#endif /* < Py2.5 */ #endif /* < Py2.5 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment