[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyKDE] repository of sip?
From: Dirk Mueller <mueller () kde ! org>
Date: 2006-10-11 14:35:45
Message-ID: 200610111635.46025.mueller () kde ! org
[Download RAW message or body]
On Monday 09 October 2006 13:46, Phil Thompson wrote:
> Look in siplib/sip.h for a #if on Python v2.5. It #defines a type
> accordingly (can't remember the details at the moment). Look for where
> that type is used - that will get you most of the changes.
Yes, I've found those changes, but that doesn't seem to be enough. it still
crashes on x86_64 with a very strange backtrace. There must be something I'm
missing. I've attaced my patch so far for reference.
> The other change in 2.5 was that a Python data structure member was
> renamed. Easiest way to identify that is just to try compiling.
That one is already fixed and not the problem I'm bothering about.
Dirk
["python25.diff" (text/x-diff)]
Index: python/Makefile.am
===================================================================
--- python/Makefile.am (revision 589518)
+++ python/Makefile.am (working copy)
@@ -26,7 +26,7 @@ sipdone:
cd $(srcdir)/sip ; \
export QTDIR=${qt_dir} ; \
export PYTHONPATH=$$builddir/sip:$$PYTHONPATH ; \
- @PYTHON@ configure.py -b @bindir@ -d ${site_packages} -e ${python_inc_dir} -l qt-mt \
-v ${sip_dir} -t "$$builddir/sip" INCDIR_QT=@qt_includes@ + @PYTHON@ configure.py -b \
@bindir@ -d ${site_packages} -e ${python_inc_dir} -l qt-mt -v ${sip_dir} -t \
"$$builddir/sip" INCDIR_QT=@qt_includes@ CXXFLAGS_WARN_OFF='' CFLAGS_WARN_OFF='' \
@(cd sip ; $(MAKE)) echo "" > sipdone
Index: python/sip/siplib/sip.h
===================================================================
--- python/sip/siplib/sip.h (revision 593332)
+++ python/sip/siplib/sip.h (working copy)
@@ -47,6 +47,12 @@ extern "C" {
#define SIP_VERSION_STR "4.2.1"
#define SIP_BUILD "297"
+/* Some internal compatibility stuff. */
+#if PY_VERSION_HEX >= 0x02050000
+#define _SIP_SSIZE_T Py_ssize_t
+#else
+#define _SIP_SSIZE_T int
+#endif
/*
* Define the current API version number. SIP must handle modules with the
@@ -535,12 +541,12 @@ typedef struct _sipAPIDef {
* The following are part of the public API.
*/
void (*api_bad_catcher_result)(PyObject *method);
- void (*api_bad_length_for_slice)(int seqlen,int slicelen);
+ void (*api_bad_length_for_slice)(_SIP_SSIZE_T seqlen,_SIP_SSIZE_T slicelen);
PyObject *(*api_build_result)(int *isErr,char *fmt,...);
PyObject *(*api_call_method)(int *isErr,PyObject *method,char *fmt,...);
PyObject *(*api_class_name)(PyObject *self);
PyObject *(*api_connect_rx)(PyObject *txObj,const char *sig,PyObject *rxObj,const \
char *slot);
- int (*api_convert_from_sequence_index)(int idx,int len);
+ _SIP_SSIZE_T (*api_convert_from_sequence_index)(_SIP_SSIZE_T idx,_SIP_SSIZE_T len);
void *(*api_convert_to_cpp)(PyObject *sipSelf,sipWrapperType *type,int *iserrp);
PyObject *(*api_disconnect_rx)(PyObject *txObj,const char *sig,PyObject \
*rxObj,const char *slot); int (*api_emit_signal)(PyObject *self,const char \
*sig,PyObject *sigargs);
Index: python/sip/siplib/siplib.c
===================================================================
--- python/sip/siplib/siplib.c (revision 593332)
+++ python/sip/siplib/siplib.c (working copy)
@@ -28,12 +28,12 @@
* These are the functions that make up the public and private SIP API.
*/
static void sip_api_bad_catcher_result(PyObject *method);
-static void sip_api_bad_length_for_slice(int seqlen,int slicelen);
+static void sip_api_bad_length_for_slice(_SIP_SSIZE_T seqlen,_SIP_SSIZE_T slicelen);
static PyObject *sip_api_build_result(int *isErr,char *fmt,...);
static PyObject *sip_api_call_method(int *isErr,PyObject *method,char *fmt,
...);
static PyObject *sip_api_class_name(PyObject *self);
-static int sip_api_convert_from_sequence_index(int idx,int len);
+static _SIP_SSIZE_T sip_api_convert_from_sequence_index(_SIP_SSIZE_T idx, \
_SIP_SSIZE_T len); static void *sip_api_convert_to_cpp(PyObject \
*sipSelf,sipWrapperType *type, int *iserrp);
static PyObject *sip_api_get_wrapper(void *cppPtr,sipWrapperType *type);
@@ -2340,7 +2340,7 @@ static void sip_api_common_dtor(sipWrapp
* Convert a sequence index. Return the index or a negative value if there was
* an error.
*/
-static int sip_api_convert_from_sequence_index(int idx,int len)
+static _SIP_SSIZE_T sip_api_convert_from_sequence_index(_SIP_SSIZE_T \
idx,_SIP_SSIZE_T len) {
/* Negative indices start from the other end. */
if (idx < 0)
@@ -2934,9 +2934,15 @@ static void badArgs(int argsParsed,char
/*
* Report a sequence length that does not match the length of a slice.
*/
-static void sip_api_bad_length_for_slice(int seqlen,int slicelen)
+static void sip_api_bad_length_for_slice(_SIP_SSIZE_T seqlen,_SIP_SSIZE_T slicelen)
{
- PyErr_Format(PyExc_ValueError,"attempt to assign sequence of size %d to slice of \
size %d",seqlen,slicelen); + PyErr_Format(PyExc_ValueError,
+#if PY_VERSION_HEX >= 0x02050000
+ "attempt to assign sequence of size %zd to slice of size %zd",
+#else
+ "attempt to assign sequence of size %d to slice of size %d",
+#endif
+ seqlen,slicelen);
}
@@ -4075,7 +4081,7 @@ PyObject *sip_api_convert_from_void_ptr(
/*
* The type alloc slot.
*/
-static PyObject *sipWrapperType_alloc(PyTypeObject *self, int nitems)
+static PyObject *sipWrapperType_alloc(PyTypeObject *self, _SIP_SSIZE_T nitems)
{
PyObject *o;
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic