From 505ce0e43e23ac59de296f586786a7092481110c Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 6 Feb 2014 08:04:51 +0000 Subject: [PATCH] Be a little smarter about what types to use for wx[U]IntPtr git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75815 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- etg/defs.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/etg/defs.py b/etg/defs.py index eb5c6b22..9b19d0fc 100644 --- a/etg/defs.py +++ b/etg/defs.py @@ -7,6 +7,8 @@ # License: wxWindows License #--------------------------------------------------------------------------- +import sys + import etgtools import etgtools.tweaker_tools as tools @@ -32,12 +34,19 @@ def run(): # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - # tweaks for defs.h + # tweaks for defs.h to help SIP understand the types better module.find('wxInt16').type = 'short' module.find('wxInt64').type = 'long long' module.find('wxUint64').type = 'unsigned long long' - module.find('wxIntPtr').type = 'long long' #'ssize_t' - module.find('wxUIntPtr').type = 'unsigned long long' #'size_t' + + # NOTE: this is better, but probably still not totally correct... + if sys.maxsize > 2**32: + module.find('wxIntPtr').type = 'long long' #'ssize_t' + module.find('wxUIntPtr').type = 'unsigned long long' #'size_t' + else: + module.find('wxIntPtr').type = 'long' #'ssize_t' + module.find('wxUIntPtr').type = 'unsigned long' #'size_t' + module.find('wxInt8').pyInt = True module.find('wxUint8').pyInt = True module.find('wxByte').pyInt = True