Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PEP 649 and PEP 749 #119180

Open
14 of 29 tasks
JelleZijlstra opened this issue May 19, 2024 · 2 comments
Open
14 of 29 tasks

Implement PEP 649 and PEP 749 #119180

JelleZijlstra opened this issue May 19, 2024 · 2 comments
Assignees
Labels
3.14 new features, bugs and security fixes topic-typing

Comments

@JelleZijlstra
Copy link
Member

JelleZijlstra commented May 19, 2024

PEP-649 has been accepted and should be implemented in Python 3.14. Let's use this issue to track the implementation:

Things to revisit:

I am planning to work on the interpreter core first.

cc @larryhastings @carljm @samuelcolvin

Linked PRs

@JelleZijlstra JelleZijlstra added topic-typing 3.14 new features, bugs and security fixes labels May 19, 2024
@JelleZijlstra JelleZijlstra self-assigned this May 19, 2024
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue May 21, 2024
The PEP 649 implementation will require a way to load NotImplementedError
from the bytecode. @markshannon suggested implementing this by converting
LOAD_ASSERTION_ERROR into a more general mechanism for loading constants.

This PR adds this new opcode. I will work on the rest of the implementation
of the PEP separately.
JelleZijlstra added a commit that referenced this issue May 22, 2024
The PEP 649 implementation will require a way to load NotImplementedError
from the bytecode. @markshannon suggested implementing this by converting
LOAD_ASSERTION_ERROR into a more general mechanism for loading constants.

This PR adds this new opcode. I will work on the rest of the implementation
of the PEP separately.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue May 22, 2024
but did not actually apply the new magic number.
JelleZijlstra added a commit that referenced this issue May 25, 2024
PR #119321 added a comment about the magic number bump
but did not actually apply the new magic number.
@JelleZijlstra JelleZijlstra changed the title Implement PEP 649 Implement PEP 649 and PEP 749 Jun 11, 2024
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Jun 21, 2024
mrahtz pushed a commit to mrahtz/cpython that referenced this issue Jun 30, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
The PEP 649 implementation will require a way to load NotImplementedError
from the bytecode. @markshannon suggested implementing this by converting
LOAD_ASSERTION_ERROR into a more general mechanism for loading constants.

This PR adds this new opcode. I will work on the rest of the implementation
of the PEP separately.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
PR python#119321 added a comment about the magic number bump
but did not actually apply the new magic number.
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
JelleZijlstra added a commit that referenced this issue Sep 11, 2024
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Sep 23, 2024
…onlib module scope

We were sometimes passing None as the globals argument to eval(), which makes it
inherit the globals from the calling scope. Instead, ensure that globals is always
non-None. The test was passing accidentally because I passed "annotationlib" as a
module object; fix that. Also document the parameters to ForwardRef() and remove
two unused private ones.
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Sep 23, 2024
…s and eval()

Often, ForwardRefs represent a single simple name. In that case, we
can avoid going through the overhead of creating AST nodes and code
objects and calling eval(): we can simply look up the name directly
in the relevant namespaces.
JelleZijlstra added a commit that referenced this issue Sep 23, 2024
…4326)

We were sometimes passing None as the globals argument to eval(), which makes it
inherit the globals from the calling scope. Instead, ensure that globals is always
non-None. The test was passing accidentally because I passed "annotationlib" as a
module object; fix that. Also document the parameters to ForwardRef() and remove
two unused private ones.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
JelleZijlstra added a commit that referenced this issue Sep 24, 2024
)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Sep 24, 2024
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Sep 24, 2024
Larry Hastings pointed out that using an illegal parameter name makes
it impossible to use inspect.signature() on annotate functions.

Cross-ref python/peps#3993.
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Sep 25, 2024
JelleZijlstra added a commit that referenced this issue Sep 25, 2024
…tionlib (#124337)

Often, ForwardRefs represent a single simple name. In that case, we
can avoid going through the overhead of creating AST nodes and code
objects and calling eval(): we can simply look up the name directly
in the relevant namespaces.

Co-authored-by: Victor Stinner <vstinner@python.org>
JelleZijlstra added a commit that referenced this issue Sep 25, 2024
)

From discussion with Larry Hastings and Carl Meyer, this is the desired
behavior.
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Sep 25, 2024
emilyemorehouse added a commit to lysnikolaou/cpython that referenced this issue Sep 26, 2024
* main: (69 commits)
  Add "annotate" SET_FUNCTION_ATTRIBUTE bit to dis. (python#124566)
  pythongh-124412: Add helpers for converting annotations to source format (python#124551)
  pythongh-119180: Disallow instantiation of ConstEvaluator objects (python#124561)
  For-else deserves its own section in the tutorial (python#123946)
  Add 3.13 as a version option to the crash issue template (python#124560)
  pythongh-123242: Note that type.__annotations__ may not exist (python#124557)
  pythongh-119180: Make FORWARDREF format look at __annotations__ first (python#124479)
  pythonGH-58058: Add quick reference for `ArgumentParser` to argparse docs (pythongh-124227)
  pythongh-41431: Add `datetime.time.strptime()` and `datetime.date.strptime()` (python#120752)
  pythongh-102450: Add ISO-8601 alternative for midnight to `fromisoformat()` calls. (python#105856)
  pythongh-124370: Add "howto" for free-threaded Python (python#124371)
  pythongh-121277: Allow `.. versionadded:: next` in docs (pythonGH-121278)
  pythongh-119400:  make_ssl_certs: update reference test data automatically, pass in expiration dates as parameters python#119400  (pythonGH-119401)
  pythongh-119180: Avoid going through AST and eval() when possible in annotationlib (python#124337)
  pythongh-124448: Update Windows builds to use Tcl/Tk 8.6.15 (pythonGH-124449)
  pythongh-123884 Tee of tee was not producing n independent iterators (pythongh-124490)
  pythongh-124378: Update test_ttk for Tcl/Tk 8.6.15 (pythonGH-124542)
  pythongh-124513: Check args in framelocalsproxy_new() (python#124515)
  pythongh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (python#124480)
  Doc: Use ``major.minor`` for documentation distribution archive filenames (python#124489)
  ...
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Sep 26, 2024
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Sep 26, 2024
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Sep 28, 2024
This is what Larry wants, and so it shall be. It's a bit of a hack,
but it's localized and not too bad.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 new features, bugs and security fixes topic-typing
Projects
None yet
Development

No branches or pull requests

2 participants