[Python-checkins] r58171 - sandbox/trunk/import_in_py/Py3K/importlib.py
brett.cannon
python-checkins at python.org
Mon Sep 17 01:12:49 CEST 2007
Author: brett.cannon
Date: Mon Sep 17 01:12:49 2007
New Revision: 58171
Modified:
sandbox/trunk/import_in_py/Py3K/importlib.py
Log:
Update _r_long and _w_long to work with bytes instead of strings.
Modified: sandbox/trunk/import_in_py/Py3K/importlib.py
==============================================================================
--- sandbox/trunk/import_in_py/Py3K/importlib.py (original)
+++ sandbox/trunk/import_in_py/Py3K/importlib.py Mon Sep 17 01:12:49 2007
@@ -53,12 +53,12 @@
"""
x = int(x)
- int_bytes = []
+ int_bytes = bytes()
int_bytes.append(x & 0xFF)
int_bytes.append((x >> 8) & 0xFF)
int_bytes.append((x >> 16) & 0xFF)
int_bytes.append((x >> 24) & 0xFF)
- return ''.join(chr(x) for x in int_bytes)
+ return int_bytes
def _r_long(int_bytes):
@@ -67,10 +67,10 @@
XXX Temporary until marshal's long function are exposed.
"""
- x = ord(int_bytes[0])
- x |= ord(int_bytes[1]) << 8
- x |= ord(int_bytes[2]) << 16
- x |= ord(int_bytes[3]) << 24
+ x = int_bytes[0]
+ x |= int_bytes[1] << 8
+ x |= int_bytes[2] << 16
+ x |= int_bytes[3] << 24
return x
More information about the Python-checkins
mailing list