Author: Armin Rigo <[email protected]>
Branch:
Changeset: r82789:478732783f5a
Date: 2016-03-05 17:06 +0100
http://bitbucket.org/pypy/pypy/changeset/478732783f5a/
Log: Fix defaultdict.__module__
diff --git a/pypy/module/_collections/app_defaultdict.py
b/pypy/module/_collections/app_defaultdict.py
--- a/pypy/module/_collections/app_defaultdict.py
+++ b/pypy/module/_collections/app_defaultdict.py
@@ -12,6 +12,7 @@
class defaultdict(dict):
__slots__ = ['default_factory']
+ __module__ = 'collections'
def __init__(self, *args, **kwds):
if len(args) > 0:
diff --git a/pypy/module/_collections/test/test_defaultdict.py
b/pypy/module/_collections/test/test_defaultdict.py
--- a/pypy/module/_collections/test/test_defaultdict.py
+++ b/pypy/module/_collections/test/test_defaultdict.py
@@ -14,6 +14,12 @@
d[5].append(44)
assert l == [42, 43] and l2 == [44]
+ def test_module(self):
+ from _collections import defaultdict
+ assert repr(defaultdict) in (
+ "<class 'collections.defaultdict'>", # on PyPy
+ "<type 'collections.defaultdict'>") # on CPython
+
def test_keyerror_without_factory(self):
from _collections import defaultdict
for d1 in [defaultdict(), defaultdict(None)]:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit