Skip to content

'import cPickle as pickle' "already defined" error #2253

Closed

Description

@Daenyth

This python code generates an error. It's a common idiom and it would be good if mypy could check for it in some way.

try:
    import cPickle as pickle
except ImportError:
    import pickle
$ mypy --py2 --silent-imports bad.py
bad.py:4: error: Name 'pickle' already defined

Activity

  1. gvanrossum commented on Oct 14, 2016

    @gvanrossum
    Member

    Thanks -- this looks like a duplicate of #1153. Additional discussion can go there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions