classification
Title: [3.5] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW
Type: Stage: resolved
Components: Documentation Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: larry Nosy List: docs@python, eric.snow, larry, miss-islington, mvaled, serhiy.storchaka, vstinner
Priority: low Keywords: patch

Created on 2018-04-03 19:38 by mvaled, last changed 2018-09-17 13:09 by miss-islington. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6365 closed mvaled, 2018-04-03 19:49
PR 8338 merged larry, 2018-07-19 07:08
PR 8783 merged serhiy.storchaka, 2018-08-16 09:23
PR 8784 merged serhiy.storchaka, 2018-08-16 10:25
PR 9354 merged miss-islington, 2018-09-17 12:15
PR 9355 merged miss-islington, 2018-09-17 12:15
Messages (17)
msg314888 - (view) Author: Manuel Vazquez Acosta (mvaled) * Date: 2018-04-03 19:42
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.
msg314891 - (view) Author: Manuel Vazquez Acosta (mvaled) * Date: 2018-04-03 20:18
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.
msg314922 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-04 05:15
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.
msg317473 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2018-05-23 23:29
Serhiy, why did you mark this as a release blocker?  This is a proposed documentation fix.
msg317475 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-23 23:32
If the issue is specific to Python 3.5, we can no longer fix it since 3.5 doesn't accept bugfixes anymore. No?
msg317476 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2018-05-23 23:32
Documentation changes are okay.
msg317523 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-24 04:38
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.
msg317531 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2018-05-24 06:00
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.
msg317535 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-24 06:13
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.
msg321971 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2018-07-19 23:35
New changeset 76aa2c0a9a8dd3ac90b91e7342c8ce8125bf21f9 by larryhastings in branch '3.5':
bpo-33216: Clarify the documentation for CALL_FUNCTION_* (#8338)
https://github.com/python/cpython/commit/76aa2c0a9a8dd3ac90b91e7342c8ce8125bf21f9
msg323606 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2018-08-16 15:48
FTR, the change was introduced by the PEP 448 implementation. [1]

[1] https://github.com/python/cpython/pull/8338#issuecomment-406256152
msg323607 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2018-08-16 15:51
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 #34413 in favor of this one. :)
msg325530 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-09-17 12:15
New changeset 5e99b56d6b249995a4fa2bc09c0bb03841f49572 by Serhiy Storchaka in branch 'master':
bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784)
https://github.com/python/cpython/commit/5e99b56d6b249995a4fa2bc09c0bb03841f49572
msg325531 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-09-17 12:15
New changeset afa591d7748c66831e6e650108024f3293be33f1 by Serhiy Storchaka in branch '2.7':
[2.7] bpo-33216: Clarify the documentation for CALL_FUNCTION_* (GH-8338) (GH-8783)
https://github.com/python/cpython/commit/afa591d7748c66831e6e650108024f3293be33f1
msg325537 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-09-17 12:41
Thank you Larry for your rewriting.
msg325540 - (view) Author: miss-islington (miss-islington) Date: 2018-09-17 13:09
New changeset f8e34eee74871b3343f6c3545bce41242ba378e8 by Miss Islington (bot) in branch '3.7':
bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784)
https://github.com/python/cpython/commit/f8e34eee74871b3343f6c3545bce41242ba378e8
msg325541 - (view) Author: miss-islington (miss-islington) Date: 2018-09-17 13:09
New changeset 1e7193bd027a5a4aa1a387e3f201a3e465c25f01 by Miss Islington (bot) in branch '3.6':
bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784)
https://github.com/python/cpython/commit/1e7193bd027a5a4aa1a387e3f201a3e465c25f01
History
Date User Action Args
2018-09-17 13:09:45miss-islingtonsetmessages: + msg325541
2018-09-17 13:09:37miss-islingtonsetnosy: + miss-islington
messages: + msg325540
2018-09-17 12:41:55serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg325537

stage: patch review -> resolved
2018-09-17 12:15:51serhiy.storchakasetmessages: + msg325531
2018-09-17 12:15:31miss-islingtonsetpull_requests: + pull_request8778
2018-09-17 12:15:20miss-islingtonsetpull_requests: + pull_request8777
2018-09-17 12:15:07serhiy.storchakasetmessages: + msg325530
2018-08-16 15:51:00eric.snowsetmessages: + msg323607
2018-08-16 15:48:42eric.snowsetnosy: + eric.snow
messages: + msg323606
2018-08-16 10:25:31serhiy.storchakasetpull_requests: + pull_request8257
2018-08-16 09:23:27serhiy.storchakasetpull_requests: + pull_request8256
2018-07-19 23:35:31larrysetmessages: + msg321971
2018-07-19 07:08:46larrysetpull_requests: + pull_request7872
2018-05-24 06:13:35serhiy.storchakasetmessages: + msg317535
2018-05-24 06:00:22larrysetmessages: + msg317531
2018-05-24 04:38:16serhiy.storchakasetmessages: + msg317523
2018-05-23 23:32:56larrysetmessages: + msg317476
2018-05-23 23:32:11vstinnersetnosy: + vstinner
messages: + msg317475
2018-05-23 23:29:52larrysetpriority: release blocker -> low

messages: + msg317473
2018-05-23 23:26:46vstinnersettitle: 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
2018-05-07 13:29:16serhiy.storchakasetpriority: normal -> release blocker
2018-04-04 05:15:59serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg314922
2018-04-04 05:09:21ned.deilysetassignee: docs@python -> larry

nosy: - ned.deily
2018-04-03 21:06:24serhiy.storchakasetnosy: + larry, ned.deily
2018-04-03 20:18:34mvaledsetmessages: + msg314891
2018-04-03 19:49:47mvaledsetkeywords: + patch
stage: patch review
pull_requests: + pull_request6075
2018-04-03 19:42:23mvaledsetassignee: docs@python

components: + Documentation
versions: + Python 3.5
nosy: + docs@python
title: CALL_FUNCTION_VAR -> Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW
messages: + msg314888
2018-04-03 19:38:13mvaledcreate