Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.11] gh-92228: disable the compiler's 'small exit block inlining' optimization for blocks that have a line number (GH-94592) #94643

Merged
merged 3 commits into from
Jul 7, 2022

Conversation

tiran
Copy link
Member

@tiran tiran commented Jul 7, 2022

Inlining of code that corresponds to source code lines, can make it hard to distinguish later between code which is only reachable from except handlers, and that which is reachable in normal control flow. This caused problems with the debugger's jump feature.

This PR turns off the inlining optimisation for code which has line numbers. We still inline things like the implicit "return None"..
(cherry picked from commit bde06e1)

Co-authored-by: Irit Katriel 1055913+iritkatriel@users.noreply.github.com

Automerge-Triggered-By: GH:tiran

iritkatriel and others added 2 commits July 7, 2022 08:48
…ing' optimization for blocks that have a line number (pythonGH-94592)

Inlining of code that corresponds to source code lines, can make it hard to distinguish later between code which is only reachable from except handlers, and that which is reachable in normal control flow. This caused problems with the debugger's jump feature.

This PR turns off the inlining optimisation for code which has line numbers. We still inline things like the implicit "return None"..
(cherry picked from commit bde06e1)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
@tiran
Copy link
Member Author

tiran commented Jul 7, 2022

@iritkatriel I had to change i_loc.lineno to i_lineno and modify dis_traceback. Please take a look.

@iritkatriel iritkatriel changed the title [3.11] gh-92228: disable the compiler's 'small exit block inlining' o… [3.11] gh-92228: disable the compiler's 'small exit block inlining' optimization for blocks that have a line number (GH-94592) Jul 7, 2022
@iritkatriel
Copy link
Member

iritkatriel commented Jul 7, 2022

@iritkatriel I had to change i_loc.lineno to i_lineno and modify dis_traceback. Please take a look.

Yes this looks correct.

Thank you for backporting the new with/async_with tests in test_dis.

EDIT: Actually these two new tests were not being called, and if there were they would need to be rewritten with 3.11 bytecode. I removed them (w.r.t. this PR they are not covering anything that the dis_traceback test case is not already covering).

Lib/test/test_dis.py Outdated Show resolved Hide resolved
Lib/test/test_dis.py Outdated Show resolved Hide resolved
@miss-islington miss-islington merged commit 74c953d into python:3.11 Jul 7, 2022
@tiran tiran deleted the backport-bde06e1-3.11 branch July 7, 2022 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants