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

Document types.CodeType.replace() changes about co_exceptiontable #91392

Closed
vstinner opened this issue Apr 5, 2022 · 1 comment
Closed

Document types.CodeType.replace() changes about co_exceptiontable #91392

vstinner opened this issue Apr 5, 2022 · 1 comment
Labels
3.11 only security fixes docs Documentation in the Doc dir

Comments

@vstinner
Copy link
Member

vstinner commented Apr 5, 2022

BPO 47236
Nosy @gvanrossum, @vstinner

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2022-04-05.23:22:06.882>
labels = ['3.11', 'docs']
title = 'Document types.CodeType.replace() changes about co_exceptiontable'
updated_at = <Date 2022-04-05.23:23:47.642>
user = 'https://github.com/vstinner'

bugs.python.org fields:

activity = <Date 2022-04-05.23:23:47.642>
actor = 'gvanrossum'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2022-04-05.23:22:06.882>
creator = 'vstinner'
dependencies = []
files = []
hgrepos = []
issue_num = 47236
keywords = []
message_count = 1.0
messages = ['416831']
nosy_count = 3.0
nosy_names = ['gvanrossum', 'vstinner', 'docs@python']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue47236'
versions = ['Python 3.11']

@vstinner
Copy link
Member Author

vstinner commented Apr 5, 2022

It would be nice to document the bpo-40222 changes in What's New in Python 3.11 and in the CodeType documentation:

Users of types.CodeType.replace(co_code=new_code) must now pass co_exceptiontable or exception handling will no longer work as expected. Callers are responsible to build co_exceptiontable.

Currently, the format of this table is documented at:
https://github.com/python/cpython/blob/main/Objects/exception_handling_notes.txt

There is no public function to encode this table, it's also the responsibility of the caller.

See also bpo-47185 "code.replace(co_code=new_code) no longer catch exceptions on Python 3.11" closed as "won't fix" for the background.

@vstinner vstinner added the 3.11 only security fixes label Apr 5, 2022
@vstinner vstinner added docs Documentation in the Doc dir 3.11 only security fixes labels Apr 5, 2022
@vstinner vstinner added the docs Documentation in the Doc dir label Apr 5, 2022
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@vstinner vstinner closed this as completed Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

1 participant