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: Use sizeof(_Py_CODEUNIT) instead of literal 2 for the size of the code unit
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.11, Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Mark.Shannon, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2021-10-03 17:00 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 28711 merged serhiy.storchaka, 2021-10-03 17:02
PR 28718 merged serhiy.storchaka, 2021-10-04 08:14
PR 28720 merged serhiy.storchaka, 2021-10-04 09:48
PR 28721 merged serhiy.storchaka, 2021-10-04 11:59
Messages (5)
msg403101 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-10-03 17:00
Some C code in 3.10+ uses literal 2 for the size of the code unit. It should use sizeof(_Py_CODEUNIT) instead.

1. It is self-documented and allows to distinguish this 2 from other 2 constants.
2. It will help if we change from 16-bit code units to 24-, 32- or 64-bit code units.
msg403106 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-10-03 18:22
New changeset 60b9e040c9cf40e69f42c0008e564458aa0379e8 by Serhiy Storchaka in branch 'main':
bpo-45355: Use sizeof(_Py_CODEUNIT) instead of literal 2 for the size of the code unit (GH-28711)
https://github.com/python/cpython/commit/60b9e040c9cf40e69f42c0008e564458aa0379e8
msg403131 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-10-04 11:11
New changeset 252b7bcb236dc261f3af1275bc90f9a303d9648f by Serhiy Storchaka in branch 'main':
bpo-45355: More use of sizeof(_Py_CODEUNIT) (GH-28720)
https://github.com/python/cpython/commit/252b7bcb236dc261f3af1275bc90f9a303d9648f
msg403132 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-10-04 12:01
New changeset b5499784ec0aa24c8f0d91f2317cc53b7743ada9 by Serhiy Storchaka in branch '3.10':
[3.10] bpo-45355: Use sizeof(_Py_CODEUNIT) instead of literal 2 for the size of the code unit (GH-28711). (GH-28718)
https://github.com/python/cpython/commit/b5499784ec0aa24c8f0d91f2317cc53b7743ada9
msg403138 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-10-04 14:07
New changeset 1670d590fa6b817e0d3f091ea12aee9ae744875a by Serhiy Storchaka in branch '3.10':
[3.10] bpo-45355: More use of sizeof(_Py_CODEUNIT) (GH-28720). (GH-28721)
https://github.com/python/cpython/commit/1670d590fa6b817e0d3f091ea12aee9ae744875a
History
Date User Action Args
2022-04-11 14:59:50adminsetgithub: 89518
2021-10-29 08:49:12serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-10-04 14:07:29serhiy.storchakasetmessages: + msg403138
2021-10-04 12:01:15serhiy.storchakasetmessages: + msg403132
2021-10-04 11:59:44serhiy.storchakasetpull_requests: + pull_request27068
2021-10-04 11:11:30serhiy.storchakasetmessages: + msg403131
2021-10-04 09:48:31serhiy.storchakasetpull_requests: + pull_request27067
2021-10-04 08:14:39serhiy.storchakasetpull_requests: + pull_request27066
2021-10-03 18:22:53serhiy.storchakasetmessages: + msg403106
2021-10-03 17:02:44serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request27061
2021-10-03 17:00:44serhiy.storchakacreate