Re: Regression in build 1964, AddGrowableCol fails

Scott Talbert <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
It turns out that this was more complicated than I expected.  Do you 
happen to have a dev environment where you could test this patch on Win64? 
I believe it should solve the problems but I don't have a Win environment 
readily available.

Scott

On Wed, 13 Apr 2016, Eric Fahlgren wrote:

> On Wed, Apr 13, 2016 at 3:54 PM, Scott Talbert <[email protected]> wrote:
>       And you're using the 64-bit compiled version, right?
> 
> 
> Oops, forgot to say that... Correct: all 64-bit, all the time. 
> 
> I do a "pip download", check that the version looks correct, then install
> the local wheel into my venv.
> 
> wxPython_Phoenix-3.0.3.dev1943+fdf739f-cp27-cp27m-win_amd64.whl
> wxPython_Phoenix-3.0.3.dev1964+f780b21-cp27-cp27m-win_amd64.whl
> 
> --
> You received this message because you are subscribed to the Google Groups
> "wxPython-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
> 
>
fix-wacky-ints.patch (text/x-diff, 4.3 KB)
From 999d709044f24c667cb32eb94ce879e16e765edf Mon Sep 17 00:00:00 2001
From: Scott Talbert <[email protected]>
Date: Wed, 13 Apr 2016 20:29:47 -0400
Subject: [PATCH] Fix wacky ints

---
 src/wacky_ints.sip | 64 +++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 46 insertions(+), 18 deletions(-)

diff --git a/src/wacky_ints.sip b/src/wacky_ints.sip
index bd3facc..4ea91ee 100644
--- a/src/wacky_ints.sip
+++ b/src/wacky_ints.sip
@@ -19,10 +19,6 @@
 
 %MappedType size_t {
 
-    %TypeHeaderCode
-    #include <wx/setup.h>
-    %End
-
     %ConvertToTypeCode
         // Allow conversions from any number type
         if (!sipIsErr) {
@@ -32,19 +28,19 @@
         }
 
         // Do the conversion
-        #if wxSIZE_T_IS_ULONG
-            *sipCppPtr = new size_t(PyLong_AsUnsignedLong(sipPy));
+        #if PY_MAJOR_VERSION >= 3
+            *sipCppPtr = new size_t(PyLong_AsSize_t(sipPy));
         #else
-            *sipCppPtr = new size_t(PyLong_AsUnsignedLongLong(sipPy));
+            *sipCppPtr = new size_t(static_cast<size_t>(PyInt_AsUnsignedLongLongMask(sipPy)));
         #endif
         return sipGetState(sipTransferObj);
     %End
 
     %ConvertFromTypeCode
-        #if wxSIZE_T_IS_ULONG
-            return PyLong_FromUnsignedLong(*sipCpp);
+        #if PY_MAJOR_VERSION >= 3
+            return PyLong_FromSize_t(*sipCpp);
         #else
-            return PyLong_FromUnsignedLongLong(*sipCpp);
+            return PyInt_FromSize_t(*sipCpp);
         #endif
     %End
 };
@@ -68,18 +64,34 @@
 
         // Do the conversion
         #if SIZEOF_LONG >= SIZEOF_VOID_P
-            *sipCppPtr = new wxIntPtr(PyLong_AsLong(sipPy));
+            #if PY_MAJOR_VERSION >= 3
+                *sipCppPtr = new wxIntPtr(PyLong_AsLong(sipPy));
+            #else
+                *sipCppPtr = new wxIntPtr(PyInt_AsLong(sipPy));
+            #endif
         #else
-            *sipCppPtr = new wxIntPtr(PyLong_AsLongLong(sipPy));
+            #if PY_MAJOR_VERSION >= 3
+                *sipCppPtr = new wxIntPtr(PyLong_AsSsize_t(sipPy));
+            #else
+                *sipCppPtr = new wxIntPtr(PyInt_AsSsize_t(sipPy));
+            #endif
         #endif
         return sipGetState(sipTransferObj);
     %End
 
     %ConvertFromTypeCode
         #if SIZEOF_LONG >= SIZEOF_VOID_P
-            return PyLong_FromLong(*sipCpp);
+            #if PY_MAJOR_VERSION >= 3
+                return PyLong_FromLong(*sipCpp);
+            #else
+                return PyInt_FromLong(*sipCpp);
+            #endif
         #else
-            return PyLong_FromLongLong(*sipCpp);
+            #if PY_MAJOR_VERSION >= 3
+                return PyLong_FromSsize_t(*sipCpp);
+            #else
+                return PyInt_FromSsize_t(*sipCpp);
+            #endif
         #endif
     %End
 };
@@ -103,18 +115,34 @@
 
         // Do the conversion
         #if SIZEOF_LONG >= SIZEOF_VOID_P
-            *sipCppPtr = new wxUIntPtr(PyLong_AsUnsignedLong(sipPy));
+            #if PY_MAJOR_VERSION >= 3
+                *sipCppPtr = new wxUIntPtr(PyLong_AsUnsignedLong(sipPy));
+            #else
+                *sipCppPtr = new wxUIntPtr(PyInt_AsUnsignedLongMask(sipPy));
+            #endif
         #else
-            *sipCppPtr = new wxUIntPtr(PyLong_AsUnsignedLongLong(sipPy));
+            #if PY_MAJOR_VERSION >= 3
+                *sipCppPtr = new wxUIntPtr(PyLong_AsSize_t(sipPy));
+            #else
+                *sipCppPtr = new wxUIntPtr(static_cast<size_t>(PyInt_AsUnsignedLongLongMask(sipPy)));
+            #endif
         #endif
         return sipGetState(sipTransferObj);
     %End
 
     %ConvertFromTypeCode
         #if SIZEOF_LONG >= SIZEOF_VOID_P
-            return PyLong_FromUnsignedLong(*sipCpp);
+            #if PY_MAJOR_VERSION >= 3
+                return PyLong_FromUnsignedLong(*sipCpp);
+            #else
+                return PyInt_FromSize_t(*sipCpp);
+            #endif
         #else
-            return PyLong_FromUnsignedLongLong(*sipCpp);
+            #if PY_MAJOR_VERSION >= 3
+                return PyLong_FromSize_t(*sipCpp);
+            #else
+                return PyInt_FromSize_t(*sipCpp);
+            #endif
         #endif
     %End
 };
-- 
2.5.5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.