Skip to content
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

gh-105974: Revert unintentional behaviour change for protocols with non-callable members and custom __subclasshook__ methods #105976

Merged
merged 2 commits into from
Jun 23, 2023

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jun 21, 2023

…with non-callable members and custom `__subclasshook__` methods
@AlexWaygood
Copy link
Member Author

Looking at it again, this patch would mean that isinstance() checks against non-runtime-checkable protocols wouldn't raise TypeError if the non-runtime-checkable protocol didn't have a __subclasshook__ method. That doesn't seem quite right.

@AlexWaygood AlexWaygood enabled auto-merge (squash) June 23, 2023 14:36
@AlexWaygood AlexWaygood merged commit 9499b0f into python:main Jun 23, 2023
21 checks passed
@miss-islington
Copy link
Contributor

Thanks @AlexWaygood for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 23, 2023
…with non-callable members and custom `__subclasshook__` methods (pythonGH-105976)

(cherry picked from commit 9499b0f)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@bedevere-bot
Copy link

GH-106032 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Jun 23, 2023
@AlexWaygood AlexWaygood deleted the subclasshook-bug branch June 23, 2023 15:00
AlexWaygood added a commit that referenced this pull request Jun 23, 2023
… with non-callable members and custom `__subclasshook__` methods (GH-105976) (#106032)

gh-105974: Revert unintentional behaviour change for protocols with non-callable members and custom `__subclasshook__` methods (GH-105976)
(cherry picked from commit 9499b0f)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
renovate bot added a commit to allenporter/flux-local that referenced this pull request Jun 30, 2023
[![Mend
Renovate](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.6.3` -> `==4.7.0` |
[![age](https://badges.renovateapi.com/packages/pypi/typing-extensions/4.7.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/typing-extensions/4.7.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/typing-extensions/4.7.0/compatibility-slim/4.6.3)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/typing-extensions/4.7.0/confidence-slim/4.6.3)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>python/typing_extensions (typing-extensions)</summary>

###
[`v4.7.0`](https://togithub.com/python/typing_extensions/blob/HEAD/CHANGELOG.md#Release-470-June-28-2023)

[Compare
Source](https://togithub.com/python/typing_extensions/compare/4.6.3...4.7.0)

- This is expected to be the last feature release supporting Python 3.7,
which reaches its end of life on June 27, 2023. Version 4.8.0 will
support
    only Python 3.8.0 and up.
- Fix bug where a `typing_extensions.Protocol` class that had one or
more
    non-callable members would raise `TypeError` when `issubclass()`
was called against it, even if it defined a custom `__subclasshook__`
method. The correct behaviour -- which has now been restored -- is not
to
raise `TypeError` in these situations if a custom `__subclasshook__`
method
is defined. Patch by Alex Waygood
(backport[python/cpython#105976).

</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 the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/allenporter/flux-local).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNDQuMiIsInVwZGF0ZWRJblZlciI6IjM1LjE0NC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jul 25, 2023
Release 4.7.1 (July 2, 2023)

- Fix support for `TypedDict`, `NamedTuple` and `is_protocol` on PyPy-3.7 and
  PyPy-3.8. Patch by Alex Waygood. Note that PyPy-3.7 and PyPy-3.8 are unsupported
  by the PyPy project. The next feature release of typing-extensions will
  drop support for PyPy-3.7 and may also drop support for PyPy-3.8.

Release 4.7.0 (June 28, 2023)

- This is expected to be the last feature release supporting Python 3.7,
  which reaches its end of life on June 27, 2023. Version 4.8.0 will support
  only Python 3.8.0 and up.
- Fix bug where a `typing_extensions.Protocol` class that had one or more
  non-callable members would raise `TypeError` when `issubclass()`
  was called against it, even if it defined a custom `__subclasshook__`
  method. The correct behaviour -- which has now been restored -- is not to
  raise `TypeError` in these situations if a custom `__subclasshook__` method
  is defined. Patch by Alex Waygood (backporting
  python/cpython#105976).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants