banana decodes integer values greater than 2147483647 and smaller than sys.maxint as long on all platforms
[email protected] Mon, 14 Dec 2009 14:00:39 -0000
| Newsgroups | gmane.comp.python.twisted.bugs |
|---|---|
| Message-ID | <[email protected]> |
New submission from toidinamai <None>: Hi, I am working on a 64bit machine and use the Perspective Broker to wrap an API that isn't really safe to call in my main python process. This API does not accept long objects and it throws an exception even when the long objects are representable as ints, i.e. -sys.maxint-1 <= x <= sys.maxint. Sometimes the integer values I send are greater than 2147483647 and on the remote side they are decoded as longs. This means that I cannot call the wrapped API in those cases. Unfortunately the values I send are themselves contained in Python objects that mirror C structs and but it is nearly impossible for me to walk the objects and downconvert the values myself. I think when sending values through PB it should make sure they come out as the same type they went in. I tracked this down to banana and I can see that this creates a problem because banana obviously wants to be platform independent. Even though, I propose that banana should return values in the most appropriate type on each platform, i.e. ints when they fit into python ints and longs otherwise. Just calling int wherever long is now called directly should fix this an any version later than Python 2.2. Regards, Frank Benkstein. ---------- Type : enhancement Component: pb Keywords : pb, spread, banana Priority : normal Nosy : ---------- http://twistedmatrix.com/trac/ticket/4169