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”.
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.
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?
deftest(fail=False):
try:
iffail:
raiseException('fail')
else:
print('try')
return# Will never reach DoneexceptExceptionase:
print(e)
finally:
print('Finally')
return (0, 1, 2) # Syntaxerror in 3.14print('Done')
return (0, 1, 2) # Unreachable when returning early
Activity
pythongh-130080: return in finally in subprocess.py
pythongh-130080: implement PEP 765
pythongh-130080: implement PEP 765
gh-130080: return in finally in subprocess.py (#130081)
pythongh-130080: implement PEP 765
pythongh-130080: move _Py_EnsureArrayLargeEnough to a separate header…
gh-130080: move _Py_EnsureArrayLargeEnough to a separate header so it…
pythongh-130080: move _Py_EnsureArrayLargeEnough to a separate header…
gh-130080: implement PEP 765 (#130087)
hugovk commented on Mar 17, 2025
🚀
Final task, mark the the PEP as Final:
https://peps.python.org/pep-0001/#pep-review-resolution
picnixz commented on Mar 18, 2025
There are a bunch of warnings when executing the test suite now:
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.
4 remaining items
pythongh-130080: fix warnings in tests
pythongh-130080: fix warnings in tests
gh-130080: fix warnings in tests (#131471)
pythongh-130080: implement PEP 765 (python#130087)
pythongh-130080: fix warnings in tests (python#131400)
cdce8p commented on Mar 22, 2025
#130087 seems to have introduce a regression were AST folding is now applied even if it shouldn't be. E.g.
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=[...pythongh-130080: do not fold match case constants in unoptimized AST
gh-130080: do not fold match case constants in unoptimized AST (#131577)
iritkatriel commented on Mar 23, 2025
Thanks, this is now fixed.
WolframAlph commented on Mar 25, 2025
@iritkatriel I believe this memset is unnecessary:
cpython/Python/ast_opt.c
Line 943 in 90b82f2
Here is PR: #131745
iritkatriel commented on Mar 25, 2025
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.
WolframAlph commented on Mar 28, 2025
I see. Closing it then.
defkev commented on Oct 10, 2025
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?
Who tf comes up with this nonsense?!?
v1.8.9 遵循PEP 765规范重构代码。(python/cpython#130080)
v1.8.9 遵循PEP 765规范重构代码。(python/cpython#130080)