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: The tests for the `dis` module can be too rigid when changing opcodes
Type: enhancement Stage: resolved
Components: Library (Lib), Tests Versions: Python 3.8
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: Maxime Belanger, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2018-10-26 23:35 by Maxime Belanger, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10142 closed maxbelanger, 2018-10-26 23:38
Messages (3)
msg328615 - (view) Author: Maxime Belanger (Maxime Belanger) Date: 2018-10-26 23:35
For various reasons, one may want to change the `Lib/opcode.py` module. In doing so, this has caused us to frequently rewrite `test_dis.py`. It would be great if those tests used `dis.opmap` rather than hard-coded/magic numbers, as this would allow easier changes.
msg328638 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-10-27 05:12
Actually this change decreases flexibility of tests. Expected output is generated. See the comment above it. When you change the bytecode, you need just uncomment these lines, run tests, copy the output, and comment out them back. The output contains numerical values of opcodes.

It is rarely they are changed without changing the meaning of opcodes. It is more common to add new opcodes and replace old opcodes with other opcodes with different semantic. This leads to changing opcode arguments and offsets, adding and removing lines.
msg328641 - (view) Author: Maxime Belanger (Maxime Belanger) Date: 2018-10-27 05:27
Ah, quite right; apologies for the not-so-useful PR!
History
Date User Action Args
2022-04-11 14:59:07adminsetgithub: 79261
2018-10-27 05:27:14Maxime Belangersetstatus: open -> closed
resolution: wont fix
messages: + msg328641

stage: patch review -> resolved
2018-10-27 05:12:23serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg328638
2018-10-26 23:41:49Maxime Belangersetcomponents: + Library (Lib), Tests
2018-10-26 23:38:51maxbelangersetkeywords: + patch
stage: patch review
pull_requests: + pull_request9469
2018-10-26 23:35:56Maxime Belangercreate