Bug 2266601 - python-exdir fails to build with Python 3.13: NameError("Name cannot be '{}' because it is a reserved filename in Windows.")
Summary: python-exdir fails to build with Python 3.13: NameError("Name cannot be '{}' ...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-exdir
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ankur Sinha (FranciscoD)
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2024-02-28 12:56 UTC by Karolina Surma
Modified: 2024-03-28 14:40 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github CINPLA exdir issues 180 0 None open Python 3.13: test_assert_valid_name_minimal fails due to changed behavior of PurePath.is_reserved() 2024-03-28 14:40:44 UTC

Description Karolina Surma 2024-02-28 12:56:52 UTC
python-exdir fails to build with Python 3.13.0a4.

=================================== FAILURES ===================================
________________________ test_assert_valid_name_minimal ________________________

setup_teardown_folder = (PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_assert_valid_name_minimal0'), PosixPath('/tmp/pytest-of-mockbuild/p...d_name_minimal0/test.exdir'), PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_assert_valid_name_minimal0/exdir_dir'))

    def test_assert_valid_name_minimal(setup_teardown_folder):
        f = exdir.File(setup_teardown_folder[1], name_validation=fv.minimal)
        exob._assert_valid_name("abcdefghijklmnopqrstuvwxyz1234567890_-", f)
        with pytest.raises(NameError):
            exob._assert_valid_name("", f)
    
        exob._assert_valid_name("A", f)
    
>       exob._assert_valid_name("\n", f)

tests/test_help_functions.py:36: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-exdir-0.5.0.1-4.fc41.x86_64/usr/lib/python3.13/site-packages/exdir/core/exdir_object.py:22: in _assert_valid_name
    container.file.name_validation(container.directory, name)
../../BUILDROOT/python-exdir-0.5.0.1-4.fc41.x86_64/usr/lib/python3.13/site-packages/exdir/core/validation.py:86: in minimal
    _assert_nonreserved(name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = '\n'

    def _assert_nonreserved(name):
        # NOTE ignore unicode errors, they are not reserved
        try:
            name_str = str(name)
        except UnicodeEncodeError:
            name_str = name.encode('utf8')
    
        reserved_names = [
            exob.META_FILENAME,
            exob.ATTRIBUTES_FILENAME,
            exob.RAW_FOLDER_NAME
        ]
    
        if name_str in reserved_names:
            raise NameError(
                "Name cannot be '{}' because it is a reserved filename in Exdir.".format(name_str)
            )
    
        if pathlib.PureWindowsPath(name_str).is_reserved():
>           raise NameError(
                "Name cannot be '{}' because it is a reserved filename in Windows.".format(name_str)
            )
E           NameError: Name cannot be '
E           ' because it is a reserved filename in Windows.

../../BUILDROOT/python-exdir-0.5.0.1-4.fc41.x86_64/usr/lib/python3.13/site-packages/exdir/core/validation.py:62: NameError
=========================== short test summary info ============================
FAILED tests/test_help_functions.py::test_assert_valid_name_minimal - NameErr...
================= 1 failed, 170 passed, 411 warnings in 2.22s ==================

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/07067764-python-exdir/

For all our attempts to build python-exdir with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python-exdir/

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.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
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.

Comment 1 Sandro 2024-03-28 14:40:44 UTC
This fails due to method `is_reserved()` behaving differently in Python 3.13 as documented upstream[1]. In addition the method is deprecated as of Python 3.13 and will be removed in Python 3.15.

I've reported the issue upstream in order to let them choose a path forward. If push comes to shove, we can disable the failing test downstream until a fix has been provided.

[1] https://docs.python.org/3.13/library/pathlib.html#pathlib.PurePath.is_reserved


Note You need to log in before you can comment on or make changes to this bug.