Philip Jenvey committed 8e51b6c

kill unnecessary (as of 23a61cfed4a5) bits

Comments (0)

Files changed (2)


             pack = std.pack_bool
             unpack = std.unpack_bool
-            pack = std.make_int_packer(size, signed, True)
+            pack = std.make_int_packer(size, signed)
             unpack = std.make_int_unpacker(size, signed)
         native_fmttable[fmtchar] = {'size': size,


 from rpython.rlib.rstruct.error import StructError, StructOverflowError
 from rpython.rlib.unroll import unrolling_iterable
-# In the CPython struct module, pack() unconsistently accepts inputs
-# that are out-of-range or floats instead of ints.  Should we emulate
-# this?  Let's use a flag for now:
-# ____________________________________________________________
 def pack_pad(fmtiter, count):
     fmtiter.result.append_multiple_char('\x00', count)
             max = r_ulonglong(max)
     return min, max, accept_method
-def make_int_packer(size, signed, cpython_checks_range, _memo={}):
-    if cpython_checks_range:
-        check_range = True
-    else:
-        check_range = not PACK_ACCEPTS_BROKEN_INPUT
-    key = (size, signed, check_range)
+def make_int_packer(size, signed, _memo={}):
+    key = size, signed
         return _memo[key]
     except KeyError:
     def pack_int(fmtiter):
         method = getattr(fmtiter, accept_method)
         value = method()
-        if check_range:
-            if value < min or value > max:
-                raise StructError(errormsg)
+        if not min <= value <= max:
+            raise StructError(errormsg)
         if fmtiter.bigendian:
             for i in unroll_revrange_size:
                 x = (value >> (8*i)) & 0xff
 for c, size in [('b', 1), ('h', 2), ('i', 4), ('l', 4), ('q', 8)]:
     standard_fmttable[c] = {'size': size,
-                            'pack': make_int_packer(size, True, True),
+                            'pack': make_int_packer(size, True),
                             'unpack': make_int_unpacker(size, True)}
     standard_fmttable[c.upper()] = {'size': size,
-                                    'pack': make_int_packer(size, False, True),
+                                    'pack': make_int_packer(size, False),
                                     'unpack': make_int_unpacker(size, False)}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.