mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 12:30:07 +01:00
Deal with object IDs that are larger than 2**63
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75338 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -144,8 +144,13 @@ def run():
|
||||
PyFunctionDef('ObjectToItem', '(self, obj)',
|
||||
doc="Create a :class:`DataViewItem` for the object, and remember the ID-->obj mapping.",
|
||||
body="""\
|
||||
import sys
|
||||
maxoid = sys.maxint # 2**63 - 1 ??
|
||||
oid = id(obj)
|
||||
self.mapper[oid] = obj
|
||||
while oid > maxoid:
|
||||
# risk of conflict here... May need some more thought.
|
||||
oid -= maxoid
|
||||
self.mapper[oid] = obj
|
||||
return DataViewItem(oid)
|
||||
"""),
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ def run():
|
||||
module.find('wxInt16').type = 'short'
|
||||
module.find('wxInt64').type = 'long long'
|
||||
module.find('wxUint64').type = 'unsigned long long'
|
||||
module.find('wxIntPtr').type = 'long' #'ssize_t'
|
||||
module.find('wxUIntPtr').type = 'unsigned long' #'size_t'
|
||||
module.find('wxIntPtr').type = 'long long' #'ssize_t'
|
||||
module.find('wxUIntPtr').type = 'unsigned long long' #'size_t'
|
||||
module.find('wxInt8').pyInt = True
|
||||
module.find('wxUint8').pyInt = True
|
||||
module.find('wxByte').pyInt = True
|
||||
|
||||
@@ -40,8 +40,17 @@ class dataview_Tests(wtc.WidgetTestCase):
|
||||
dvi2 = dv.DataViewItem(222)
|
||||
self.assertTrue(int(dvi1.GetID()) == 111)
|
||||
self.assertTrue(int(dvi2.ID) == 222)
|
||||
|
||||
|
||||
def test_dataviewItem7(self):
|
||||
# max integer size on platforms where long is 64-bit
|
||||
n = 2**63 - 1
|
||||
assert type(n) is long
|
||||
dvi = dv.DataViewItem(n)
|
||||
self.assertTrue(dvi)
|
||||
self.assertTrue(int(dvi.GetID()) == n)
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
def test_dataviewItemAttr1(self):
|
||||
a = dv.DataViewItemAttr()
|
||||
|
||||
Reference in New Issue
Block a user