Title: warnings.deprecated leads to incorrectly set _is_protocol on subclasses · Issue #138010 · python/cpython · GitHub
Open Graph Title: warnings.deprecated leads to incorrectly set _is_protocol on subclasses · Issue #138010 · python/cpython
X Title: warnings.deprecated leads to incorrectly set _is_protocol on subclasses · Issue #138010 · python/cpython
Description: Bug report Bug description: from warnings import deprecated from typing import Protocol class FooProtocol(Protocol): pass class Base: pass @deprecated("") class DeprecatedBase: pass class FooWithBase(Base, FooProtocol): pass class FooWit...
Open Graph Description: Bug report Bug description: from warnings import deprecated from typing import Protocol class FooProtocol(Protocol): pass class Base: pass @deprecated("") class DeprecatedBase: pass class FooWithBa...
X Description: Bug report Bug description: from warnings import deprecated from typing import Protocol class FooProtocol(Protocol): pass class Base: pass @deprecated("") class DeprecatedBase: pass class...
Opengraph URL: https://github.com/python/cpython/issues/138010
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"warnings.deprecated leads to incorrectly set _is_protocol on subclasses","articleBody":"# Bug report\n\n### Bug description:\n\n```python\nfrom warnings import deprecated\nfrom typing import Protocol\n\n\nclass FooProtocol(Protocol):\n pass\n\nclass Base:\n pass\n\n@deprecated(\"\")\nclass DeprecatedBase:\n pass\n\nclass FooWithBase(Base, FooProtocol):\n pass\n\nclass FooWithDeprecatedBase(DeprecatedBase, FooProtocol):\n pass\n\n\nassert FooWithBase._is_protocol is False\nassert FooWithDeprecatedBase._is_protocol is True\n```\n\n\n### CPython versions tested on:\n\n3.13\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-138210\n* gh-138561\n* gh-138564\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/hmwillson","@type":"Person","name":"hmwillson"},"datePublished":"2025-08-20T22:13:20.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/138010/cpython/issues/138010"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7edbb905-f69e-ca8f-24b1-ae37b2385333 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B920:16C3D3:573B5BC:7B59DB7:6A4FF927 |
| html-safe-nonce | 7cfaa650f1ead8de67182d90d99560d74f4260e768388437811e1d009979e8de |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTIwOjE2QzNEMzo1NzNCNUJDOjdCNTlEQjc6NkE0RkY5MjciLCJ2aXNpdG9yX2lkIjoiNDgzNzE2MjA5MjMyOTk1NzY3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 038eda872c255f87f3253cb8bc64716f6db2ced7d035587fa942d4cfd411cef3 |
| hovercard-subject-tag | issue:3339684475 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/138010/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a8857059674f8c93a07932f8af98a1566b7fd766b8954416e2b94f8f9484a412/python/cpython/issues/138010 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a8857059674f8c93a07932f8af98a1566b7fd766b8954416e2b94f8f9484a412/python/cpython/issues/138010 |
| og:image:alt | Bug report Bug description: from warnings import deprecated from typing import Protocol class FooProtocol(Protocol): pass class Base: pass @deprecated("") class DeprecatedBase: pass class FooWithBa... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hmwillson |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3bd0ff5d28a87b4801a63fb38c2a21a91b0a700dca159dc9416aeae05771b899 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 67a336083e4dcb40224dc2c01cd4c7ed413bdb09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width