#32894: isinstance() checks with non-configured LazySettings raise an exception.
-------------------------------------+-------------------------------------
Reporter: simon klemenc | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Utilities | Version: 3.2
Severity: Normal | Resolution: needsinfo
Keywords: lazyobject | Triage Stage:
lazysettings | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Keryn Knight):
* cc: Keryn Knight (added)
Comment:
Adding a note to say that whilst I understand why it's closed, I think I
have just been bitten by this in a similarly niche scenario: trying to use
[https://pympler.readthedocs.io/en/latest/muppy.html#the-tracker-module
pympler's tracking module] threw an error when I tried to run it over the
test suite:
{{{
File "/path/to/django/tests/runtests.py", line 679, in <module>
mem.print_diff()
File "/path/to/python3.10/site-packages/pympler/tracker.py", line 138,
in print_diff
summary.print_(self.diff(summary1=summary1, summary2=summary2))
File "/path/to/python3.10/site-packages/pympler/tracker.py", line 116,
in diff
self.s1 = self.create_summary()
File "/path/to/python3.10/site-packages/pympler/tracker.py", line 91, in
create_summary
res = summary.summarize(muppy.get_objects())
File "/path/to/python3.10/site-packages/pympler/muppy.py", line 42, in
get_objects
tmp = [o for o in tmp if not ignore_object(o)]
File "/path/to/python3.10/site-packages/pympler/muppy.py", line 42, in
<listcomp>
tmp = [o for o in tmp if not ignore_object(o)]
File "/path/to/python3.10/site-packages/pympler/muppy.py", line 17, in
ignore_object
return isframe(obj)
File "/path/to/python3.10/inspect.py", line 377, in isframe
return isinstance(object, types.FrameType)
File "/path/to/django/utils/functional.py", line 256, in inner
self._setup()
File "/path/to/django/contrib/staticfiles/storage.py", line 469, in
_setup
self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
}}}
I don't have a proposed solution as such, but it looks like it's
attempting to access `__class__` when it fails, which would appear (back
of the napkin) to be happening **before** any custom
`__instancecheck__(...)` call could be implemented, based on a quick bit
of `pdb` usage :/
--
Ticket URL: <https://code.djangoproject.com/ticket/32894#comment:5>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.d4c49de92eb5ecb8d8809efb3f39f1e0%40djangoproject.com.