summaryrefslogtreecommitdiff
path: root/Lib/pickletools.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-08-18 22:13:04 +0000
committerGuido van Rossum <guido@python.org>2006-08-18 22:13:04 +0000
commite2b70bcf7401477936fba99a8bf4a1f759ecc8a3 (patch)
tree4c9b65b7fd8c26a3d2f1b64ecd6b4c72a756b4b2 /Lib/pickletools.py
parentd2dbecb4ae9177e2e87adcb047147c6bcbf28cc1 (diff)
downloadcpython-git-e2b70bcf7401477936fba99a8bf4a1f759ecc8a3.tar.gz
Get rid of dict.has_key(). Boy this has a lot of repercussions!
Not all code has been fixed yet; this is just a checkpoint... The C API still has PyDict_HasKey() and _HasKeyString(); not sure if I want to change those just yet.
Diffstat (limited to 'Lib/pickletools.py')
-rw-r--r--Lib/pickletools.py33
1 files changed, 12 insertions, 21 deletions
diff --git a/Lib/pickletools.py b/Lib/pickletools.py
index ab5e247579..941ca4273f 100644
--- a/Lib/pickletools.py
+++ b/Lib/pickletools.py
@@ -517,23 +517,14 @@ def read_decimalnl_long(f):
r"""
>>> import StringIO
- >>> read_decimalnl_long(StringIO.StringIO("1234\n56"))
- Traceback (most recent call last):
- ...
- ValueError: trailing 'L' required in '1234'
-
- Someday the trailing 'L' will probably go away from this output.
-
>>> read_decimalnl_long(StringIO.StringIO("1234L\n56"))
- 1234L
+ 1234
>>> read_decimalnl_long(StringIO.StringIO("123456789012345678901234L\n6"))
- 123456789012345678901234L
+ 123456789012345678901234
"""
s = read_stringnl(f, decode=False, stripquotes=False)
- if not s.endswith("L"):
- raise ValueError("trailing 'L' required in %r" % s)
return long(s)
@@ -625,15 +616,15 @@ def read_long1(f):
r"""
>>> import StringIO
>>> read_long1(StringIO.StringIO("\x00"))
- 0L
+ 0
>>> read_long1(StringIO.StringIO("\x02\xff\x00"))
- 255L
+ 255
>>> read_long1(StringIO.StringIO("\x02\xff\x7f"))
- 32767L
+ 32767
>>> read_long1(StringIO.StringIO("\x02\x00\xff"))
- -256L
+ -256
>>> read_long1(StringIO.StringIO("\x02\x00\x80"))
- -32768L
+ -32768
"""
n = read_uint1(f)
@@ -657,15 +648,15 @@ def read_long4(f):
r"""
>>> import StringIO
>>> read_long4(StringIO.StringIO("\x02\x00\x00\x00\xff\x00"))
- 255L
+ 255
>>> read_long4(StringIO.StringIO("\x02\x00\x00\x00\xff\x7f"))
- 32767L
+ 32767
>>> read_long4(StringIO.StringIO("\x02\x00\x00\x00\x00\xff"))
- -256L
+ -256
>>> read_long4(StringIO.StringIO("\x02\x00\x00\x00\x00\x80"))
- -32768L
+ -32768
>>> read_long1(StringIO.StringIO("\x00\x00\x00\x00"))
- 0L
+ 0
"""
n = read_int4(f)