GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Implement PEP 765 · Issue #130080 · python/cpython

Implement PEP 765 #130080

New issue
Copy link
New issue
Copy link
Closed
Closed
Implement PEP 765#130080
Copy link
Assignees
iritkatriel
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement

Description

@iritkatriel
iritkatriel
opened on Feb 13, 2025
Issue body actions

This issue serves as a tracker for implementing PEP-765.

Linked PRs

  • gh-130080: return in finally in subprocess.py #130081
  • gh-130080: implement PEP 765 #130087
  • gh-130080: move _Py_EnsureArrayLargeEnough to a separate header so it can be used outside of the compiler #130930
  • gh-130080: fix warnings in tests #131400
  • gh-130080: fix warnings in tests #131471
  • gh-130080: do not fold match case constants in unoptimized AST #131577
  • gh-130080: Remove unnecessary memset for _PyASTOptimizeState initializing  #131745
Reacted by  
Reacted by Alex Waygood, Bartosz Sławecki, Bénédikt Tran, Kirill Podoprigora and Hugo van Kemenade

Activity

Next
  1. iritkatriel
    self-assigned this
    on Feb 13, 2025
  2. iritkatriel
    added 3 commits that reference this issue on Feb 13, 2025

    pythongh-130080: return in finally in subprocess.py

    1ed43b2

    pythongh-130080: implement PEP 765

    41e517f

    pythongh-130080: implement PEP 765

    e4151e6
  3. encukou
    added
    type-featureA feature request or enhancementA feature request or enhancement
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Feb 13, 2025
  4. iritkatriel
    added 2 commits that reference this issue on Feb 16, 2025

    gh-130080: return in finally in subprocess.py (#130081)

    56495f8

    pythongh-130080: implement PEP 765

    714c3f9
  5. iritkatriel
    added 2 commits that reference this issue on Mar 6, 2025

    pythongh-130080: move _Py_EnsureArrayLargeEnough to a separate header…

    dc8f650

    gh-130080: move _Py_EnsureArrayLargeEnough to a separate header so it…

    4242c2b
  6. plashchynski
    added a commit that references this issue on Mar 17, 2025

    pythongh-130080: move _Py_EnsureArrayLargeEnough to a separate header…

    23cd8ae
  7. iritkatriel
    added a commit that references this issue on Mar 17, 2025

    gh-130080: implement PEP 765 (#130087)

    ffc2f1d
  8. iritkatriel
    closed this as completedon Mar 17, 2025
  9. hugovk commented on Mar 17, 2025

    @hugovk
    hugovk
    on Mar 17, 2025
    Member
    More actions

    🚀

    Final task, mark the the PEP as Final:

    Once a PEP has been accepted, the reference implementation must be completed. When the reference implementation is complete and incorporated into the main source code repository, the status will be changed to “Final”.

    https://peps.python.org/pep-0001/#pep-review-resolution

  10. picnixz commented on Mar 18, 2025

    @picnixz
    picnixz
    on Mar 18, 2025
    Member
    More actions

    There are a bunch of warnings when executing the test suite now:

    • in Lib/test/test_grammar.py (e.g., test_break_in_finally)
    • in Lib/test/test_functools.py (e.g., test_double_wrapped_methods)
    • in Lib/multiprocessing/connection.py (but this one has already been reported in return-in-finally in multiprocessing/connection.py #131233)

    I'm re-opening the issue so that we fix the issues in the tests but you can open a separate issue if you want.

    Reacted by Irit Katriel
  11. 4 remaining items

  12. iritkatriel
    added 3 commits that reference this issue on Mar 19, 2025

    pythongh-130080: fix warnings in tests

    9eb13e0

    pythongh-130080: fix warnings in tests

    4866209

    gh-130080: fix warnings in tests (#131471)

    749e24b
  13. colesbury
    added 2 commits that reference this issue on Mar 20, 2025

    pythongh-130080: implement PEP 765 (python#130087)

    eb47811

    pythongh-130080: fix warnings in tests (python#131400)

    a1e94cc
  14. cdce8p commented on Mar 22, 2025

    @cdce8p
    cdce8p
    on Mar 22, 2025
    Contributor
    More actions

    #130087 seems to have introduce a regression were AST folding is now applied even if it shouldn't be. E.g.

    # test.py
    match a:
      case -1+2j:
        pass

    With Python 3.13 (or 3.14a6)

    $ python3.13 -m ast test.py
            ...
                match_case(
                   pattern=MatchValue(
                      value=BinOp(
                         left=UnaryOp(
                            op=USub(),
                            operand=Constant(value=1)),
                         op=Add(),
                         right=Constant(value=2j))),
                   body=[...
    

    After #130087

    $ python -m ast test.py
            ...
                match_case(
                   pattern=MatchValue(
                      value=Constant(value=(-1+2j))),
                   body=[...
    
    Reacted by Irit Katriel
  15. iritkatriel
    added 2 commits that reference this issue on Mar 22, 2025

    pythongh-130080: do not fold match case constants in unoptimized AST

    8c4e2b9

    gh-130080: do not fold match case constants in unoptimized AST (#131577)

    64906bb
  16. iritkatriel commented on Mar 23, 2025

    @iritkatriel
    iritkatriel
    on Mar 23, 2025
    MemberAuthor
    More actions

    #130087 seems to have introduce a regression were AST folding is now applied even if it shouldn't be. E.g.

    Thanks, this is now fixed.

    Reacted by Marc Mueller
  17. WolframAlph commented on Mar 25, 2025

    @WolframAlph
    WolframAlph
    on Mar 25, 2025
    Contributor
    More actions

    @iritkatriel I believe this memset is unnecessary:

    cpython/Python/ast_opt.c

    Line 943 in 90b82f2

    memset(&state, 0, sizeof(_PyASTOptimizeState));

    Here is PR: #131745

  18. iritkatriel commented on Mar 25, 2025

    @iritkatriel
    iritkatriel
    on Mar 25, 2025
    MemberAuthor
    More actions

    We do this in other places - set everything to 0 and then override other fields. If someone adds a new field which should be initialised to 0 they will probably not bother to update initialisation.

  19. WolframAlph commented on Mar 28, 2025

    @WolframAlph
    WolframAlph
    on Mar 28, 2025
    Contributor
    More actions

    I see. Closing it then.

  20. defkev commented on Oct 10, 2025

    @defkev
    defkev
    on Oct 10, 2025
    More actions

    I just upgraded to 3.14 (from 3.13) and now I can no longer return a custom value from a function when returning early without copy and pasting my return value everywhere?

    def test(fail = False):
        try:
            if fail:
                raise Exception('fail')
            else:
                print('try')
                return # Will never reach Done
        except Exception as e:
            print(e)
        finally:
            print('Finally')
            return (0, 1, 2) # Syntaxerror in 3.14
        print('Done')
        return (0, 1, 2) # Unreachable when returning early

    Who tf comes up with this nonsense?!?

  21. Gentlesprite
    added a commit that references this issue on Feb 26, 2026

    v1.8.9 遵循PEP 765规范重构代码。(python/cpython#130080)

    6c2ff43
  22. Asheblog
    added a commit that references this issue on Jul 19, 2026

    v1.8.9 遵循PEP 765规范重构代码。(python/cpython#130080)

    dbe82db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @iritkatriel
    iritkatriel

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.