[pypy-issue] Issue #2252: collections.defaultdict has the wrong modulel (pypy/pypy)

David MacIver issues-reply at bitbucket.org
Sat Mar 5 07:15:33 EST 2016

New issue 2252: collections.defaultdict has the wrong modulel

David MacIver:

The following passes on CPython 2.7.10 and fails on pypy-4.0.1

from collections import defaultdict

assert defaultdict.__module__ == 'collections', defaultdict.__module__

This happens because defaultdict reports its module as '_collections' rather than 'collections'

I discovered this because it breaks IPython's pretty printing for defaultdicts because of the way it handles lookup.

Note: Counter correctly reports it smodule as 'collections' rather than '_collections'

More information about the pypy-issue mailing list