Skip to content

Conversation

@dcbaker
Copy link
Member

@dcbaker dcbaker commented Dec 5, 2025

This does apparently work without the conversion to a string, but the fix isn't hard

This does apparently work without the conversion to a string, but the
fix isn't hard
@dcbaker dcbaker added this to the 1.11 milestone Dec 5, 2025
@dcbaker dcbaker requested a review from jpakkane as a code owner December 5, 2025 18:33
@dcbaker dcbaker added the typing label Dec 5, 2025
@dcbaker dcbaker mentioned this pull request Dec 5, 2025
40 tasks
def write_to_private(self, env: 'Environment') -> Path:
try:
resource = importlib.resources.files('mesonbuild') / self.path
resource = importlib.resources.files('mesonbuild') / self.path.as_posix()
Copy link
Member

Choose a reason for hiding this comment

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

This is a silly fix IMO because it makes the following code unreachable. What's the specific reason mypy doesn't like this?

Copy link
Member Author

@dcbaker dcbaker Dec 5, 2025

Choose a reason for hiding this comment

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

You can't / a Traversable and a PurePath, it wants either a string or a concrete Path

Copy link
Member Author

@dcbaker dcbaker Dec 5, 2025

Choose a reason for hiding this comment

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

I'm actually super confused on this now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Here's the (3.13) definition of Traversable.__truediv__:

StrPath: TypeAlias = str | os.PathLike[str]
def __truediv__(self, child: StrPath) -> "Traversable": ...

PurePath is an instance of os.PathLike[str].

So I'm super confused on why this is showing up as an issue.

@dcbaker
Copy link
Member Author

dcbaker commented Dec 5, 2025

I think this is a typeshed issue

python/typeshed#15108

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants