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 — gh-74690: Avoid a costly type check where possible in `_ProtocolMeta.__subclasscheck__` by AlexWaygood · Pull Request #112717 · python/cpython

Conversation

@AlexWaygood

@AlexWaygood AlexWaygood commented Dec 4, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This speeds up issubclass(int, typing.SupportsIndex) by around 6%.

The approach is to move the code around a bit so that we delegate the type-checking to type.__subclasscheck__ wherever possible; type.__subclasscheck__ can do it faster. We now only check from _ProtocolMeta.__subclasscheck__ whether other is an instance of type if we know we're about to raise an exception anyway, and we want the issubclass() arg 2 must be a type message to take priority over the other error message we could potentially give the user.

  • Issue: Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance #74690

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Eclips4 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@AlexWaygood
pythongh-74690: Avoid a costly type check where possible in `_Protoco…
35ba873
…lMeta.__subclasscheck__`
@AlexWaygood AlexWaygood added performance Performance or resource usage topic-typing labels Dec 4, 2023
@AlexWaygood
AlexWaygood requested a review from carljm December 4, 2023 16:53
@AlexWaygood
AlexWaygood requested a review from JelleZijlstra as a code owner December 4, 2023 16:53
@bedevere-app bedevere-app Bot added the awaiting core review label Dec 4, 2023
@bedevere-app bedevere-app Bot mentioned this pull request Dec 4, 2023
Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance #74690
Closed
barneygale
barneygale approved these changes Dec 4, 2023
View reviewed changes

@barneygale barneygale left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks good! Is it important that the "issubclass() arg 1 must be a class" error message takes precedence over the others? It's not obvious to me that it should, but I'm not very familiar with this code.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Dec 4, 2023
@AlexWaygood

AlexWaygood commented Dec 4, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Thanks for the review! :D

Looks good! Is it important that the "issubclass() arg 1 must be a class" error message takes precedence over the others? It's not obvious to me that it should, but I'm not very familiar with this code.

Yeah, so to clarify, with the type checks, this is the behaviour we get with this PR branch:

Python 3.13.0a2+ (heads/main:9560e0d6d7, Dec  4 2023, 13:50:58) [MSC v.1932 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import typing as t
>>> @t.runtime_checkable
... class Foo(t.Protocol):
...     X = 1
...
>>> issubclass("not a class", Foo)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    issubclass("not a class", Foo)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alexw\coding\fast-cpython\Lib\typing.py", line 1842, in __subclasscheck__
    _type_check_subclasscheck_second_arg(other)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "C:\Users\alexw\coding\fast-cpython\Lib\typing.py", line 1796, in _type_check_subclasscheck_second_arg
    raise TypeError('issubclass() arg 1 must be a class')
TypeError: issubclass() arg 1 must be a class

But without the type checks, we'd get this behaviour instead:

>>> import typing as t
>>> @t.runtime_checkable
... class Foo(t.Protocol):
...     X = 1
...
>>> issubclass("not a class", Foo)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    issubclass("not a class", Foo)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alexw\coding\fast-cpython\Lib\typing.py", line 1847, in __subclasscheck__
    raise TypeError(
    ...<2 lines>...
    )
TypeError: Protocols with non-method members don't support issubclass(). Non-method members: 'X'.

It wouldn't be the worst thing in the world if we had that error message instead. But the fact that Foo has non-method members is clearly not the most significant problem with this person's code! So I definitely prefer to prioritise the "issubclass() arg 1 must be a class" message, if possible :)

barneygale reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood
Add a docstring to help future maintainers
3c7eb19
@AlexWaygood

AlexWaygood commented Dec 4, 2023

Copy link
Copy Markdown
Member Author

I added a docstring in 3c7eb19 -- does that make things a bit clearer? :)

barneygale reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@barneygale

barneygale commented Dec 4, 2023

Copy link
Copy Markdown
Contributor

It does indeed! Thank you.

