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
标题: Document types.CodeType.replace() changes about co_exceptiontable
类型: Stage:
Components: Documentation Versions: Python 3.11
process
状态: open Resolution:
Dependencies: 后续:
分配给: docs@python 抄送列表: docs@python, gvanrossum, vstinner
优先级: normal 关键字:

vstinner2022-04-05 23:22 创建。最近一次由 admin2022-04-11 14:59 修改。

Messages (1)
msg416831 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2022-04-05 23:22
It would be nice to document the bpo-40222 changes in What's New in Python 3.11 and in the CodeType documentation:

* https://docs.python.org/dev/library/types.html#types.CodeType
* https://docs.python.org/dev/whatsnew/3.11.html

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.
历史
日期 用户 动作 参数
2022-04-11 14:59:58admin修改github: 91392
2022-04-05 23:23:47gvanrossum修改抄送: + gvanrossum
2022-04-05 23:22:06vstinner创建