[pypy-commit] pypy default: Better handling of deepcopying of an rerased object.
alex_gaynor
noreply at buildbot.pypy.org
Sun Jun 24 15:56:00 CEST 2012
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r55800:fa3ef0801dbe
Date: 2012-06-24 06:55 -0700
http://bitbucket.org/pypy/pypy/changeset/fa3ef0801dbe/
Log: Better handling of deepcopying of an rerased object.
diff --git a/pypy/rlib/rerased.py b/pypy/rlib/rerased.py
--- a/pypy/rlib/rerased.py
+++ b/pypy/rlib/rerased.py
@@ -48,6 +48,9 @@
def __repr__(self):
return 'ErasingPairIdentity(%r)' % self.name
+ def __deepcopy__(self, memo):
+ return self
+
def _getdict(self, bk):
try:
dict = bk._erasing_pairs_tunnel
diff --git a/pypy/rlib/test/test_rerased.py b/pypy/rlib/test/test_rerased.py
--- a/pypy/rlib/test/test_rerased.py
+++ b/pypy/rlib/test/test_rerased.py
@@ -1,5 +1,7 @@
import py
import sys
+import copy
+
from pypy.rlib.rerased import *
from pypy.annotation import model as annmodel
from pypy.annotation.annrpython import RPythonAnnotator
@@ -59,6 +61,13 @@
#assert is_integer(e) is False
assert unerase_list_X(e) is l
+def test_deepcopy():
+ x = "hello"
+ e = eraseX(x)
+ e2 = copy.deepcopy(e)
+ assert uneraseX(e) is x
+ assert uneraseX(e2) is x
+
def test_annotate_1():
def f():
return eraseX(X())
More information about the pypy-commit
mailing list