diff options
author | Collin Winter <collinw@gmail.com> | 2007-03-12 16:49:23 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-03-12 16:49:23 (GMT) |
commit | e19d7a3c0ac25680d2f72669f1441dadbb2f9a41 (patch) | |
tree | 85bd8be0b7673cd915fad4c782a5d3305062b77c /Lib | |
parent | 1817f096f4153293abe7ffb6eda47be3f809fa77 (diff) | |
download | cpython-e19d7a3c0ac25680d2f72669f1441dadbb2f9a41.zip cpython-e19d7a3c0ac25680d2f72669f1441dadbb2f9a41.tar.gz cpython-e19d7a3c0ac25680d2f72669f1441dadbb2f9a41.tar.bz2 |
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Backported from r54291.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/infinite_reload.py | 7 | ||||
-rw-r--r-- | Lib/test/test_import.py | 12 |
2 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/infinite_reload.py b/Lib/test/infinite_reload.py new file mode 100644 index 0000000..bfbec91 --- /dev/null +++ b/Lib/test/infinite_reload.py @@ -0,0 +1,7 @@ +# For testing http://python.org/sf/742342, which reports that Python +# segfaults (infinite recursion in C) in the presence of infinite +# reload()ing. This module is imported by test_import.py:test_infinite_reload +# to make sure this doesn't happen any more. + +import infinite_reload +reload(infinite_reload) diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index effba3c..ed97f84 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -222,3 +222,15 @@ def test_import_initless_directory_warning(): warnings.filters = oldfilters test_import_initless_directory_warning() + +def test_infinite_reload(): + # Bug #742342 reports that Python segfaults (infinite recursion in C) + # when faced with self-recursive reload()ing. + + sys.path.insert(0, os.path.dirname(__file__)) + try: + import infinite_reload + finally: + sys.path.pop(0) + +test_infinite_reload() |