-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(profiling): Use
type()
instead when extracting frames (#3716)
When extract frame names, we should avoid accessing the `__class__` attribute as it can be overwritten in the class implementation. In this particular instance, the `SimpleLazyObject` class in django wraps `__class__` so when it is accessed, it can cause the underlying lazy object to be evaluation unexpectedly. To avoid this, use the `type()` builtin function which does cannot be overwritten and will return the correct class. Note that this does not work with old style classes but since dropping python 2 support, we only need to consider new style classes.
- Loading branch information
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters