Bug 2584235

Summary: python-pymdown-extensions fails to build with Python 3.16: ValueError: Port could not be cast to integer value as '\\path'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-pymdown-extensionsAssignee: Davide Cavalca <davide>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: davide, ksurma, mattia.verga, mhroncok, mkdocs-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2567340    

Description Karolina Surma 2026-11-25 16:23:17 UTC
python-pymdown-extensions fails to build with Python 3.16.0a2.

________________ TestUrlParse.test_file_windows_start_backslash ________________

self = <tests.test_targeted.TestUrlParse testMethod=test_file_windows_start_backslash>

    def test_file_windows_start_backslash(self):
        """Test file windows start with backslash."""
    
        url = r'file://\c:\path'
>       scheme, _, path, _, _, _, is_url, is_absolute = util.parse_url(url)
                                                        ^^^^^^^^^^^^^^^^^^^

tests/test_targeted.py:55: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pymdownx/util.py:136: in parse_url
    scheme, netloc, path, params, query, fragment = urlparse(html.unescape(url))
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.16/urllib/parse.py:486: in urlparse
    scheme, netloc, url, params, query, fragment = _urlparse(url, scheme, allow_fragments)
                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.16/urllib/parse.py:499: in _urlparse
    scheme, netloc, url, query, fragment = _urlsplit(url, scheme, allow_fragments)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.16/urllib/parse.py:646: in _urlsplit
    _checknetloc(netloc)
/usr/lib64/python3.16/urllib/parse.py:547: in _checknetloc
    _validate_port(port)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

port = '\\path'

    def _validate_port(port):
        if port.isdigit() and port.isascii():
            port = int(port)
        else:
>           raise ValueError(f"Port could not be cast to integer value as {port!r}")
E           ValueError: Port could not be cast to integer value as '\\path'

https://docs.python.org/3.16/whatsnew/3.16.html
urllib.parse.urlsplit() and urllib.parse.urlparse() now raise ValueError when the URL is parsed if the port is not a decimal number or is outside the range 0–65535. Previously, the error was only raised when the port attribute was read. This also affects urljoin(), and urldefrag() for URLs with a fragment. Code which never read port may now fail on URLs such as:

    SCP-style addresses given a scheme, such as git+ssh://git:org/repo.git;

    multi-host URLs with ports, such as mongodb://h1:27017,h2:27017/db or postgresql://h1:5432,h2:5433/db;

    URL templates with a placeholder port, such as http://localhost:{port}/.

These are not valid URLs under RFC 3986. To process them, split off the netloc yourself before calling urlsplit(), for example by replacing it with a placeholder host, or fill in templates before parsing them. (Contributed by Miguel Brito and Senthil Kumaran in gh-88037.)

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.16/fedora-rawhide-x86_64/11359683-python-pymdown-extensions/

For all our attempts to build python-pymdown-extensions with Python 3.16, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.16/package/python-pymdown-extensions/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.16:
https://copr.fedorainfracloud.org/coprs/g/python/python3.16/

Let us know here if you have any questions.

Python 3.16 is planned to be included in Fedora 47.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.16.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.