Bug 2336939 - python-charset-normalizer fails to build with Python 3.14: PendingDeprecationWarning: FileType is deprecated. Simply open files after parsing arguments.
Summary: python-charset-normalizer fails to build with Python 3.14: PendingDeprecation...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-charset-normalizer
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lumír Balhar
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-01-10 15:07 UTC by Karolina Surma
Modified: 2025-01-15 12:45 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-01-15 12:45:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2025-01-10 15:07:00 UTC
python-charset-normalizer fails to build with Python 3.14.0a3.

11 tests fail with similar output.
FAILED tests/test_cli.py::TestCommandLineInterface::test_force_replace_without_replace
FAILED tests/test_cli.py::TestCommandLineInterface::test_multiple_file - Pend...
FAILED tests/test_cli.py::TestCommandLineInterface::test_non_existent_file - ...
FAILED tests/test_cli.py::TestCommandLineInterface::test_replace_without_normalize
FAILED tests/test_cli.py::TestCommandLineInterface::test_single_file - Pendin...
FAILED tests/test_cli.py::TestCommandLineInterface::test_single_file_normalize
FAILED tests/test_cli.py::TestCommandLineInterface::test_single_verbose_file
FAILED tests/test_cli.py::TestCommandLineInterface::test_version_output_success
FAILED tests/test_cli.py::TestCommandLineInterface::test_with_alternative - P...
FAILED tests/test_cli.py::TestCommandLineInterface::test_with_minimal_and_alt
FAILED tests/test_cli.py::TestCommandLineInterface::test_with_minimal_output

_________ TestCommandLineInterface.test_force_replace_without_replace __________

self = <tests.test_cli.TestCommandLineInterface testMethod=test_force_replace_without_replace>

    def test_force_replace_without_replace(self):
        self.assertEqual(
>           cli_detect([DIR_PATH + "/data/sample-arabic-1.txt", "--force"]), 1
        )

tests/test_cli.py:111: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../BUILDROOT/usr/lib/python3.14/site-packages/charset_normalizer/cli/__main__.py:62: in cli_detect
    "files", type=argparse.FileType("rb"), nargs="+", help="File(s) to be analysed"
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'FileType' object has no attribute '_mode'") raised in repr()] FileType object at 0x7fe00ccf3e00>
mode = 'rb', bufsize = -1, encoding = None, errors = None

    def __init__(self, mode='r', bufsize=-1, encoding=None, errors=None):
        import warnings
>       warnings.warn(
            "FileType is deprecated. Simply open files after parsing arguments.",
            category=PendingDeprecationWarning,
            stacklevel=2
        )
E       PendingDeprecationWarning: FileType is deprecated. Simply open files after parsing arguments.

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08480187-python-charset-normalizer/

For all our attempts to build python-charset-normalizer with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-charset-normalizer/

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

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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 Lumír Balhar 2025-01-15 12:45:47 UTC
Fixed without rawhide build in https://src.fedoraproject.org/rpms/python-charset-normalizer/pull-request/22


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