diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-03-18 11:22:43 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-03-18 11:22:43 +0100 |
| commit | 9dc5702932a0031bc4fb5473f2cdccffc61dbe30 (patch) | |
| tree | 0cb3db3b4b69805039a6113bb119c29f2593114a /tests/utils_tests | |
| parent | 0efafa4c54ab8ad684df66c8e34928bb2ba88656 (diff) | |
Fixed #19456 -- Avoid infinite recursion when tracing LazyObject.__init__.
Thanks blaze33 for the patch.
Diffstat (limited to 'tests/utils_tests')
| -rw-r--r-- | tests/utils_tests/simplelazyobject.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/utils_tests/simplelazyobject.py b/tests/utils_tests/simplelazyobject.py index 3bd6bf1e7f..883e60aa81 100644 --- a/tests/utils_tests/simplelazyobject.py +++ b/tests/utils_tests/simplelazyobject.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals import copy import pickle +import sys from django.utils import six from django.utils.unittest import TestCase @@ -138,3 +139,16 @@ class TestUtilsSimpleLazyObject(TestCase): del lazydict['one'] with self.assertRaises(KeyError): lazydict['one'] + + def test_trace(self): + # See ticket #19456 + old_trace_func = sys.gettrace() + try: + def trace_func(frame, event, arg): + frame.f_locals['self'].__class__ + if old_trace_func is not None: + old_trace_func(frame, event, arg) + sys.settrace(trace_func) + SimpleLazyObject(None) + finally: + sys.settrace(old_trace_func) |
