#19456: SimpleLazyObject raises RuntimeError if __class__ accessed while
tracing
execution
----------------------------------+--------------------
Reporter: rouyrre+django@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------
I found the issue while trying to profile a django application with
pycallgraph. The issue is referenced there:
https://github.com/gak/pycallgraph/issues/92
The issue is reproduced with the following code:
{{{
import sys
from django.utils.functional import SimpleLazyObject
def tracer(frame, event, arg):
frame.f_locals['self'].__class__
sys.settrace(tracer)
SimpleLazyObject(lambda x: x)
sys.settrace(None)
}}}
I wrote a failing test in tests/regressiontests/utils/functional.py. The
issue is solved by defining _wrapped=None in the LazyObject class in
django/utils/functional.py and this does not seems to break anything, all
tests still pass.
Do you prefer one commit for test + fix as it's a small issue or separate
commits? Is the test written in the right place?
I can make a pull request once this ticket is created (as the commit
guidelines specify I need a ticket number in the first place to commit &
reference my code). Thanks for any comment about the issue or how to
proceed.
--
Ticket URL: <https://code.djangoproject.com/ticket/19456>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.