You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[3.5] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW #77397
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='https://github.com/larryhastings'closed_at=<Date2018-09-17.12:41:55.798>created_at=<Date2018-04-03.19:38:13.494>labels= ['docs']
title='[3.5] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW'updated_at=<Date2018-09-17.13:09:45.656>user='https://github.com/mvaled'
Calls a function. *argc* is interpreted as in CALL_FUNCTION. The
top elements on the stack are the keyword arguments, followed by the
variable argument list, and then the positional arguments.
However, inspecting the how f(b=1, *args) is actually compiled shows a different order:
changed the title [-]CALL_FUNCTION_VAR[/-][+]Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW[/+]on Apr 3, 2018
mvaled commented on Apr 3, 2018
mvaledmannequin
MannequinAuthor
More actions
Correction, the documentation for CALL_FUNCTION_VAR said:
Calls a function. *argc* is interpreted as in :opcode:`CALL_FUNCTION`. The top element on the stack contains the variable argument list, followed by keyword and positional arguments.
In a previous comment I pasted the version I'm putting in the PR.
I confirm that this issue is 3.5-only. Before 3.5 the order matched the documentation. After 3.5 these opcodes were completely rewritten and they use now other way of passing arguments.
changed the title [-]Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW[/-][+][3.5] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW[/+]on May 23, 2018
Because I don't want that this fix be missed in the next bugfix release. I think this documentation is important enough. There may be no chance to document it later.
"As a guideline, critical and above are usually reserved for crashes, serious regressions or breakage of very important APIs. Whether a bug is a release blocker for the current release schedule is decided by the release manager. Triagers may recommend this priority and should add the release manager to the nosy list. If needed, consult the release schedule and the release’s associated PEP for the release manager’s name."
Please do not mark any bugs as "Release Blocker" in the future unless you are the release manager for that version.
Sorry. I have attracted your attention, and this was the only purpose of this mark. You are aware of this issue now, and the further fate of it is up to you.
FYI, I opened bpo-34413 to address how the bytecode change is not mentioned in the porting section of the 3.5 "What's New" doc. In retrospect (I didn't notice that this issue was still open), I suppose that doesn't need a separate issue so feel free to close bpo-34413 in favor of this one. :)
Activity
mvaled commentedon Apr 3, 2018
The documentation of the dis module says that:
CALL_FUNCTION_VAR (argc)
Calls a function. *argc* is interpreted as in CALL_FUNCTION. The
top elements on the stack are the keyword arguments, followed by the
variable argument list, and then the positional arguments.
However, inspecting the how
f(b=1, *args)is actually compiled shows a different order:>>> import dis
>>> dis.dis(compile('f(b=1, *args)', '<>', 'eval'))
1 0 LOAD_NAME 0 (f)
3 LOAD_NAME 1 (args)
6 LOAD_CONST 0 ('b')
9 LOAD_CONST 1 (1)
12 CALL_FUNCTION_VAR 256 (0 positional, 1 keyword pair)
15 RETURN_VALUE
Notice that the top of the stack contains the explicit keyword arguments.
The documentation of CALL_FUNCTION_VAR_KW is also incorrect.
[-]CALL_FUNCTION_VAR[/-][+]Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW[/+]mvaled commentedon Apr 3, 2018
Correction, the documentation for CALL_FUNCTION_VAR said:
Calls a function. *argc* is interpreted as in :opcode:`CALL_FUNCTION`. The top element on the stack contains the variable argument list, followed by keyword and positional arguments.
In a previous comment I pasted the version I'm putting in the PR.
serhiy-storchaka commentedon Apr 4, 2018
I confirm that this issue is 3.5-only. Before 3.5 the order matched the documentation. After 3.5 these opcodes were completely rewritten and they use now other way of passing arguments.
[-]Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW[/-][+][3.5] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW[/+]larryhastings commentedon May 23, 2018
Serhiy, why did you mark this as a release blocker? This is a proposed documentation fix.
vstinner commentedon May 23, 2018
If the issue is specific to Python 3.5, we can no longer fix it since 3.5 doesn't accept bugfixes anymore. No?
larryhastings commentedon May 23, 2018
Documentation changes are okay.
serhiy-storchaka commentedon May 24, 2018
Because I don't want that this fix be missed in the next bugfix release. I think this documentation is important enough. There may be no chance to document it later.
larryhastings commentedon May 24, 2018
Marking an issue as "Release Blocker" is completely inappropriate for "I'd like to see this documentation change get into the next bugfix release."
Our Python Dev Guide discusses priority, here:
https://devguide.python.org/triaging/#priority
It says:
"As a guideline, critical and above are usually reserved for crashes, serious regressions or breakage of very important APIs. Whether a bug is a release blocker for the current release schedule is decided by the release manager. Triagers may recommend this priority and should add the release manager to the nosy list. If needed, consult the release schedule and the release’s associated PEP for the release manager’s name."
Please do not mark any bugs as "Release Blocker" in the future unless you are the release manager for that version.
serhiy-storchaka commentedon May 24, 2018
Sorry. I have attracted your attention, and this was the only purpose of this mark. You are aware of this issue now, and the further fate of it is up to you.
larryhastings commentedon Jul 19, 2018
New changeset 76aa2c0 by larryhastings in branch '3.5':
bpo-33216: Clarify the documentation for CALL_FUNCTION_* (bpo-8338)
76aa2c0
ericsnowcurrently commentedon Aug 16, 2018
FTR, the change was introduced by the PEP-448 implementation. [1]
[1] #8338 (comment)
ericsnowcurrently commentedon Aug 16, 2018
FYI, I opened bpo-34413 to address how the bytecode change is not mentioned in the porting section of the 3.5 "What's New" doc. In retrospect (I didn't notice that this issue was still open), I suppose that doesn't need a separate issue so feel free to close bpo-34413 in favor of this one. :)
serhiy-storchaka commentedon Sep 17, 2018
New changeset 5e99b56 by Serhiy Storchaka in branch 'master':
bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784)
5e99b56
serhiy-storchaka commentedon Sep 17, 2018
New changeset afa591d by Serhiy Storchaka in branch '2.7':
[2.7] bpo-33216: Clarify the documentation for CALL_FUNCTION_* (GH-8338) (GH-8783)
afa591d
serhiy-storchaka commentedon Sep 17, 2018
Thank you Larry for your rewriting.
miss-islington commentedon Sep 17, 2018
New changeset f8e34ee by Miss Islington (bot) in branch '3.7':
bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784)
f8e34ee
miss-islington commentedon Sep 17, 2018
New changeset 1e7193b by Miss Islington (bot) in branch '3.6':
bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784)
1e7193b