Skip to content

Conversation

@max-muoto
Copy link
Contributor

@max-muotomax-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.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@max-muotomax-muoto changed the title Add 3.14 deprecationsAdd 3.14 DeprecationsJun 17, 2025
@max-muotomax-muoto marked this pull request as ready for review June 17, 2025 01:22
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

defas_posix(self) ->str: ...
defas_uri(self) ->str: ...
ifsys.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
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. Use pathlib.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.

@srittau
Copy link
Collaborator

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

@github-actions

This comment has been minimized.

@srittau
Copy link
Collaborator

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

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@max-muoto
Copy link
ContributorAuthor

max-muoto commented Jul 13, 2025

@JelleZijlstra@srittau I had to an ignore for curframe_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.

Comment on lines +20 to +29
@deprecated("Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead")
defiscoroutinefunction(func: Callable[..., Coroutine[Any, Any, Any]]) ->bool: ...
@overload
@deprecated("Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead")
defiscoroutinefunction(func: Callable[_P, Awaitable[_T]]) ->TypeGuard[Callable[_P, Coroutine[Any, Any, _T]]]: ...
@overload
@deprecated("Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead")
defiscoroutinefunction(func: Callable[_P, object]) ->TypeGuard[Callable[_P, Coroutine[Any, Any, Any]]]: ...
@overload
@deprecated("Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead")
Copy link
Collaborator

Choose a reason for hiding this comment

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

For consideration, in #14074 I'm also unconditionally marking these as deprecated, but @srittau mentionned that

If I understand it correctly, it's sometimes necessary to use this on Python < 3.11, since it supports @coroutine (removed in 3.11), which the inspect version doesn't support.

max-muotoand others added 7 commits August 3, 2025 22:07
Co-authored-by: Avasam <samuel.06@hotmail.com>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
@max-muoto
Copy link
ContributorAuthor

@srittau@Avasam Comments addressed.

@github-actions
Copy link
Contributor

Diff from mypy_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] 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]

Sign up for freeto 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.

4 participants

@max-muoto@srittau@JelleZijlstra@Avasam