Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy the CALL_FUNCTION opcode's flags to CALL_METHOD.
I can't find any documentation on what these flags should be, but CALL_FUNCTION and CALL_METHOD are similar enough that it seems reasonable they'd have the same flags. This fixes the following 3.7 bug: we have a class whose initializer sets an attribute to None, but before the attribute is used, another method is called to set it to its true non-None value. If pytype hits maximum call depth and skips this method, it thinks that the attribute's value is still None. The vm's _has_strict_none_origins check filters out the None value, avoiding spurious errors. In 3.7, _has_strict_none_origins fails to filter out the None because methods are called via CALL_METHOD rather than CALL_FUNCTION, and CALL_METHOD's different flags cause its carry_on_to_next() method to evaluate to False, leading to pytype failing to add an extra node to the CFG after the method is called, which messes up _has_strict_none_origins' reachability query. PiperOrigin-RevId: 326713243
- Loading branch information