AlexWaygood reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood
AlexWaygood enabled auto-merge (squash) December 4, 2023 18:59
AlexWaygood
AlexWaygood commented Dec 4, 2023
View reviewed changes
Comment thread Lib/typing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood
improve docstring
3975611
@AlexWaygood
AlexWaygood merged commit 2ed20d3 into python:main Dec 4, 2023
@AlexWaygood
AlexWaygood deleted the protocolmeta-subclasscheck branch December 4, 2023 19:35
@bedevere-app bedevere-app Bot removed the awaiting merge label Dec 4, 2023
@AlexWaygood AlexWaygood mentioned this pull request Jan 20, 2024
Backport recent improvements to the implementation of Protocol python/typing_extensions#324
Merged
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@AlexWaygood @aisk
pythongh-74690: Avoid a costly type check where possible in `_Protoco…
4fceb7f
…lMeta.__subclasscheck__` (python#112717)
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Feb 26, 2024
adam
py-typing-extensions: updated to 4.10.0
141f6d4
Release 4.10.0 (February 24, 2024)

This feature release adds support for PEP 728 (TypedDict with extra
items) and PEP 742 (``TypeIs``).

There are no changes since 4.10.0rc1.

Release 4.10.0rc1 (February 17, 2024)

- Add support for PEP 728, supporting the `closed` keyword argument and the
  special `__extra_items__` key for TypedDict. Patch by Zixuan James Li.
- Add support for PEP 742, adding `typing_extensions.TypeIs`. Patch
  by Jelle Zijlstra.
- Drop runtime error when a read-only `TypedDict` item overrides a mutable
  one. Type checkers should still flag this as an error. Patch by Jelle
  Zijlstra.
- Speedup `issubclass()` checks against simple runtime-checkable protocols by
  around 6% (backporting python/cpython#112717, by Alex
  Waygood).
- Fix a regression in the implementation of protocols where `typing.Protocol`
  classes that were not marked as `@runtime_checkable` would be unnecessarily
  introspected, potentially causing exceptions to be raised if the protocol had
  problematic members. Patch by Alex Waygood, backporting
  python/cpython#113401.
@ibakirov ibakirov mentioned this pull request Feb 26, 2024
Bump typing-extensions from 4.9.0 to 4.10.0 IBX-EDU/sanic-app#10
Merged
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
6dc2e4b
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 0a1b1a2eefa66ff5d8eb12085d3ecfed0eff7ac1)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
0a1b1a2
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
9bfcc9e
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 0a1b1a2eefa66ff5d8eb12085d3ecfed0eff7ac1)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
764f61a
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 2fee4e85e88bea2ac7c42a1c93a3049258a47c45)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
2fee4e8
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
6388970
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 2fee4e85e88bea2ac7c42a1c93a3049258a47c45)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
a2f5a92
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 5b138eb2bf420f1dc81db76b2eb7d74fd88c0c29)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
5b138eb
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
9c1f1f5
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 5b138eb2bf420f1dc81db76b2eb7d74fd88c0c29)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
6660709
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 5b138eb2bf420f1dc81db76b2eb7d74fd88c0c29)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
055b6c2
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 955ab06da61db7393ad54a87e5f2536f0dae3cf2)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
955ab06
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
bdcb4c3
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 955ab06da61db7393ad54a87e5f2536f0dae3cf2)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
5ab10ef
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 955ab06da61db7393ad54a87e5f2536f0dae3cf2)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 28, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
0652961
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 955ab06da61db7393ad54a87e5f2536f0dae3cf2)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 29, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
b34fef2
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 91dd6f2878bcdbb6f9ba65927f6c6f981b0b3f1a)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Feb 29, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
91dd6f2
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 29, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
67a2247
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 91dd6f2878bcdbb6f9ba65927f6c6f981b0b3f1a)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 29, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
9ddffb0
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 91dd6f2878bcdbb6f9ba65927f6c6f981b0b3f1a)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 29, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
ae72901
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 91dd6f2878bcdbb6f9ba65927f6c6f981b0b3f1a)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 29, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
1e2eda1
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 91dd6f2878bcdbb6f9ba65927f6c6f981b0b3f1a)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Feb 29, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
b3db89b
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 91dd6f2878bcdbb6f9ba65927f6c6f981b0b3f1a)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Mar 1, 2024
@wangmingyu84 @rpurdie
python3-typing-extensions: upgrade 4.9.0 -> 4.10.0
df8f6f4
Changelog:
============
-Add support for PEP 728, supporting the closed keyword argument and the special
 __extra_items__ key for TypedDict.
-Add support for PEP 742, adding typing_extensions.TypeIs.
-Drop runtime error when a read-only TypedDict item overrides a mutable one.
 Type checkers should still flag this as an error.
