Bug 2576595

Summary: python-pypandoc fails to build with Python 3.16: test_sorting_rules_applied_for_multiple_files: TypeError: Expected str, bytes or None, not list
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-pypandocAssignee: Zbigniew Jędrzejewski-Szmek <zbyszek>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dank, ksurma, mhroncok, orion, zbyszek
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-19 13:09:16 UTC
python-pypandoc fails to build with Python 3.16.0a2.

__________ TestPypandoc.test_sorting_rules_applied_for_multiple_files __________

self = <tests.test_pypandoc.TestPypandoc testMethod=test_sorting_rules_applied_for_multiple_files>

    def test_sorting_rules_applied_for_multiple_files(self):
        with closed_tempfile(".md", prefix="1_", text="some title 1") as file_name1:
            with closed_tempfile(".md", prefix="2_", text="some title 2") as file_name2:
                expected = "<p>some title 2</p>\n<p>some title 1</p>"
>               received = pypandoc.convert_file(
                    [file_name2, file_name1], "html", sort_files=False
                )

tests/test_pypandoc.py:227: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pypandoc/__init__.py:171: in convert_file
    if _is_network_path(source_file):  # if the source_file is an url
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pypandoc/__init__.py:289: in _is_network_path
    result = urllib.parse.urlparse(source)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.16/urllib/parse.py:483: in urlparse
    url, scheme, _coerce_result = _coerce_args(url, scheme)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (['/tmp/2_0mj6l2az.md', '/tmp/1_knw15s_d.md'], None)

    def _coerce_args(*args):
        # Invokes decode if necessary to create str args
        # and returns the coerced inputs along with
        # an appropriate result coercion function
        #   - noop for str inputs
        #   - encoding function otherwise
        str_input = None
        for arg in args:
            if not (arg is None or isinstance(arg, str) or hasattr(arg, 'decode')):
                if arg:
>                   raise TypeError("Expected str, bytes or None, "
                                    f"not {type(arg).__name__}")
E                   TypeError: Expected str, bytes or None, not list

/usr/lib64/python3.16/urllib/parse.py:130: TypeError

https://docs.python.org/3.16/whatsnew/3.16.html

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

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

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.