[pypy-commit] pypy default: Uh. Fix this function. No clue how it could have worked: it

arigo noreply at buildbot.pypy.org
Fri Nov 11 13:11:42 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r49299:f87b5df4955d
Date: 2011-11-11 13:11 +0100
http://bitbucket.org/pypy/pypy/changeset/f87b5df4955d/

Log:	Uh. Fix this function. No clue how it could have worked: it
	returned "unsigned=False" for all non-Number types, like Char.

diff --git a/pypy/rpython/lltypesystem/rffi.py b/pypy/rpython/lltypesystem/rffi.py
--- a/pypy/rpython/lltypesystem/rffi.py
+++ b/pypy/rpython/lltypesystem/rffi.py
@@ -862,11 +862,12 @@
     try:
         unsigned = not tp._type.SIGNED
     except AttributeError:
-        if tp in [lltype.Char, lltype.Float, lltype.Signed] or\
-               isinstance(tp, lltype.Ptr):
+        if (isinstance(tp, lltype.Ptr) or
+            tp in (FLOAT, DOUBLE) or
+            cast(lltype.SignedLongLong, cast(tp, -1)) < 0):
             unsigned = False
         else:
-            unsigned = False
+            unsigned = True
     return size, unsigned
 
 def sizeof(tp):


More information about the pypy-commit mailing list