Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

Conversation

max-muoto
Copy link
Contributor

@max-muoto max-muoto commented Jun 16, 2025

Add the following deprecations for 3.14:

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

This comment has been minimized.

This comment has been minimized.

@max-muoto max-muoto changed the title Add 3.14 deprecations Add 3.14 Deprecations Jun 17, 2025
@max-muoto max-muoto marked this pull request as ready for review June 17, 2025 01:22

This comment has been minimized.

This comment has been minimized.

@@ -65,7 +65,12 @@ class PurePath(PathLike[str]):
def __rtruediv__(self, key: StrPath) -> Self: ...
def __bytes__(self) -> bytes: ...
def as_posix(self) -> str: ...
def as_uri(self) -> str: ...
if sys.version_info >= (3, 14):
@deprecated("PurePath.as_uri() is deprecated. Use Path.as_uri() instead.")
Copy link
Member

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 for Path.as_uri, so people will see this deprecation even if they call the method on a Path.

Copy link
Contributor Author

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
Contributor Author

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. Use pathlib.Path.as_uri() instead

Copy link
Contributor Author

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
Contributor Author

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.

Copy link
Contributor

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

trio (https://github.com/python-trio/trio)
+ src/trio/_path.py:248: error: Argument 1 to "as_uri" of "Path" has incompatible type "trio._path.Path"; expected "pathlib.Path"  [arg-type]

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:388: 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:385: 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:302: 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:1163: 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:247: 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 (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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants