Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when looking up invalid attribute from type object
Summary: We can crash when we're looking up an invalid attribute from a type object. In the case that was reported this was from looking up an invalid object from a function object. What happens is we have a site where we're presumably getting some valid lookup and putting in a cache for a load method (`foo.getdoc()`). Then we come along and pass in a function object as `foo`. Because the object is a `type` we go into `_PyShadow_LoadMethodFromType`. The first time we go through and raise the proper attribute error when we create a new cache entry because we do `if (((_PyShadow_InstanceAttrEntry *)entry)->value == NULL `. But when we do it again at another call site we pick up the pre-existing cache entry which is still valid and happily try to dispatch to it via `_PyShadow_LoadMethodType`. This assumes we have a `value` and tries to incref it and we crash. Reviewed By: oclbdk Differential Revision: D50386200 fbshipit-source-id: 0b8f3716dcf27d722140fd56b766f2d5790986e1
- Loading branch information