This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Cleanup codeop._maybe_compile
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: terry.reedy
Priority: normal Keywords: patch

Created on 2021-02-11 21:06 by terry.reedy, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24508 merged terry.reedy, 2021-02-11 21:15
PR 24512 merged terry.reedy, 2021-02-12 01:52
Messages (4)
msg386836 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-02-11 21:06
Following-up on discussion in #43163 and PR-24483, this issue is limited to changes that are expected to not affect the return value.  Therefore, do not backport unless and until needed as part of a bugfix.

First is moving the code return to immediately after it is successfully created.  Everything done after is ignored and useless.  This move makes the function return sooner and renders initialization of 'code' unnecessary.
msg386844 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-02-12 00:31
New changeset 2068b261e95e9fe9c4041f0102c9e931692dd5aa by Terry Jan Reedy in branch 'master':
bpo-43202: Immediately return code object in codeop._maybe_compile (GH-24508)
https://github.com/python/cpython/commit/2068b261e95e9fe9c4041f0102c9e931692dd5aa
msg386914 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-02-13 06:49
New changeset b676f5f809007533db3e3fdd01243959dd233d57 by Terry Jan Reedy in branch 'master':
bpo-43202: More codeop._maybe_compile clean-ups (GH-24512)
https://github.com/python/cpython/commit/b676f5f809007533db3e3fdd01243959dd233d57
msg387374 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-02-20 00:37
Second patch: "Add comment, end others with period, remove unused variables, initialize others only when needed, and add explicit return."
History
Date User Action Args
2022-04-11 14:59:41adminsetgithub: 87368
2021-02-20 00:37:24terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg387374

stage: patch review -> resolved
2021-02-13 06:49:28terry.reedysetmessages: + msg386914
2021-02-12 01:52:51terry.reedysetpull_requests: + pull_request23298
2021-02-12 00:31:18terry.reedysetmessages: + msg386844
2021-02-11 21:15:05terry.reedysetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request23296
2021-02-11 21:06:56terry.reedycreate