homepage

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: disassembly needs argument counts on calls with keyword args
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: belopolsky Nosy List: belopolsky, daniel.urban, python-dev, rhettinger
Priority: high Keywords: easy, patch

Created on 2011年04月10日 21:11 by rhettinger, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue11823.diff belopolsky, 2011年04月11日 16:08 review
Messages (5)
msg133481 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011年04月10日 21:11
The argument to CALL_FUNCTION is overloaded to show both the number of positional arguments and keyword arguments (shifted by 8-bits):
>>> dis("foo(10, opt=True)")
 1 0 LOAD_NAME 0 (foo) 
 3 LOAD_CONST 0 (10) 
 6 LOAD_CONST 1 ('opt') 
 9 LOAD_CONST 2 (True) 
 12 CALL_FUNCTION 257 
 15 RETURN_VALUE 
It is not obvious that the 257 argument causes three stack arguments to be popped.
The disassembly should add a parenthetical to explain the composition:
>>> dis("foo(10, opt=True)")
 1 0 LOAD_NAME 0 (foo) 
 3 LOAD_CONST 0 (10) 
 6 LOAD_CONST 1 ('opt') 
 9 LOAD_CONST 2 (True) 
 12 CALL_FUNCTION 257 (1 positional, 1 keyword pair)
 15 RETURN_VALUE
msg133534 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2011年04月11日 16:08
I am posting an unfinished patch (needs additional tests and possibly documentation) to get feedback on whether it would make sense to wait for issue11816 refactoring before implementing this. Note the code duplication between disassemble and _disassemble_bytes. I am also not happy about the need for another constant exported from opcode.
msg133638 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011年04月13日 02:07
Looks good. Please apply.
msg162485 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2012年06月07日 18:14
Bumping priority as a reminder to get this in.
msg162487 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年06月07日 18:29
New changeset 22dc0a433b0e by Alexander Belopolsky in branch 'default':
Issue #11823: disassembly now shows argument counts on calls with keyword args
http://hg.python.org/cpython/rev/22dc0a433b0e 
History
Date User Action Args
2022年04月11日 14:57:16adminsetgithub: 56032
2012年06月07日 18:36:25belopolskysetstatus: open -> closed
2012年06月07日 18:33:03belopolskysetstage: needs patch -> resolved
type: behavior -> enhancement
versions: - Python 3.1, Python 2.7, Python 3.2
2012年06月07日 18:29:30python-devsetnosy: + python-dev
messages: + msg162487
2012年06月07日 18:14:42belopolskysetpriority: normal -> high

messages: + msg162485
2011年04月13日 02:07:19rhettingersetversions: + Python 3.1, Python 2.7, Python 3.2
type: enhancement -> behavior
title: disassembly needs to argument counts on calls with keyword args -> disassembly needs argument counts on calls with keyword args
messages: + msg133638

assignee: belopolsky
resolution: accepted
2011年04月11日 16:08:51belopolskysetfiles: + issue11823.diff

nosy: + belopolsky
messages: + msg133534

keywords: + patch
2011年04月10日 21:35:43daniel.urbansetnosy: + daniel.urban
2011年04月10日 21:17:51pitrousetkeywords: + easy
stage: needs patch
2011年04月10日 21:11:39rhettingercreate

AltStyle によって変換されたページ (->オリジナル) /