Skip to content

Python: Fix ExceptStmt::getType#6283

Merged
RasmusWL merged 3 commits intogithub:mainfrom
tausbn:python-fix-exceptstmt-gettype
Sep 14, 2021
Merged

Python: Fix ExceptStmt::getType#6283
RasmusWL merged 3 commits intogithub:mainfrom
tausbn:python-fix-exceptstmt-gettype

Conversation

@tausbn
Copy link
Contributor

@tausbn tausbn commented Jul 14, 2021

We were not supporting except statements handling multiple exception
types (specified as a tuple) correctly, instead just returning the
tuple itself as the "type" (which makes little sense).

To fix this, we explicitly extract the elements of this node, in the
case where it is a tuple.

This is a change that can potentially affect many queries (as getType
is used in quite a few places), so some care should be taken to
ensure that this does not adversely affect performance.

Fixes #6227

This is a minor change, and so probably doesn't require a change note.

tausbn added 2 commits July 14, 2021 13:52
We were not supporting `except` statements handling multiple exception
types (specified as a tuple) correctly, instead just returning the
tuple itself as the "type" (which makes little sense).

To fix this, we explicitly extract the elements of this node, in the
case where it _is_ a tuple.

This is a change that can potentially affect many queries (as `getType`
is used in quite a few places), so some care should be taken to
ensure that this does not adversely affect performance.
@tausbn tausbn added the no-change-note-required This PR does not need a change note label Jul 14, 2021
@tausbn tausbn requested a review from a team as a code owner July 14, 2021 14:04
@tausbn
Copy link
Contributor Author

tausbn commented Jul 14, 2021

This should not be merged before it's been thoroughly vetted for performance. Ultimately, it may be desirable to only apply it on a much smaller scale.

Copy link
Member

@RasmusWL RasmusWL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 I won't approve to avoid us accidentally merging this though 😅

@tausbn tausbn requested a review from RasmusWL September 13, 2021 17:40
Copy link
Member

@RasmusWL RasmusWL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

(performance and new results both looks good to me 👍)

@RasmusWL RasmusWL merged commit 8b7fad8 into github:main Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LGTM.com - Python: Call to next() in a generator - false positive

2 participants