Message90627
# 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) |
|
Date |
User |
Action |
Args |
2009-07-17 15:36:09 | kaizhu | set | recipients:
+ kaizhu |
2009-07-17 15:36:09 | kaizhu | set | messageid: <1247844969.58.0.287534577391.issue6504@psf.upfronthosting.co.za> |
2009-07-17 15:36:08 | kaizhu | link | issue6504 messages |
2009-07-17 15:36:07 | kaizhu | create | |
|