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: Don't set special protocol attributes on non-protocol subclasses of protocols by AlexWaygood · Pull Request #104622 · python/cpython

Conversation

@AlexWaygood

@AlexWaygood AlexWaygood commented May 18, 2023 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This was a small oversight in #103160. It's not a huge issue by any means, but there's no reason to set the special __protocol_attrs__ and __callable_proto_members_only__ attributes for concrete subclasses of protocols, and if we skip doing so, we speedup class creation by around 33%.

(Skipping news, since this fixes a small oversight in a commit that hasn't been included in any released version of Python.)

  • 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.

All reactions
@AlexWaygood
Don't set special protocol attributes on non-protocol subclasses of p…
5a8cdc5
…rotocols
@AlexWaygood AlexWaygood added the skip news label May 18, 2023
@AlexWaygood
AlexWaygood requested review from Fidget-Spinner, JelleZijlstra and gvanrossum as code owners May 18, 2023 20:10
@bedevere-bot bedevere-bot added the awaiting core review label May 18, 2023
@bedevere-bot bedevere-bot mentioned this pull request May 18, 2023
Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance #74690
Closed
@AlexWaygood AlexWaygood added the topic-typing label May 18, 2023
@AlexWaygood
AlexWaygood requested a review from carljm May 18, 2023 20:33
JelleZijlstra
JelleZijlstra approved these changes May 18, 2023
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels May 18, 2023
@AlexWaygood
AlexWaygood merged commit f7835fc into python:main May 18, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label May 18, 2023
@AlexWaygood
AlexWaygood deleted the concrete-proto-subclasses branch May 18, 2023 23:34
carljm added a commit to carljm/cpython that referenced this pull request May 18, 2023
@carljm
Merge branch 'main' into nestedcomps
54095f0
* main:
  pythongh-74690: Don't set special protocol attributes on non-protocol subclasses of protocols (python#104622)
  pythongh-104623: Update Windows installer to use SQLite 3.42.0 (python#104625)
  pythongh-104050: Add more type annotations to Argument Clinic (python#104628)
  pythongh-104629: Don't skip test_clinic if _testclinic is missing (python#104630)
  pythongh-104549: Set __module__ on TypeAliasType (python#104550)
  pythongh-104050: Improve some typing around `default`s and sentinel values (python#104626)
  pythongh-104146: Remove unused vars from Argument Clinic (python#104627)
  pythongh-104615: don't make unsafe swaps in apply_static_swaps (python#104620)
  pythonGH-104484: Add case_sensitive argument to `pathlib.PurePath.match()` (pythonGH-104565)
  pythonGH-96803: Document and test new unstable internal frame API functions (pythonGH-104211)
  pythonGH-104580: Don't cache eval breaker in interpreter (pythonGH-104581)
This was referenced May 19, 2023
Backport some recent Protocol fixes from 3.12 python/typing_extensions#161
Merged
gh-74690: Make a typing test more resilient #104691
Merged
[Bug] typing_extensions.Protocol unsupported under typing_extensions ≥ 4.6.0 beartype/beartype#241
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra approved these changes
@gvanrossum gvanrossum Awaiting requested review from gvanrossum
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner
@carljm carljm Awaiting requested review from carljm

Uh oh!

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

Assignees

No one assigned

Labels

skip news 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.

3 participants

@AlexWaygood @JelleZijlstra @bedevere-bot
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.