Antoine Pitrou added the comment: The problem is not in the import, but when displaying the traceback of the exception. In other words, if you catch the exception, no attempt to open "<stdin>" happens:
$ strace -e open ./python [...] Python 3.5.0a0 (default:3417a95df7e2, Apr 16 2014, 17:57:12) [GCC 4.8.1] on linux [...] >>> >>> try: import dismal ... except ImportError: pass ... >>> ---------- nosy: +pitrou priority: normal -> low stage: test needed -> title: Missing module code does spurious file search -> Traceback display code can attempt to open a file named "<stdin>" versions: +Python 3.5 -Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1514420> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com