[pypy-svn] r47814 - pypy/dist/pypy/module/__builtin__
fijal at codespeak.net
fijal at codespeak.net
Wed Oct 24 13:03:15 CEST 2007
Author: fijal
Date: Wed Oct 24 13:03:15 2007
New Revision: 47814
Modified:
pypy/dist/pypy/module/__builtin__/importing.py
Log:
Small refactoring
Modified: pypy/dist/pypy/module/__builtin__/importing.py
==============================================================================
--- pypy/dist/pypy/module/__builtin__/importing.py (original)
+++ pypy/dist/pypy/module/__builtin__/importing.py Wed Oct 24 13:03:15 2007
@@ -461,11 +461,7 @@
return w_mod
-# helper, to avoid exposing internals of marshal and the
-# difficulties of using it though applevel.
-_r_correction = intmask(1L<<32) # == 0 on 32-bit machines
-def _r_long(stream):
- s = stream.read(4) # XXX XXX could return smaller string
+def _get_long(s):
if len(s) < 4:
return -1 # good enough for our purposes
a = ord(s[0])
@@ -475,7 +471,14 @@
x = a | (b<<8) | (c<<16) | (d<<24)
if _r_correction and d & 0x80 and x > 0:
x -= _r_correction
- return int(x)
+ return int(x)
+
+# helper, to avoid exposing internals of marshal and the
+# difficulties of using it though applevel.
+_r_correction = intmask(1L<<32) # == 0 on 32-bit machines
+def _r_long(stream):
+ s = stream.read(4) # XXX XXX could return smaller string
+ return _get_long(s)
def _w_long(stream, x):
a = x & 0xff
More information about the Pypy-commit
mailing list