New submission from kai zhu <kaizhu...@gmail.com>:

# copy this to test.py
# > touch foo.txt
# > python3.1 -c "import test; import collections"
# > ...
# >   File "test.py", line 5, in find_module
# >     def find_module(self, mname, path = None): open("foo.txt")
# >   File "test.py", line 5, in find_module
# >     def find_module(self, mname, path = None): open("foo.txt")
# >   File "test.py", line 5, in find_module
# >     def find_module(self, mname, path = None): open("foo.txt")
# >   File "test.py", line 5, in find_module
# >     def find_module(self, mname, path = None): open("foo.txt")
# > RuntimeError: maximum recursion depth exceeded while calling a
# > Python object
class importer(object):
  def find_module(self, mname, path = None): open("foo.txt")
import sys; sys.meta_path.append(importer)

***

# note recursion behavior stops if we don't call open()
class importer(object):
  def find_module(self, mname, path = None): pass
import sys; sys.meta_path.append(importer)

----------
components: IO, Interpreter Core
messages: 90627
nosy: kaizhu
severity: normal
status: open
title: infinite recursion from calling builtins.open()
type: behavior
versions: Python 3.1

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6504>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to