summaryrefslogtreecommitdiffstats
path: root/Lib/test/pickletester.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2008-05-11 08:25:28 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2008-05-11 08:25:28 (GMT)
commit9510e4a9f8503421c9f589e99e697aa5f3b89b69 (patch)
tree59e7f4f21d2c0902316f91b00d98e0e8d4b6c4aa /Lib/test/pickletester.py
parentf602c71b077de965693c62d65d0e261bd964fbda (diff)
downloadcpython-9510e4a9f8503421c9f589e99e697aa5f3b89b69.zip
cpython-9510e4a9f8503421c9f589e99e697aa5f3b89b69.tar.gz
cpython-9510e4a9f8503421c9f589e99e697aa5f3b89b69.tar.bz2
Added module stub for copy_reg renaming in 3.0.
Renamed copy_reg to copyreg in the standard library, to avoid spurious warnings and ease later merging to py3k branch. Public documentation remains intact.
Diffstat (limited to 'Lib/test/pickletester.py')
-rw-r--r--Lib/test/pickletester.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index e1bc078..ed3b626 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -2,7 +2,7 @@ import unittest
import pickle
import cPickle
import pickletools
-import copy_reg
+import copyreg
from test.test_support import TestFailed, have_unicode, TESTFN, \
run_with_locale
@@ -44,21 +44,21 @@ class ExtensionSaver:
# there is one).
def __init__(self, code):
self.code = code
- if code in copy_reg._inverted_registry:
- self.pair = copy_reg._inverted_registry[code]
- copy_reg.remove_extension(self.pair[0], self.pair[1], code)
+ if code in copyreg._inverted_registry:
+ self.pair = copyreg._inverted_registry[code]
+ copyreg.remove_extension(self.pair[0], self.pair[1], code)
else:
self.pair = None
# Restore previous registration for code.
def restore(self):
code = self.code
- curpair = copy_reg._inverted_registry.get(code)
+ curpair = copyreg._inverted_registry.get(code)
if curpair is not None:
- copy_reg.remove_extension(curpair[0], curpair[1], code)
+ copyreg.remove_extension(curpair[0], curpair[1], code)
pair = self.pair
if pair is not None:
- copy_reg.add_extension(pair[0], pair[1], code)
+ copyreg.add_extension(pair[0], pair[1], code)
class C:
def __cmp__(self, other):
@@ -690,14 +690,14 @@ class AbstractPickleTests(unittest.TestCase):
self.assertEqual(B(x), B(y), detail)
self.assertEqual(x.__dict__, y.__dict__, detail)
- # Register a type with copy_reg, with extension code extcode. Pickle
+ # Register a type with copyreg, with extension code extcode. Pickle
# an object of that type. Check that the resulting pickle uses opcode
# (EXT[124]) under proto 2, and not in proto 1.
def produce_global_ext(self, extcode, opcode):
e = ExtensionSaver(extcode)
try:
- copy_reg.add_extension(__name__, "MyList", extcode)
+ copyreg.add_extension(__name__, "MyList", extcode)
x = MyList([1, 2, 3])
x.foo = 42
x.bar = "hello"