`pathname2url` changes in Python 3.14 breaking pip tests

Hi all, this is a call for attention, pip has not yet added Python 3.14 support due to some specific test failures, pip is one month away from 25.2 release, which will likely be the release that ships with Python 3.14.

There is a PR to fix the behavior so the helper function produces the same on all versions of Python by special casing Python 3.14+: Adjust path_to_url et al. to produce the same results on Python 3.14+ by hroncok · Pull Request #13423 · pypa/pip · GitHub (Although I am concerned with the way some path changes have been backported the behavior could be different on a bugfix version that isn’t in the test suite).

But there isn’t a clear understanding why this special casing is needed, what specific documentation we can point to that explains that this should be needed.

So if anyone has a good understanding of the changes that happened for pathname2url please can you add a comment on that PR.

4 Likes

The thing that’s particularly difficult to understand is that the underlying changes seem to be improvements to the standards-compliance of urljoin, by @storchaka, but the affected pip code isn’t using urljoin directly, but instead is using urllib.request.url2pathname - which now seems to be adding an unexpected // to the output in some cases.

We’re currently just detecting the unexpected //, and removing it, but this seems like a pretty awful hack. We’d like to at least include a comment explaining why this is necessary, and better still, use a proper, supported way to reliably get a local path name from a file: URL. And yes, I appreciate that the semantics of file URLs is at best difficult to understand, if not outright inconsistent, but that’s largely not the point here, as we’ve been doing this for years and not at least continuing to work the way we used to would be a compatibility break for us…

3 Likes