Bug 2271060 - python-jsonformatter fails to build with Python 3.13: AttributeError: module 'logging' has no attribute '_acquireLock'
Summary: python-jsonformatter fails to build with Python 3.13: AttributeError: module ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-jsonformatter
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Sandro Mani
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2024-03-22 13:26 UTC by Karolina Surma
Modified: 2024-06-11 13:17 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-06-11 13:17:52 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2024-03-22 13:26:46 UTC
python-jsonformatter fails to build with Python 3.13.0a5.


=================================== FAILURES ===================================
__________________ JsonFormatterTest.test_basic_config_format __________________

self = <test.test_windows.JsonFormatterTest testMethod=test_basic_config_format>

    def test_basic_config_format(self):
>       basicConfig(
            level=logging.INFO,
            format="""{
            "levelname": "levelname",
            "name": "name",
            "log": "message"
            }"""
        )

test/test_windows.py:490: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

kwargs = {'format': '{\n            "levelname": "levelname",\n            "name": "name",\n            "log": "message"\n            }', 'level': 20}

    def basicConfig(**kwargs):
        """
        Do basic configuration for the logging system.
    
        This function does nothing if the root logger already has handlers
        configured. It is a convenience method intended for use by simple scripts
        to do one-shot configuration of the logging package.
    
        The default behaviour is to create a StreamHandler which writes to
        sys.stderr, set a formatter using the BASIC_FORMAT format string, and
        add the handler to the root logger.
    
        A number of optional keyword arguments may be specified, which can alter
        the default behaviour.
    
        filename  Specifies that a FileHandler be created, using the specified
                  filename, rather than a StreamHandler.
        filemode  Specifies the mode to open the file, if filename is specified
                  (if filemode is unspecified, it defaults to 'a').
        format    Use the specified format string for the handler.
        datefmt   Use the specified date/time format.
        style     If a format string is specified, use this to specify the
                  type of format string (possible values '%', '{', '$', for
                  %-formatting, :meth:`str.format` and :class:`string.Template`
                  - defaults to '%').
        level     Set the root logger level to the specified level.
        stream    Use the specified stream to initialize the StreamHandler. Note
                  that this argument is incompatible with 'filename' - if both
                  are present, 'stream' is ignored.
        handlers  If specified, this should be an iterable of already created
                  handlers, which will be added to the root handler. Any handler
                  in the list which does not have a formatter assigned will be
                  assigned the formatter created in this function.
    
        Note that you could specify a stream created using open(filename, mode)
        rather than passing the filename and mode in. However, it should be
        remembered that StreamHandler does not close its stream (since it may be
        using sys.stdout or sys.stderr), whereas FileHandler closes its stream
        when the handler is closed.
    
        .. versionchanged:: 3.2
           Added the ``style`` parameter.
    
        .. versionchanged:: 3.3
           Added the ``handlers`` parameter. A ``ValueError`` is now thrown for
           incompatible arguments (e.g. ``handlers`` specified together with
           ``filename``/``filemode``, or ``filename``/``filemode`` specified
           together with ``stream``, or ``handlers`` specified together with
           ``stream``.
        """
        # Add thread safety in case someone mistakenly calls
        # basicConfig() from multiple threads
>       logging._acquireLock()
E       AttributeError: module 'logging' has no attribute '_acquireLock'

jsonformatter/jsonformatter.py:493: AttributeError
__________________ JsonFormatterTest.test_basic_config_level ___________________

self = <test.test_windows.JsonFormatterTest testMethod=test_basic_config_level>

    def test_basic_config_level(self):
>       basicConfig(level=logging.INFO)

test/test_windows.py:486: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

kwargs = {'level': 20}

    def basicConfig(**kwargs):
        """
        Do basic configuration for the logging system.
    
        This function does nothing if the root logger already has handlers
        configured. It is a convenience method intended for use by simple scripts
        to do one-shot configuration of the logging package.
    
        The default behaviour is to create a StreamHandler which writes to
        sys.stderr, set a formatter using the BASIC_FORMAT format string, and
        add the handler to the root logger.
    
        A number of optional keyword arguments may be specified, which can alter
        the default behaviour.
    
        filename  Specifies that a FileHandler be created, using the specified
                  filename, rather than a StreamHandler.
        filemode  Specifies the mode to open the file, if filename is specified
                  (if filemode is unspecified, it defaults to 'a').
        format    Use the specified format string for the handler.
        datefmt   Use the specified date/time format.
        style     If a format string is specified, use this to specify the
                  type of format string (possible values '%', '{', '$', for
                  %-formatting, :meth:`str.format` and :class:`string.Template`
                  - defaults to '%').
        level     Set the root logger level to the specified level.
        stream    Use the specified stream to initialize the StreamHandler. Note
                  that this argument is incompatible with 'filename' - if both
                  are present, 'stream' is ignored.
        handlers  If specified, this should be an iterable of already created
                  handlers, which will be added to the root handler. Any handler
                  in the list which does not have a formatter assigned will be
                  assigned the formatter created in this function.
    
        Note that you could specify a stream created using open(filename, mode)
        rather than passing the filename and mode in. However, it should be
        remembered that StreamHandler does not close its stream (since it may be
        using sys.stdout or sys.stderr), whereas FileHandler closes its stream
        when the handler is closed.
    
        .. versionchanged:: 3.2
           Added the ``style`` parameter.
    
        .. versionchanged:: 3.3
           Added the ``handlers`` parameter. A ``ValueError`` is now thrown for
           incompatible arguments (e.g. ``handlers`` specified together with
           ``filename``/``filemode``, or ``filename``/``filemode`` specified
           together with ``stream``, or ``handlers`` specified together with
           ``stream``.
        """
        # Add thread safety in case someone mistakenly calls
        # basicConfig() from multiple threads
>       logging._acquireLock()
E       AttributeError: module 'logging' has no attribute '_acquireLock'

jsonformatter/jsonformatter.py:493: AttributeError
=========================== short test summary info ============================
FAILED test/test_windows.py::JsonFormatterTest::test_basic_config_format - At...
FAILED test/test_windows.py::JsonFormatterTest::test_basic_config_level - Att...
========================= 2 failed, 21 passed in 0.06s =========================

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/07197810-python-jsonformatter/

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

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 Mani 2024-04-14 22:41:32 UTC
See https://github.com/python/cpython/pull/109462/files for the change in the logging module.

Comment 2 Sandro Mani 2024-06-11 13:17:52 UTC
Fixed in python-jsonformatter-0.3.2-4.fc41.


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