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

Add 3.14 Deprecations#14289

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

Open
max-muoto wants to merge28 commits intopython:main
base:main
Choose a base branch
Loading
frommax-muoto:add-3.14-deprecations

Conversation

max-muoto
Copy link
Contributor

@max-muotomax-muoto commentedJun 16, 2025
edited
Loading

Add the following deprecations for 3.14:

  • pathlib.PurePath.as_uri deprecation.
  • pdb.curframe_locals deprecation.
  • asyncio.iscoroutinefunction deprecation.
  • codecs.open deprecation.
  • os.popen andos.spawn* function deprecations.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@max-muotomax-muoto changed the titleAdd 3.14 deprecationsAdd 3.14 DeprecationsJun 17, 2025
@max-muotomax-muoto marked this pull request as ready for reviewJune 17, 2025 01:22
@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@@ -65,7 +65,12 @@ class PurePath(PathLike[str]):
def__rtruediv__(self,key:StrPath)->Self: ...
def__bytes__(self)->bytes: ...
defas_posix(self)->str: ...
defas_uri(self)->str: ...
ifsys.version_info>= (3,14):
@deprecated("PurePath.as_uri() is deprecated. Use Path.as_uri() instead.")

Choose a reason for hiding this comment

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

That's confusing, it's the same method. Also, we don't have an override forPath.as_uri, so people will see this deprecation even if they call the method on aPath.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Missed the fact that we didn't have an override:7eccbac

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yeah, the exact snippet from the release notes: pathlib.PurePath.as_uri() is deprecated and will be removed in Python 3.19. Usepathlib.Path.as_uri() instead

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@@ -59,7 +59,12 @@ class Pdb(Bdb, Cmd):
stack: list[tuple[FrameType, int]]
curindex: int
curframe: FrameType | None
curframe_locals: Mapping[str, Any]
if sys.version_info >= (3, 13):
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

3.13 due as -The low overhead dynamic frame locals access added in Python 3.13 by PEP 667 means the frame locals cache reference previously stored in this attribute is no longer needed. Derived debuggers should access pdb.Pdb.curframe.f_locals directly in Python 3.13 and later versions.

@github-actionsGitHub Actions

This comment has been minimized.

@srittau
Copy link
Collaborator

It seems thatcurframe_locals actually does not exist in 3.13, at least according to stubtest. I'm not totally sure what's going on here.

@github-actionsGitHub Actions

This comment has been minimized.

@srittau
Copy link
Collaborator

@JelleZijlstra CI fails, at the moment, so we shouldn't merge.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions
Copy link
Contributor

Diff frommypy_primer, showing the effect of this PR on open source code:

aiohttp (https://github.com/aio-libs/aiohttp)+ aiohttp/worker.py:73:44: error: overload def (func: def (*Any, **Any) -> typing.Coroutine[Any, Any, Any]) -> builtins.bool of function asyncio.coroutines.iscoroutinefunction is deprecated: Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead  [deprecated]+ aiohttp/worker.py:73:44: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-deprecated for more info  [deprecated]core (https://github.com/home-assistant/core)+ homeassistant/util/__init__.py:128: error: overload def (func: def (*Any, **Any) -> typing.Coroutine[Any, Any, Any]) -> builtins.bool of function asyncio.coroutines.iscoroutinefunction is deprecated: Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead  [deprecated]+ homeassistant/core.py:387: error: overload def (func: def (*Any, **Any) -> typing.Coroutine[Any, Any, Any]) -> builtins.bool of function asyncio.coroutines.iscoroutinefunction is deprecated: Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead  [deprecated]+ homeassistant/helpers/http.py:48: error: overload def (func: def (*Any, **Any) -> typing.Coroutine[Any, Any, Any]) -> builtins.bool of function asyncio.coroutines.iscoroutinefunction is deprecated: Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead  [deprecated]+ homeassistant/helpers/frame.py:400: error: overload def (func: def (*Any, **Any) -> typing.Coroutine[Any, Any, Any]) -> builtins.bool of function asyncio.coroutines.iscoroutinefunction is deprecated: Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead  [deprecated]+ homeassistant/helpers/service.py:1000: error: overload def (func: def (*Any, **Any) -> typing.Coroutine[Any, Any, Any]) -> builtins.bool of function asyncio.coroutines.iscoroutinefunction is deprecated: Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead  [deprecated]+ homeassistant/helpers/trigger.py:410: error: overload def (func: def (*Any, **Any) -> typing.Coroutine[Any, Any, Any]) -> builtins.bool of function asyncio.coroutines.iscoroutinefunction is deprecated: Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead  [deprecated]+ homeassistant/helpers/condition.py:362: error: overload def (func: def (*Any, **Any) -> typing.Coroutine[Any, Any, Any]) -> builtins.bool of function asyncio.coroutines.iscoroutinefunction is deprecated: Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead  [deprecated]trio (https://github.com/python-trio/trio)+ src/trio/_path.py:258: error: Argument 1 to "as_uri" of "Path" has incompatible type "trio._path.Path"; expected "pathlib.Path"  [arg-type]

@max-muoto
Copy link
ContributorAuthor

max-muoto commentedJul 13, 2025
edited
Loading

@JelleZijlstra@srittau I had to an ignore forcurframe_locals as it doesn't always exist at runtime, but CI is passing now.

Copy link
Collaborator

@srittausrittau left a comment

Choose a reason for hiding this comment

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

Looks mostly good, a few final small suggestions below.

@@ -146,6 +146,8 @@ typing.SupportsRound.__type_params__
typing_extensions.SupportsAbs.__type_params__
typing_extensions.SupportsRound.__type_params__

# Don't always exist at runtime
pdb.Pdb.curframe_locals
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a bit safer, since it means that the symbol can or can not exist:

Suggested change
pdb.Pdb.curframe_locals
(pdb.Pdb.curframe_locals)?

from typing import Any
from typing_extensions import assert_type


deftest_iscoroutinefunction(
deftest_iscoroutinefunction_asyncio(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
deftest_iscoroutinefunction_asyncio(
# asyncio.iscoroutinefunction is deprecated, expecting a warning.
deftest_iscoroutinefunction_asyncio(

title: str | None = None,
description: str | None = None,
*,
argument_default: Any = ...,
Copy link
Collaborator

Choose a reason for hiding this comment

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

While we're here:

Suggested change
argument_default:Any= ...,
#argument_default's type must be valid for the arguments in the group
argument_default:Any= ...,

title: str | None = None,
description: str | None = None,
*,
prefix_chars: str = ...,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
prefix_chars:str= ...,
prefix_chars:str,

description: str | None = None,
*,
prefix_chars: str = ...,
argument_default: Any = ...,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
argument_default:Any= ...,
#argument_default's type must be valid for the arguments in the group
argument_default:Any= ...,

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@srittausrittausrittau requested changes

@JelleZijlstraJelleZijlstraJelleZijlstra approved these changes

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@max-muoto@srittau@JelleZijlstra

[8]ページ先頭

©2009-2025 Movatter.jp