-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Labels
Comments
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.
This was referenced May 21, 2024
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 <[email protected]>
ambv
pushed a commit
that referenced
this issue
May 22, 2024
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
JelleZijlstra
added a commit
to JelleZijlstra/cpython
that referenced
this issue
May 31, 2024
JelleZijlstra
added a commit
that referenced
this issue
May 31, 2024
JelleZijlstra
added a commit
that referenced
this issue
Jun 11, 2024
JelleZijlstra
added a commit
to JelleZijlstra/cpython
that referenced
this issue
Jun 19, 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 <[email protected]>
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
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
blhsing
pushed a commit
to blhsing/cpython
that referenced
this issue
Aug 22, 2024
JelleZijlstra
added a commit
that referenced
this issue
Sep 11, 2024
Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Carol Willing <[email protected]>
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 <[email protected]>
JelleZijlstra
added a commit
to JelleZijlstra/cpython
that referenced
this issue
Sep 23, 2024
JelleZijlstra
added a commit
that referenced
this issue
Sep 24, 2024
) Co-authored-by: Alex Waygood <[email protected]>
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
From discussion with @larryhastings and @carljm, this is the desired behavior.
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 <[email protected]>
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
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
that referenced
this issue
Sep 26, 2024
JelleZijlstra
added a commit
that referenced
this issue
Sep 27, 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
PEP-649 has been accepted and should be implemented in Python 3.14. Let's use this issue to track the implementation:
__annotate__
attributes gh-119180: PEP 649: Add __annotate__ attributes #119209format
argument toinspect.get_annotations
gh-119180: Addannotationlib
module to support PEP 649 #119891inspect.AnnotationsFormat
should be a "global enum". Is that desirable? TBD. https://github.com/python/cpython/pull/119361/files#r1614753031)from __future__ import annotations
; an introduction to annotationlib; an update to Larry's annotations HOWTOannotationlib
module to support PEP 649 #119891inspect
. (If it can't be removed, get rid of the awkward dance we do fortyping.Protocol
to importinspect.getattr_static
lazily.)annotationlib
module to support PEP 649 #119891annotationlib
module to support PEP 649 #119891 (comment)annotationlib
module to support PEP 649 #119891, PEP 649:functools.update_wrapper
implementation #124342pep649-typevar
branch in my fork)__dict__
__dict__
access (Support Python 3.13 quora/pyanalyze#773)__annotate__
#124157Things to revisit:
__annotate__
parameter__annotations__
invalidate__annotate__
?I am planning to work on the interpreter core first.
cc @larryhastings @carljm @samuelcolvin
Linked PRs
annotationlib
module to support PEP 649 #119891__annotations__
in__main__
#124634The text was updated successfully, but these errors were encountered: