Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-101688: Implement types.get_original_bases#101827

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
AlexWaygood merged 45 commits intopython:mainfromGobot1234:orig_class-and-bases
Apr 23, 2023

Conversation

Gobot1234
Copy link
Contributor

@Gobot1234Gobot1234 commentedFeb 11, 2023
edited by bedevere-bot
Loading

Implements the methods described.

A couple of questions:

  • Should there be checking of the return types of the functions since they could be anything?
  • Should we add__orig_class__ to the slots of all the types that currently don't have them to provide better introspection support (currentlyget_orig_class(list[int]()) is None)

@arhadthedevarhadthedev added stdlibPython modules in the Lib dir topic-typing labelsFeb 11, 2023
Copy link
Member

@sobolevnsobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

👍

@Gobot1234
Copy link
ContributorAuthor

Error looks unrelated?

@sobolevn
Copy link
Member

Yes, it is.

@Gobot1234Gobot1234 changed the titlegh-101688: Implement typing.get_orig_class and get_orig_basesgh-101688: Implement typing.get_orig_class and types.get_orig_basesFeb 25, 2023
Gobot1234and others added2 commitsApril 12, 2023 22:04
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@AlexWaygood
Copy link
Member

@gvanrossum, how's this look to you now? Any more suggestions re. the docs?

@gvanrossum
Copy link
Member

Who is musashay? Spammer? Bot?

@AlexWaygood
Copy link
Member

Who is musashay? Spammer? Bot?

No idea

Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Still not excited about the use of assert. Do we do this often in other examples?

@Gobot1234
Copy link
ContributorAuthor

Still not excited about the use of assert. Do we do this often in other examples?

It seems to show up in a couple of other placeshttps://github.com/search?q=repo%3Apython%2Fcpython+lang%3ARST+assert&type=code

@AlexWaygood
Copy link
Member

AlexWaygood commentedApr 22, 2023
edited
Loading

Still not excited about the use of assert. Do we do this often in other examples?

I feel like the closest stdlib analogues to this function aretyping.get_args andtyping.get_origin, and it's what we do there:

assert get_origin(Dict[str, int]) is dict
assert get_args(Dict[int, str]) == (int, str)
assert get_origin(Union[int, str]) is Union
assert get_args(Union[int, str]) == (int, str)

Gobot1234 reacted with thumbs up emoji

Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Okay, sold.

Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I meant to approve.

AlexWaygood reacted with heart emoji
@AlexWaygood
Copy link
Member

I'll merge once the CI finishes.

Gobot1234 reacted with heart emoji

@AlexWaygoodAlexWaygood merged commit730bbdd intopython:mainApr 23, 2023
@AlexWaygood
Copy link
Member

@Gobot1234, are you up for adding a stub to typeshed and backporting it to typing_extensions? I can probably take a look soon, if you haven't got the time.

@Gobot1234
Copy link
ContributorAuthor

I can probably do the typeshed stub tonight but I don't know when I'll get to the typing extensions backport

AlexWaygood reacted with thumbs up emoji

kraj pushed a commit to YoeDistro/poky that referenced this pull requestJun 1, 2023
Changelog:============-  Fix use of@deprecated on classes with __new__ but no __init__.-  Fix regression in version 4.6.1 where comparing a generic class against a   runtime-checkable protocol using isinstance() would cause AttributeError to   be raised if using Python 3.7.-  Change deprecated@runtime to formal API @runtime_checkable in the error message.-  Fix regression in 4.6.0 where attempting to define a Protocol that was generic   over a ParamSpec or a TypeVarTuple would cause TypeError to be raised.-  typing_extensions is now documented athttps://typing-extensions.readthedocs.io/en/latest/.-  Add typing_extensions.Buffer, a marker class for buffer types, as proposed   by PEP 688. Equivalent to collections.abc.Buffer in Python 3.12.-  Backport two CPython PRs fixing various issues with typing.Literal:python/cpython#23294 andpython/cpython#23383. Both CPython PRs were originally,   and both were backported to Python >=3.9.1, but no earlier.-  A side effect of one of the changes is that equality comparisons of Literal   objects will now raise a TypeError if one of the Literal objects being compared   has a mutable parameter. (Using mutable parameters with Literal is not   supported by PEP 586 or by any major static type checkers.)-  Literal is now reimplemented on all Python versions <= 3.10.0.-  Backport CPython PR 26067, ensuring that isinstance() calls on protocols raise   TypeError when the protocol is not decorated with @runtime_checkable.-  Backport several significant performance improvements to runtime-checkable protocols   that have been made in Python 3.12 (seepython/cpython#74690 for details).-  A side effect of one of the performance improvements is that the members of a   runtime-checkable protocol are now considered "frozen" at runtime as soon as the   class has been created. Monkey-patching attributes onto a runtime-checkable   protocol will still work, but will have no impact on isinstance() checks comparing   objects to the protocol. See "What's New in Python 3.12" for more details.-  isinstance() checks against runtime-checkable protocols now use inspect.getattr_static()   rather than hasattr() to lookup whether attributes exist (backportingpython/cpython#103034).-  Backport the ability to define __init__ methods on Protocol classes, a change   made in Python 3.11 (originally implemented inpython/cpython#31628-  Speedup isinstance(3, typing_extensions.SupportsIndex) by >10x on Python <3.12.-  Add typing_extensions versions of SupportsInt, SupportsFloat, SupportsComplex,   SupportsBytes, SupportsAbs and SupportsRound. These have the same semantics as   the versions from the typing module, but isinstance() checks against the   typing_extensions versions are >10x faster at runtime on Python <3.12.-  Add __orig_bases__ to non-generic TypedDicts, call-based TypedDicts, and call-based NamedTuples.-  Add typing_extensions.get_original_bases, a backport of types.get_original_bases,   introduced in Python 3.12 (CPython PRpython/cpython#101827, originally-  This function should always produce correct results when called on classes   constructed using features from typing_extensions.-  Constructing a call-based TypedDict using keyword arguments for the fields   now causes a DeprecationWarning to be emitted. This matches the behaviour   of typing.TypedDict on 3.11 and 3.12.-  Backport the implementation of NewType from 3.10 (where it is implemented as   a class rather than a function). This allows user-defined NewTypes to be pickled.-  Fix tests and import on Python 3.12, where typing.TypeVar can no longer be subclassed.-  Add typing_extensions.TypeAliasType, a backport of typing.TypeAliasType from PEP 695.-  Backport changes to the repr of typing.Unpack that were made in order   to implement PEP 692 (backport ofpython/cpython#104048).(From OE-Core rev: 2b1d07c7deb4f0247765bc737fb11a1747143edf)Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
rpurdie pushed a commit to yoctoproject/poky that referenced this pull requestJun 2, 2023
Changelog:============-  Fix use of@deprecated on classes with __new__ but no __init__.-  Fix regression in version 4.6.1 where comparing a generic class against a   runtime-checkable protocol using isinstance() would cause AttributeError to   be raised if using Python 3.7.-  Change deprecated@runtime to formal API @runtime_checkable in the error message.-  Fix regression in 4.6.0 where attempting to define a Protocol that was generic   over a ParamSpec or a TypeVarTuple would cause TypeError to be raised.-  typing_extensions is now documented athttps://typing-extensions.readthedocs.io/en/latest/.-  Add typing_extensions.Buffer, a marker class for buffer types, as proposed   by PEP 688. Equivalent to collections.abc.Buffer in Python 3.12.-  Backport two CPython PRs fixing various issues with typing.Literal:python/cpython#23294 andpython/cpython#23383. Both CPython PRs were originally,   and both were backported to Python >=3.9.1, but no earlier.-  A side effect of one of the changes is that equality comparisons of Literal   objects will now raise a TypeError if one of the Literal objects being compared   has a mutable parameter. (Using mutable parameters with Literal is not   supported by PEP 586 or by any major static type checkers.)-  Literal is now reimplemented on all Python versions <= 3.10.0.-  Backport CPython PR 26067, ensuring that isinstance() calls on protocols raise   TypeError when the protocol is not decorated with @runtime_checkable.-  Backport several significant performance improvements to runtime-checkable protocols   that have been made in Python 3.12 (seepython/cpython#74690 for details).-  A side effect of one of the performance improvements is that the members of a   runtime-checkable protocol are now considered "frozen" at runtime as soon as the   class has been created. Monkey-patching attributes onto a runtime-checkable   protocol will still work, but will have no impact on isinstance() checks comparing   objects to the protocol. See "What's New in Python 3.12" for more details.-  isinstance() checks against runtime-checkable protocols now use inspect.getattr_static()   rather than hasattr() to lookup whether attributes exist (backportingpython/cpython#103034).-  Backport the ability to define __init__ methods on Protocol classes, a change   made in Python 3.11 (originally implemented inpython/cpython#31628-  Speedup isinstance(3, typing_extensions.SupportsIndex) by >10x on Python <3.12.-  Add typing_extensions versions of SupportsInt, SupportsFloat, SupportsComplex,   SupportsBytes, SupportsAbs and SupportsRound. These have the same semantics as   the versions from the typing module, but isinstance() checks against the   typing_extensions versions are >10x faster at runtime on Python <3.12.-  Add __orig_bases__ to non-generic TypedDicts, call-based TypedDicts, and call-based NamedTuples.-  Add typing_extensions.get_original_bases, a backport of types.get_original_bases,   introduced in Python 3.12 (CPython PRpython/cpython#101827, originally-  This function should always produce correct results when called on classes   constructed using features from typing_extensions.-  Constructing a call-based TypedDict using keyword arguments for the fields   now causes a DeprecationWarning to be emitted. This matches the behaviour   of typing.TypedDict on 3.11 and 3.12.-  Backport the implementation of NewType from 3.10 (where it is implemented as   a class rather than a function). This allows user-defined NewTypes to be pickled.-  Fix tests and import on Python 3.12, where typing.TypeVar can no longer be subclassed.-  Add typing_extensions.TypeAliasType, a backport of typing.TypeAliasType from PEP 695.-  Backport changes to the repr of typing.Unpack that were made in order   to implement PEP 692 (backport ofpython/cpython#104048).(From OE-Core rev: a37154b9166323d05cca970ebb37bee0d5250893)Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull requestJun 2, 2023
Changelog:============-  Fix use of@deprecated on classes with __new__ but no __init__.-  Fix regression in version 4.6.1 where comparing a generic class against a   runtime-checkable protocol using isinstance() would cause AttributeError to   be raised if using Python 3.7.-  Change deprecated@runtime to formal API @runtime_checkable in the error message.-  Fix regression in 4.6.0 where attempting to define a Protocol that was generic   over a ParamSpec or a TypeVarTuple would cause TypeError to be raised.-  typing_extensions is now documented athttps://typing-extensions.readthedocs.io/en/latest/.-  Add typing_extensions.Buffer, a marker class for buffer types, as proposed   by PEP 688. Equivalent to collections.abc.Buffer in Python 3.12.-  Backport two CPython PRs fixing various issues with typing.Literal:python/cpython#23294 andpython/cpython#23383. Both CPython PRs were originally,   and both were backported to Python >=3.9.1, but no earlier.-  A side effect of one of the changes is that equality comparisons of Literal   objects will now raise a TypeError if one of the Literal objects being compared   has a mutable parameter. (Using mutable parameters with Literal is not   supported by PEP 586 or by any major static type checkers.)-  Literal is now reimplemented on all Python versions <= 3.10.0.-  Backport CPython PR 26067, ensuring that isinstance() calls on protocols raise   TypeError when the protocol is not decorated with @runtime_checkable.-  Backport several significant performance improvements to runtime-checkable protocols   that have been made in Python 3.12 (seepython/cpython#74690 for details).-  A side effect of one of the performance improvements is that the members of a   runtime-checkable protocol are now considered "frozen" at runtime as soon as the   class has been created. Monkey-patching attributes onto a runtime-checkable   protocol will still work, but will have no impact on isinstance() checks comparing   objects to the protocol. See "What's New in Python 3.12" for more details.-  isinstance() checks against runtime-checkable protocols now use inspect.getattr_static()   rather than hasattr() to lookup whether attributes exist (backportingpython/cpython#103034).-  Backport the ability to define __init__ methods on Protocol classes, a change   made in Python 3.11 (originally implemented inpython/cpython#31628-  Speedup isinstance(3, typing_extensions.SupportsIndex) by >10x on Python <3.12.-  Add typing_extensions versions of SupportsInt, SupportsFloat, SupportsComplex,   SupportsBytes, SupportsAbs and SupportsRound. These have the same semantics as   the versions from the typing module, but isinstance() checks against the   typing_extensions versions are >10x faster at runtime on Python <3.12.-  Add __orig_bases__ to non-generic TypedDicts, call-based TypedDicts, and call-based NamedTuples.-  Add typing_extensions.get_original_bases, a backport of types.get_original_bases,   introduced in Python 3.12 (CPython PRpython/cpython#101827, originally-  This function should always produce correct results when called on classes   constructed using features from typing_extensions.-  Constructing a call-based TypedDict using keyword arguments for the fields   now causes a DeprecationWarning to be emitted. This matches the behaviour   of typing.TypedDict on 3.11 and 3.12.-  Backport the implementation of NewType from 3.10 (where it is implemented as   a class rather than a function). This allows user-defined NewTypes to be pickled.-  Fix tests and import on Python 3.12, where typing.TypeVar can no longer be subclassed.-  Add typing_extensions.TypeAliasType, a backport of typing.TypeAliasType from PEP 695.-  Backport changes to the repr of typing.Unpack that were made in order   to implement PEP 692 (backport ofpython/cpython#104048).Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
renovatebot referenced this pull request in allenporter/flux-localJun 3, 2023
[![MendRenovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)This PR contains the following updates:| Package | Change | Age | Adoption | Passing | Confidence ||---|---|---|---|---|---|| [typing-extensions](https://togithub.com/python/typing_extensions)([changelog](https://togithub.com/python/typing_extensions/blob/main/CHANGELOG.md))| `==4.5.0` -> `==4.6.3` |[![age](https://badges.renovateapi.com/packages/pypi/typing-extensions/4.6.3/age-slim)](https://docs.renovatebot.com/merge-confidence/)|[![adoption](https://badges.renovateapi.com/packages/pypi/typing-extensions/4.6.3/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)|[![passing](https://badges.renovateapi.com/packages/pypi/typing-extensions/4.6.3/compatibility-slim/4.5.0)](https://docs.renovatebot.com/merge-confidence/)|[![confidence](https://badges.renovateapi.com/packages/pypi/typing-extensions/4.6.3/confidence-slim/4.5.0)](https://docs.renovatebot.com/merge-confidence/)|---### Release Notes<details><summary>python/typing_extensions</summary>###[`v4.6.3`](https://togithub.com/python/typing_extensions/blob/HEAD/CHANGELOG.md#Release-463-June-1-2023)[CompareSource](https://togithub.com/python/typing_extensions/compare/4.6.2...4.6.3)-   Fix a regression introduced in v4.6.0 in the implementation of    runtime-checkable protocols. The regression meantthat doing `class Foo(X, typing_extensions.Protocol)`, where `X` was aclass that    had `abc.ABCMeta` as its metaclass, would then cause subsequent    `isinstance(1, X)` calls to erroneously raise `TypeError`. Patch byAlex Waygood (backporting theCPython[https://github.com/python/cpython/pull/105152](https://togithub.com/python/cpython/pull/105152)l/105152).-   Sync the repository's LICENSE file with that of CPython.    `typing_extensions` is distributed under the same license as    CPython itself.- Skip a problematic test on Python 3.12.0b1. The test fails on 3.12.0b1due to    a bug in CPython, which will be fixed in 3.12.0b2. The    `typing_extensions` test suite now passes on 3.12.0b1.###[`v4.6.2`](https://togithub.com/python/typing_extensions/blob/HEAD/CHANGELOG.md#Release-462-May-25-2023)[CompareSource](https://togithub.com/python/typing_extensions/compare/4.6.1...4.6.2)- Fix use of `@deprecated` on classes with `__new__` but no `__init__`.    Patch by Jelle Zijlstra.- Fix regression in version 4.6.1 where comparing a generic classagainst aruntime-checkable protocol using `isinstance()` would cause`AttributeError`    to be raised if using Python 3.7.###[`v4.6.1`](https://togithub.com/python/typing_extensions/blob/HEAD/CHANGELOG.md#Release-461-May-23-2023)[CompareSource](https://togithub.com/python/typing_extensions/compare/4.6.0...4.6.1)- Change deprecated `@runtime` to formal API `@runtime_checkable` in theerror    message. Patch by Xuehai Pan.- Fix regression in 4.6.0 where attempting to define a `Protocol` thatwasgeneric over a `ParamSpec` or a `TypeVarTuple` would cause `TypeError`to be    raised. Patch by Alex Waygood.###[`v4.6.0`](https://togithub.com/python/typing_extensions/blob/HEAD/CHANGELOG.md#Release-460-May-22-2023)[CompareSource](https://togithub.com/python/typing_extensions/compare/4.5.0...4.6.0)-   `typing_extensions` is now documented athttps://typing-extensions.readthedocs.io/en/latest/. Patch by JelleZijlstra.- Add `typing_extensions.Buffer`, a marker class for buffer types, asproposedby PEP 688. Equivalent to `collections.abc.Buffer` in Python 3.12. Patchby    Jelle Zijlstra.- Backport two CPython PRs fixing various issues with `typing.Literal`:[https://github.com/python/cpython/pull/23294](https://togithub.com/python/cpython/pull/23294)3294[https://github.com/python/cpython/pull/23383](https://togithub.com/python/cpython/pull/23383)ll/23383.Both CPython PRs wereoriginally by Yurii Karabas, and both were backported to Python >=3.9.1,but    no earlier. Patch by Alex Waygood.A side effect of one of the changes is that equality comparisons of`Literal`objects will now raise a `TypeError` if one of the `Literal` objectsbeingcompared has a mutable parameter. (Using mutable parameters with`Literal` is    not supported by PEP 586 or by any major static type checkers.)-   `Literal` is now reimplemented on all Python versions <= 3.10.0. The`typing_extensions` version does not suffer from the bug that was fixedin[https://github.com/python/cpython/pull/29334](https://togithub.com/python/cpython/pull/29334)9334.(The CPython bugfix was    backported to CPython 3.10.1 and 3.9.8, but no earlier.)- Backport [CPython PR26067](https://togithub.com/python/cpython/pull/26067)    (originally by Yurii Karabas), ensuring that `isinstance()` calls on    protocols raise `TypeError` when the protocol is not decorated with    `@runtime_checkable`. Patch by Alex Waygood.- Backport several significant performance improvements toruntime-checkableprotocols that have been made in Python 3.12([https://github.com/python/cpython/issues/74690](https://togithub.com/python/cpython/issues/74690)es/74690for details). Patch by Alex    Waygood.A side effect of one of the performance improvements is that the membersofa runtime-checkable protocol are now considered “frozen” at runtime assoon    as the class has been created. Monkey-patching attributes onto aruntime-checkable protocol will still work, but will have no impact on    `isinstance()` checks comparing objects to the protocol. See["What's New in Python3.12"](https://docs.python.org/3.12/whatsnew/3.12.html#typing)    for more details.-   `isinstance()` checks against runtime-checkable protocols now use    `inspect.getattr_static()` rather than `hasattr()` to lookup whetherattributes exist(backport[https://github.com/python/cpython/pull/103034](https://togithub.com/python/cpython/pull/103034)3034).    This means that descriptors and `__getattr__` methods are no longerunexpectedly evaluated during `isinstance()` checks againstruntime-checkableprotocols. However, it may also mean that some objects which used to beconsidered instances of a runtime-checkable protocol on older versionsof`typing_extensions` may no longer be considered instances of thatprotocolusing the new release, and vice versa. Most users are unlikely to beaffected    by this change. Patch by Alex Waygood.- Backport the ability to define `__init__` methods on Protocol classes,achange made in Python 3.11 (originallyimplemented[https://github.com/python/cpython/pull/31628](https://togithub.com/python/cpython/pull/31628)ll/31628by Adrian Garcia Badaracco).    Patch by Alex Waygood.- Speedup `isinstance(3, typing_extensions.SupportsIndex)` by >10x onPython    <3.12. Patch by Alex Waygood.-   Add `typing_extensions` versions of `SupportsInt`, `SupportsFloat`,`SupportsComplex`, `SupportsBytes`, `SupportsAbs` and `SupportsRound`.Thesehave the same semantics as the versions from the `typing` module, but`isinstance()` checks against the `typing_extensions` versions are >10xfaster    at runtime on Python <3.12. Patch by Alex Waygood.- Add `__orig_bases__` to non-generic TypedDicts, call-based TypedDicts,andcall-based NamedTuples. Other TypedDicts and NamedTuples already had theattribute.    Patch by Adrian Garcia Badaracco.-   Add `typing_extensions.get_original_bases`, a backport of[`types.get_original_bases`](https://docs.python.org/3.12/library/types.html#types.get_original_bases),introduced in Python 3.12(CPython[https://github.com/python/cpython/pull/101827](https://togithub.com/python/cpython/pull/101827)l/101827,originally by James    Hilton-Balfe). Patch by Alex Waygood.This function should always produce correct results when called onclasses    constructed using features from `typing_extensions`. However, it mayproduce incorrect results when called on some `NamedTuple` or`TypedDict`    classes that use `typing.{NamedTuple,TypedDict}` on Python <=3.11.- Constructing a call-based `TypedDict` using keyword arguments for thefieldsnow causes a `DeprecationWarning` to be emitted. This matches thebehaviour    of `typing.TypedDict` on 3.11 and 3.12.- Backport the implementation of `NewType` from 3.10 (where it isimplementedas a class rather than a function). This allows user-defined `NewType`sto be    pickled. Patch by Alex Waygood.- Fix tests and import on Python 3.12, where `typing.TypeVar` can nolonger be    subclassed. Patch by Jelle Zijlstra.- Add `typing_extensions.TypeAliasType`, a backport of`typing.TypeAliasType`    from PEP 695. Patch by Jelle Zijlstra.- Backport changes to the repr of `typing.Unpack` that were made inorder to    implement [PEP 692](https://peps.python.org/pep-0692/) (backport of[https://github.com/python/cpython/pull/104048](https://togithub.com/python/cpython/pull/104048)4048).Patch by Alex Waygood.</details>---### Configuration📅 **Schedule**: Branch creation - At any time (no schedule defined),Automerge - At any time (no schedule defined).🚦 **Automerge**: Enabled.♻ **Rebasing**: Whenever PR becomes conflicted, or you tick therebase/retry checkbox.🔕 **Ignore**: Close this PR and you won't be reminded about this updateagain.---- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, checkthis box---This PR has been generated by [MendRenovate](https://www.mend.io/free-developer-tools/renovate/). Viewrepository job log[here](https://app.renovatebot.com/dashboard#github/allenporter/flux-local).<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMDUuMiIsInVwZGF0ZWRJblZlciI6IjM1LjEwNS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
daregit pushed a commit to daregit/yocto-combined that referenced this pull requestMay 22, 2024
Changelog:============-  Fix use of@deprecated on classes with __new__ but no __init__.-  Fix regression in version 4.6.1 where comparing a generic class against a   runtime-checkable protocol using isinstance() would cause AttributeError to   be raised if using Python 3.7.-  Change deprecated@runtime to formal API @runtime_checkable in the error message.-  Fix regression in 4.6.0 where attempting to define a Protocol that was generic   over a ParamSpec or a TypeVarTuple would cause TypeError to be raised.-  typing_extensions is now documented athttps://typing-extensions.readthedocs.io/en/latest/.-  Add typing_extensions.Buffer, a marker class for buffer types, as proposed   by PEP 688. Equivalent to collections.abc.Buffer in Python 3.12.-  Backport two CPython PRs fixing various issues with typing.Literal:python/cpython#23294 andpython/cpython#23383. Both CPython PRs were originally,   and both were backported to Python >=3.9.1, but no earlier.-  A side effect of one of the changes is that equality comparisons of Literal   objects will now raise a TypeError if one of the Literal objects being compared   has a mutable parameter. (Using mutable parameters with Literal is not   supported by PEP 586 or by any major static type checkers.)-  Literal is now reimplemented on all Python versions <= 3.10.0.-  Backport CPython PR 26067, ensuring that isinstance() calls on protocols raise   TypeError when the protocol is not decorated with @runtime_checkable.-  Backport several significant performance improvements to runtime-checkable protocols   that have been made in Python 3.12 (seepython/cpython#74690 for details).-  A side effect of one of the performance improvements is that the members of a   runtime-checkable protocol are now considered "frozen" at runtime as soon as the   class has been created. Monkey-patching attributes onto a runtime-checkable   protocol will still work, but will have no impact on isinstance() checks comparing   objects to the protocol. See "What's New in Python 3.12" for more details.-  isinstance() checks against runtime-checkable protocols now use inspect.getattr_static()   rather than hasattr() to lookup whether attributes exist (backportingpython/cpython#103034).-  Backport the ability to define __init__ methods on Protocol classes, a change   made in Python 3.11 (originally implemented inpython/cpython#31628-  Speedup isinstance(3, typing_extensions.SupportsIndex) by >10x on Python <3.12.-  Add typing_extensions versions of SupportsInt, SupportsFloat, SupportsComplex,   SupportsBytes, SupportsAbs and SupportsRound. These have the same semantics as   the versions from the typing module, but isinstance() checks against the   typing_extensions versions are >10x faster at runtime on Python <3.12.-  Add __orig_bases__ to non-generic TypedDicts, call-based TypedDicts, and call-based NamedTuples.-  Add typing_extensions.get_original_bases, a backport of types.get_original_bases,   introduced in Python 3.12 (CPython PRpython/cpython#101827, originally-  This function should always produce correct results when called on classes   constructed using features from typing_extensions.-  Constructing a call-based TypedDict using keyword arguments for the fields   now causes a DeprecationWarning to be emitted. This matches the behaviour   of typing.TypedDict on 3.11 and 3.12.-  Backport the implementation of NewType from 3.10 (where it is implemented as   a class rather than a function). This allows user-defined NewTypes to be pickled.-  Fix tests and import on Python 3.12, where typing.TypeVar can no longer be subclassed.-  Add typing_extensions.TypeAliasType, a backport of typing.TypeAliasType from PEP 695.-  Backport changes to the repr of typing.Unpack that were made in order   to implement PEP 692 (backport ofpython/cpython#104048).(From OE-Core rev: a37154b9166323d05cca970ebb37bee0d5250893)Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gstgstgst left review comments

@JelleZijlstraJelleZijlstraJelleZijlstra left review comments

@sobolevnsobolevnsobolevn left review comments

@AlexWaygoodAlexWaygoodAlexWaygood approved these changes

@gvanrossumgvanrossumgvanrossum approved these changes

@musashay23musashay23musashay23 approved these changes

@Fidget-SpinnerFidget-SpinnerAwaiting requested review from Fidget-Spinner

Assignees

@AlexWaygoodAlexWaygood

Labels
3.12only security fixesstdlibPython modules in the Lib dirtopic-typingtype-featureA feature request or enhancement
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

9 participants
@Gobot1234@sobolevn@bedevere-bot@AlexWaygood@gvanrossum@gst@JelleZijlstra@musashay23@arhadthedev

[8]ページ先頭

©2009-2025 Movatter.jp