Skip to content

Conversation

@max-muoto
Copy link
Contributor

Deprecated in favor of Path.as_uri as of 3.14.

@github-actions
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:267: error: Argument 1 to "as_uri" of "Path" has incompatible type "trio._path.Path"; expected "pathlib.Path"  [arg-type]

Copy link
Contributor

@donbarbos donbarbos left a comment

Choose a reason for hiding this comment

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

Thank you!
PR: python/cpython#127380

Comment on lines +93 to 94
@deprecated("PurePath.as_uri() is deprecated. Use Path.as_uri() instead.")
def as_uri(self) -> str: ...
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like a version check wouldn't hurt here.

Suggested change
@deprecated("PurePath.as_uri() is deprecated. Use Path.as_uri() instead.")
def as_uri(self) -> str: ...
if sys.version_info >= (3, 14):
@deprecated("Deprecated since Python 3.14; will be removed in Python 3.19. Use `Path.as_uri()` instead.")
def as_uri(self) -> str: ...
else:
def as_uri(self) -> str: ...

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