Skip to content

3.11 regression: default arguments in PyEval_EvalCodeEx #101072

Closed
@MatthieuDartiailh

Description

@MatthieuDartiailh

Bug report

3.11 Started using _PyFunction_FromConstructor inside PyEval_EvalCodeEx. #92173 reported that this caused issues when closures were involved because _PyFunction_FromConstructor discarded the closure found in PyFrameConstructor. This was fixed in #92175.

It turns out the same holds true for default arguments and default kw arguments as can be seen at https://github.com/python/cpython/blob/main/Objects/funcobject.c#L90-L91 and is a regression compared to 3.10.

The fix appears fairly simple but I would love to have some guidance as to where to add a test for it.

Your environment

  • CPython versions tested on: 3.11.0
  • Operating system and architecture: Windows x86-64

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)release-blockertype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions