Skip to content

[3.5] Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW #77397

Closed

Description

@mvaled
mannequin
BPO 33216
Nosy @vstinner, @larryhastings, @ericsnowcurrently, @serhiy-storchaka, @miss-islington, @mvaled
PRs
  • [3.5] bpo-33216: Correct the doc of CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW. #6365
  • bpo-33216: Clarify the documentation for CALL_FUNCTION_* #8338
  • [2.7] bpo-33216: Clarify the documentation for CALL_FUNCTION_* (GH-8338) #8783
  • bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) #8784
  • [3.7] bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784) #9354
  • [3.6] bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784) #9355
  • 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 = <Date 2018-09-17.12:41:55.798>
    created_at = <Date 2018-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 = <Date 2018-09-17.13:09:45.656>
    user = 'https://github.com/mvaled'

    bugs.python.org fields:

    activity = <Date 2018-09-17.13:09:45.656>
    actor = 'miss-islington'
    assignee = 'larry'
    closed = True
    closed_date = <Date 2018-09-17.12:41:55.798>
    closer = 'serhiy.storchaka'
    components = ['Documentation']
    creation = <Date 2018-04-03.19:38:13.494>
    creator = 'mvaled'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33216
    keywords = ['patch']
    message_count = 17.0
    messages = ['314888', '314891', '314922', '317473', '317475', '317476', '317523', '317531', '317535', '321971', '323606', '323607', '325530', '325531', '325537', '325540', '325541']
    nosy_count = 7.0
    nosy_names = ['vstinner', 'larry', 'docs@python', 'eric.snow', 'serhiy.storchaka', 'miss-islington', 'mvaled']
    pr_nums = ['6365', '8338', '8783', '8784', '9354', '9355']
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue33216'
    versions = ['Python 3.5']

    Activity

    1. mvaled commented on Apr 3, 2018

      mvaledmannequin
      MannequinAuthor

      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.

    2. added
      docs
      on Apr 3, 2018
    3. changed the title [-]CALL_FUNCTION_VAR[/-] [+]Wrong order of stack for CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW[/+] on Apr 3, 2018
    4. mvaled commented on Apr 3, 2018

      mvaledmannequin
      MannequinAuthor

      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.

    5. serhiy-storchaka commented on Apr 4, 2018

      @serhiy-storchaka
      Member

      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.

    6. 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
    7. larryhastings commented on May 23, 2018

      @larryhastings
      Contributor

      Serhiy, why did you mark this as a release blocker? This is a proposed documentation fix.

    8. vstinner commented on May 23, 2018

      @vstinner
      Member

      If the issue is specific to Python 3.5, we can no longer fix it since 3.5 doesn't accept bugfixes anymore. No?

    9. larryhastings commented on May 23, 2018

      @larryhastings
      Contributor

      Documentation changes are okay.

    10. serhiy-storchaka commented on May 24, 2018

      @serhiy-storchaka
      Member

      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.

    11. larryhastings commented on May 24, 2018

      @larryhastings
      Contributor

      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.

    12. serhiy-storchaka commented on May 24, 2018

      @serhiy-storchaka
      Member

      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.

    13. larryhastings commented on Jul 19, 2018

      @larryhastings
      Contributor

      New changeset 76aa2c0 by larryhastings in branch '3.5':
      bpo-33216: Clarify the documentation for CALL_FUNCTION_* (bpo-8338)
      76aa2c0

    14. ericsnowcurrently commented on Aug 16, 2018

      @ericsnowcurrently
      Member

      FTR, the change was introduced by the PEP-448 implementation. [1]

      [1] #8338 (comment)

    15. ericsnowcurrently commented on Aug 16, 2018

      @ericsnowcurrently
      Member

      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. :)

    16. serhiy-storchaka commented on Sep 17, 2018

      @serhiy-storchaka
      Member

      New changeset 5e99b56 by Serhiy Storchaka in branch 'master':
      bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784)
      5e99b56

    17. serhiy-storchaka commented on Sep 17, 2018

      @serhiy-storchaka
      Member

      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

    18. serhiy-storchaka commented on Sep 17, 2018

      @serhiy-storchaka
      Member

      Thank you Larry for your rewriting.

    19. miss-islington commented on Sep 17, 2018

      @miss-islington
      Contributor

      New changeset f8e34ee by Miss Islington (bot) in branch '3.7':
      bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784)
      f8e34ee

    20. miss-islington commented on Sep 17, 2018

      @miss-islington
      Contributor

      New changeset 1e7193b by Miss Islington (bot) in branch '3.6':
      bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784)
      1e7193b

    21. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    docs

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions