On 29-Jun-2012 17:58:34 +0200, Bram Moolenaar wrote:
> Ingo Karkat wrote:
>
>> On 29-Jun-2012 16:28:48 +0200, Bram Moolenaar wrote:
>>
>>> Patch 7.3.579 (after 7.3.569)
>>> Problem: Can't compile with Python 2.5.
>>> Solution: Use PyCObject when Capsules are not available.
>>> Files: src/if_py_both.h, src/if_python.c, src/if_python3.c
>>
>> Thanks for the quick response, Bram. With this patch, I get a compile error,
>> though: (same Ubuntu 10.04/x86 / Python 2.5.2)
>>
>> gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-2.0
>> -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo
>> -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
>> -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pixman-1
>> -g
>> -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/usr/include/python2.5
>> -DPYTHON_HOME=\"/usr\" -pthread -o objects/if_python.o if_python.c
>> In file included from if_python.c:569:
>> if_py_both.h: In function ‘convert_dl’:
>> if_py_both.h:2438: error: ‘PyCObject’ undeclared (first use in this function)
>> if_py_both.h:2438: error: (Each undeclared identifier is reported only once
>> if_py_both.h:2438: error: for each function it appears in.)
>> if_py_both.h:2438: error: ‘cobject’ undeclared (first use in this function)
>> if_py_both.h:2448: error: expected expression before ‘)’ token
>> make[1]: *** [objects/if_python.o] Error 1
>> make[1]: Leaving directory `/home/inkarkat/swdev/vim/vim/src'
>> make: *** [first] Error 2
>>
>> I cannot find any definition of a PyCObject type on my system, just stuff
>> like this:
>>
>> /usr/include/python2.5/cobject.h
>> 17:PyAPI_DATA(PyTypeObject) PyCObject_Type;
>> 19:#define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type)
>> 21:/* Create a PyCObject from a pointer to a C object and an optional
>> 23: will be called with the first argument if and when the PyCObject is
>> 27:PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtr(
>> 31:/* Create a PyCObject from a pointer to a C object, a description object,
>> 34: the PyCObject is destroyed.
>> 36:PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtrAndDesc(
>> 39:/* Retrieve a pointer to a C object from a PyCObject. */
>> 40:PyAPI_FUNC(void *) PyCObject_AsVoidPtr(PyObject *);
>> 42:/* Retrieve a pointer to a description object from a PyCObject. */
>> 43:PyAPI_FUNC(void *) PyCObject_GetDesc(PyObject *);
>> 45:/* Import a pointer to a C object from a module using a PyCObject. */
>> 46:PyAPI_FUNC(void *) PyCObject_Import(char *module_name, char
>> *cobject_name);
>> 49:PyAPI_FUNC(int) PyCObject_SetVoidPtr(PyObject *self, void *cobj);
>
> PyCObject is supposed to be a sub-type of PyObject. What happens if you
> change all PyCObject to PyObject?
Yes, that compiles and works, too!
diff -r fd50c6c95265 src/if_py_both.h
--- a/src/if_py_both.h Fri Jun 29 16:28:29 2012 +0200
+++ b/src/if_py_both.h Fri Jun 29 20:37:02 2012 +0200
@@ -2435,7 +2435,7 @@
# ifdef PY_USE_CAPSULE
PyObject *capsule;
# else
- PyCObject *cobject;
+ PyObject *cobject;
# endif
char hexBuf[sizeof(void *) * 2 + 3];
@@ -2445,7 +2445,7 @@
capsule = PyDict_GetItemString(lookupDict, hexBuf);
if (capsule == NULL)
# else
- cobject = (PyCObject *)PyDict_GetItemString(lookupDict, hexBuf);
+ cobject = (PyObject *)PyDict_GetItemString(lookupDict, hexBuf);
if (cobject == NULL)
# endif
{
diff -r fd50c6c95265 src/if_python.c
--- a/src/if_python.c Fri Jun 29 16:28:29 2012 +0200
+++ b/src/if_python.c Fri Jun 29 20:37:02 2012 +0200
@@ -322,8 +322,8 @@
static PyObject* (*dll_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
static void* (*dll_PyCapsule_GetPointer)(PyObject *, char *);
# else
-static PyCObject* (*dll_PyCObject_FromVoidPtr)(void *cobj, void (*destr)(void
*));
-static void* (*dll_PyCObject_AsVoidPtr)(PyCObject *);
+static PyObject* (*dll_PyCObject_FromVoidPtr)(void *cobj, void (*destr)(void
*));
+static void* (*dll_PyCObject_AsVoidPtr)(PyObject *);
# endif
static HINSTANCE hinstPython = 0; /* Instance of python.dll */
-- regards, ingo
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php