pkgsrc/devel/py-ZopeInterface/patches/patch-aa

121 lines
3.2 KiB
Text

$NetBSD: patch-aa,v 1.1 2006/08/26 16:42:25 kristerw Exp $
Reorder functions to fix "static declaration follows non-static" error
with gcc 4.
--- Dependencies/zope.interface-ZopeInterface-3.0.1/zope.interface/_zope_interface_coptimizations.c.orig 2006-08-26 18:12:52.000000000 +0200
+++ Dependencies/zope.interface-ZopeInterface-3.0.1/zope.interface/_zope_interface_coptimizations.c 2006-08-26 18:19:11.000000000 +0200
@@ -24,6 +24,8 @@ static PyObject *BuiltinImplementationSp
static PyObject *str__class__, *str__providedBy__, *strisOrExtends;
static PyObject *empty, *fallback, *str_implied, *str_cls, *str_implements;
static PyTypeObject *Implements;
+static PyObject *Spec_providedBy(PyObject *self, PyObject *ob);
+static PyObject *Spec_implementedBy(PyObject *self, PyObject *cls);
static int imported_declarations = 0;
@@ -70,7 +72,6 @@ import_declarations(void)
return 0;
}
-extern PyTypeObject SpecType; /* Forward */
static PyObject *
implementedByFallback(PyObject *cls)
@@ -279,50 +280,10 @@ static char Spec_providedBy__doc__[] =
"Test whether an interface is implemented by the specification"
;
-static PyObject *
-Spec_providedBy(PyObject *self, PyObject *ob)
-{
- PyObject *decl, *item;
-
- decl = providedBy(NULL, ob);
- if (decl == NULL)
- return NULL;
-
- if (PyObject_TypeCheck(ob, &SpecType))
- item = Spec_extends(decl, self);
- else
- /* decl is probably a security proxy. We have to go the long way
- around.
- */
- item = PyObject_CallMethodObjArgs(decl, strisOrExtends, self, NULL);
-
- Py_DECREF(decl);
- return item;
-}
-
-
static char Spec_implementedBy__doc__[] =
"Test whether the specification is implemented by instances of a class"
;
-static PyObject *
-Spec_implementedBy(PyObject *self, PyObject *cls)
-{
- PyObject *decl, *item;
-
- decl = implementedBy(NULL, cls);
- if (decl == NULL)
- return NULL;
-
- if (PyObject_TypeCheck(decl, &SpecType))
- item = Spec_extends(decl, self);
- else
- item = PyObject_CallMethodObjArgs(decl, strisOrExtends, self, NULL);
-
- Py_DECREF(decl);
- return item;
-}
-
static struct PyMethodDef Spec_methods[] = {
{"providedBy",
(PyCFunction)Spec_providedBy, METH_O,
@@ -370,6 +331,45 @@ static PyTypeObject SpecType = {
};
static PyObject *
+Spec_providedBy(PyObject *self, PyObject *ob)
+{
+ PyObject *decl, *item;
+
+ decl = providedBy(NULL, ob);
+ if (decl == NULL)
+ return NULL;
+
+ if (PyObject_TypeCheck(ob, &SpecType))
+ item = Spec_extends(decl, self);
+ else
+ /* decl is probably a security proxy. We have to go the long way
+ around.
+ */
+ item = PyObject_CallMethodObjArgs(decl, strisOrExtends, self, NULL);
+
+ Py_DECREF(decl);
+ return item;
+}
+
+static PyObject *
+Spec_implementedBy(PyObject *self, PyObject *cls)
+{
+ PyObject *decl, *item;
+
+ decl = implementedBy(NULL, cls);
+ if (decl == NULL)
+ return NULL;
+
+ if (PyObject_TypeCheck(decl, &SpecType))
+ item = Spec_extends(decl, self);
+ else
+ item = PyObject_CallMethodObjArgs(decl, strisOrExtends, self, NULL);
+
+ Py_DECREF(decl);
+ return item;
+}
+
+static PyObject *
OSD_descr_get(PyObject *self, PyObject *inst, PyObject *cls)
{
PyObject *provides;