-Speedup issubclass() checks against simple runtime-checkable protocols by
 around 6% (backporting python/cpython#112717
-Fix a regression in the implementation of protocols where typing.Protocol
 classes that were not marked as @runtime_checkable would be unnecessarily
 introspected, potentially causing exceptions to be raised if the protocol had
 problematic members.

(From OE-Core rev: 91dd6f2878bcdbb6f9ba65927f6c6f981b0b3f1a)

Signed-off-by: Wang Mingyu <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@AlexWaygood @Glyphack
pythongh-74690: Avoid a costly type check where possible in `_Protoco…
ed1e65f
…lMeta.__subclasscheck__` (python#112717)
msk pushed a commit to msk/pkgsrc that referenced this pull request May 11, 2026
adam
py-typing-extensions: updated to 4.10.0
a281da8
Release 4.10.0 (February 24, 2024)

This feature release adds support for PEP 728 (TypedDict with extra
items) and PEP 742 (``TypeIs``).

There are no changes since 4.10.0rc1.

Release 4.10.0rc1 (February 17, 2024)

- Add support for PEP 728, supporting the `closed` keyword argument and the
  special `__extra_items__` key for TypedDict. Patch by Zixuan James Li.
- Add support for PEP 742, adding `typing_extensions.TypeIs`. Patch
  by Jelle Zijlstra.
- Drop runtime error when a read-only `TypedDict` item overrides a mutable
  one. Type checkers should still flag this as an error. Patch by Jelle
  Zijlstra.
- Speedup `issubclass()` checks against simple runtime-checkable protocols by
  around 6% (backporting python/cpython#112717, by Alex
  Waygood).
- Fix a regression in the implementation of protocols where `typing.Protocol`
  classes that were not marked as `@runtime_checkable` would be unnecessarily
  introspected, potentially causing exceptions to be raised if the protocol had
  problematic members. Patch by Alex Waygood, backporting
  python/cpython#113401.
jperkin pushed a commit to TritonDataCenter/pkgsrc that referenced this pull request May 14, 2026
adam
py-typing-extensions: updated to 4.10.0
68eedf2
Release 4.10.0 (February 24, 2024)

This feature release adds support for PEP 728 (TypedDict with extra
items) and PEP 742 (``TypeIs``).

There are no changes since 4.10.0rc1.

Release 4.10.0rc1 (February 17, 2024)

- Add support for PEP 728, supporting the `closed` keyword argument and the
  special `__extra_items__` key for TypedDict. Patch by Zixuan James Li.
- Add support for PEP 742, adding `typing_extensions.TypeIs`. Patch
  by Jelle Zijlstra.
- Drop runtime error when a read-only `TypedDict` item overrides a mutable
  one. Type checkers should still flag this as an error. Patch by Jelle
  Zijlstra.
- Speedup `issubclass()` checks against simple runtime-checkable protocols by
  around 6% (backporting python/cpython#112717, by Alex
  Waygood).
- Fix a regression in the implementation of protocols where `typing.Protocol`
  classes that were not marked as `@runtime_checkable` would be unnecessarily
  introspected, potentially causing exceptions to be raised if the protocol had
  problematic members. Patch by Alex Waygood, backporting
  python/cpython#113401.
tsutsui pushed a commit to tsutsui/pkgsrc that referenced this pull request Oct 17, 2026
adam
py-typing-extensions: updated to 4.10.0
3e46d90
Release 4.10.0 (February 24, 2024)

This feature release adds support for PEP 728 (TypedDict with extra
items) and PEP 742 (``TypeIs``).

There are no changes since 4.10.0rc1.

Release 4.10.0rc1 (February 17, 2024)

- Add support for PEP 728, supporting the `closed` keyword argument and the
  special `__extra_items__` key for TypedDict. Patch by Zixuan James Li.
- Add support for PEP 742, adding `typing_extensions.TypeIs`. Patch
  by Jelle Zijlstra.
- Drop runtime error when a read-only `TypedDict` item overrides a mutable
  one. Type checkers should still flag this as an error. Patch by Jelle
  Zijlstra.
- Speedup `issubclass()` checks against simple runtime-checkable protocols by
  around 6% (backporting python/cpython#112717, by Alex
  Waygood).
- Fix a regression in the implementation of protocols where `typing.Protocol`
  classes that were not marked as `@runtime_checkable` would be unnecessarily
  introspected, potentially causing exceptions to be raised if the protocol had
  problematic members. Patch by Alex Waygood, backporting
  python/cpython#113401.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@barneygale barneygale barneygale approved these changes
@carljm carljm Awaiting requested review from carljm
@JelleZijlstra JelleZijlstra Awaiting requested review from JelleZijlstra JelleZijlstra is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

performance Performance or resource usage topic-typing

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@AlexWaygood @barneygale
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — 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.