Bug 2290554 - pyinstrument fails to build with Python 3.13: AssertionError in test_frame_info_with_classes and test_class_methods
Summary: pyinstrument fails to build with Python 3.13: AssertionError in test_frame_in...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: pyinstrument
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Zbigniew Jędrzejewski-Szmek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2024-06-05 14:12 UTC by Karolina Surma
Modified: 2024-06-16 10:27 UTC (History)
3 users (show)

Fixed In Version: pyinstrument-4.6.2-2.fc41
Clone Of:
Environment:
Last Closed: 2024-06-16 10:27:44 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2024-06-05 14:12:45 UTC
pyinstrument fails to build with Python 3.13.0b1.

=================================== FAILURES ===================================
______________________________ test_class_methods ______________________________

    def test_class_methods():
        profiler = Profiler()
    
        with fake_time():
            profiler.start()
    
            obj = ClassWithMethods()
            obj.long_method()
            obj.long_class_method()
            obj.long_static_method()
            partial(obj.long_method)()
    
            profiler.stop()
    
        text_output = profiler.output_text()
        print(text_output)
    
        # output should be something like:
        # 1.000 test_class_methods  test/test_profiler.py:124
        # |- 0.500 ClassWithMethods.long_method  test/test_profiler.py:29
        # |  `- 0.500 FakeClock.sleep  test/fake_time_util.py:19
        # |- 0.250 ClassWithMethods.long_class_method  test/test_profiler.py:36
        # |  `- 0.250 FakeClock.sleep  test/fake_time_util.py:19
        # `- 0.250 long_static_method  test/test_profiler.py:32
        #    `- 0.250 FakeClock.sleep  test/fake_time_util.py:19
>       assert text_output.count("0.500 ClassWithMethods.long_method") == 1
E       assert 0 == 1
E        +  where 0 = <built-in method count of str object at 0x55c2005bcf50>('0.500 ClassWithMethods.long_method')
E        +    where <built-in method count of str object at 0x55c2005bcf50> = "\n  _     ._   __/__   _ _  _  _ _/_   Recorded: 12:04:59  Samples:  4\n /_//_/// /_\\ / //_// / //_'/ //     Duration: 0.000     CPU time: 0.000\n/   _/                      v4.4.0\n\nProgram: /usr/bin/pytest -v test/ --deselect=test/test_profiler_async.py::test_greenlet --deselect=test/test_profiler_async.py::test_strict_with_greenlet --deselect=test/test_cmdline.py::TestCommandLine::test_script_execution_details[pyinstrument_invocation0] --deselect=test/test_cmdline.py::TestCommandLine::test_path_execution_details[pyinstrument_invocation0]\n\n1.000 test_class_methods  test/test_profiler.py:126\n|- 0.500 long_method  test/test_profiler.py:31\n|  `- 0.500 sleep  test/fake_time_util.py:19\n|- 0.250 long_class_method  test/test_profiler.py:38\n|  `- 0.250 sleep  test/fake_time_util.py:19\n`- 0.250 long_static_method  test/test_profiler.py:34\n   `- 0.250 sleep  test/fake_time_util.py:19\n\n".count

test/test_profiler.py:151: AssertionError
----------------------------- Captured stdout call -----------------------------

  _     ._   __/__   _ _  _  _ _/_   Recorded: 12:04:59  Samples:  4
 /_//_/// /_\ / //_// / //_'/ //     Duration: 0.000     CPU time: 0.000
/   _/                      v4.4.0

Program: /usr/bin/pytest -v test/ --deselect=test/test_profiler_async.py::test_greenlet --deselect=test/test_profiler_async.py::test_strict_with_greenlet --deselect=test/test_cmdline.py::TestCommandLine::test_script_execution_details[pyinstrument_invocation0] --deselect=test/test_cmdline.py::TestCommandLine::test_path_execution_details[pyinstrument_invocation0]

1.000 test_class_methods  test/test_profiler.py:126
|- 0.500 long_method  test/test_profiler.py:31
|  `- 0.500 sleep  test/fake_time_util.py:19
|- 0.250 long_class_method  test/test_profiler.py:38
|  `- 0.250 sleep  test/fake_time_util.py:19
`- 0.250 long_static_method  test/test_profiler.py:34
   `- 0.250 sleep  test/fake_time_util.py:19


_________________________ test_frame_info_with_classes _________________________

    def test_frame_info_with_classes():
        instance = AClass()
    
        test_functions = [
            instance.get_frame_info_for_a_method,
            AClass.get_frame_info_for_a_class_method,
            instance.get_frame_info_with_cell_variable,
        ]
    
        for test_function in test_functions:
            c_frame_info = test_function(stat_profile_c.get_frame_info)
            py_frame_info = test_function(stat_profile_python.get_frame_info)
    
>           assert c_frame_info == py_frame_info
E           AssertionError: assert 'get_frame_in...y\x008\x01l11' == 'get_frame_in...AClass\x01l11'
E             - get_frame_info_for_a_method�/builddir/build/BUILD/pyinstrument-4.4.0-build/pyinstrument-4.4.0/test/low_level/test_frame_info.py�8cAClassl11
E             ?                                                                                                                                   --------
E             + get_frame_info_for_a_method�/builddir/build/BUILD/pyinstrument-4.4.0-build/pyinstrument-4.4.0/test/low_level/test_frame_info.py�8l11

test/low_level/test_frame_info.py:75: AssertionError
=========================== short test summary info ============================
FAILED test/test_profiler.py::test_class_methods - assert 0 == 1
FAILED test/low_level/test_frame_info.py::test_frame_info_with_classes - Asse...
============ 2 failed, 69 passed, 2 skipped, 4 deselected in 12.09s ============

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-b1/fedora-rawhide-x86_64/07532237-pyinstrument/

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

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-b1/

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.


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