#31706: Removed unnecessary getattr() call in FileDescriptor.__get__(). -------------------------------------+------------------------------------- Reporter: Sultan | Owner: nobody Type: | Status: new Cleanup/optimization | Component: Database | Version: master layer (models, ORM) | Severity: Normal | Keywords: Triage Stage: | Has patch: 1 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 1 UI/UX: 0 | -------------------------------------+------------------------------------- To retrieve a deferred model attributes, the `__get__` method is called twice. This is because it uses the `getattr()` function, which in turn causes the `__get__` method to be called again.
To prevent this unnecessary call, we can simply delete it (since at that moment the instance dict already contains the reloaded value). This reduces the number of method calls. -- Ticket URL: <https://code.djangoproject.com/ticket/31706> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/052.9d544d7e3868a71247256dc38f58a233%40djangoproject.com.