Commit a9b60d94 authored by Guido van Rossum's avatar Guido van Rossum

No double underscores for globals please

parent 754afd94
...@@ -23,7 +23,7 @@ except ImportError: ...@@ -23,7 +23,7 @@ except ImportError:
# this test is done to see if machine representation is the same as # this test is done to see if machine representation is the same as
# network representation. if so, we can use module struct for packing # network representation. if so, we can use module struct for packing
# some data types # some data types
__USE_MACHINE_REP = (struct.pack('l', 1) == '\0\0\0\1') _USE_MACHINE_REP = (struct.pack('l', 1) == '\0\0\0\1')
# exceptions # exceptions
class Error: class Error:
...@@ -67,7 +67,7 @@ class Packer: ...@@ -67,7 +67,7 @@ class Packer:
self.__buf = self.__buf + \ self.__buf = self.__buf + \
(chr(int(x>>24 & 0xff)) + chr(int(x>>16 & 0xff)) + \ (chr(int(x>>24 & 0xff)) + chr(int(x>>16 & 0xff)) + \
chr(int(x>>8 & 0xff)) + chr(int(x & 0xff))) chr(int(x>>8 & 0xff)) + chr(int(x & 0xff)))
if __USE_MACHINE_REP: if _USE_MACHINE_REP:
def pack_uint(self, x): def pack_uint(self, x):
if type(x) == LongType: if type(x) == LongType:
x = int((x + 0x80000000L) % 0x100000000L - 0x80000000L) x = int((x + 0x80000000L) % 0x100000000L - 0x80000000L)
...@@ -171,7 +171,7 @@ class Unpacker: ...@@ -171,7 +171,7 @@ class Unpacker:
if x < 0x80000000L: if x < 0x80000000L:
x = int(x) x = int(x)
return x return x
if __USE_MACHINE_REP: if _USE_MACHINE_REP:
def unpack_uint(self): def unpack_uint(self):
i = self.__pos i = self.__pos
self.__pos = j = i+4 self.__pos = j = i+4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment