Bug 2365643 - python-pudb fails to build with Python 3.14: ImportError: cannot import name 'format_exception' from 'pudb.lowlevel'
Summary: python-pudb fails to build with Python 3.14: ImportError: cannot import name ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pudb
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lumír Balhar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2372046 (view as bug list)
Depends On:
Blocks: PYTHON3.14 F43FTBFS F43FailsToInstall 2372122
TreeView+ depends on / blocked
 
Reported: 2025-05-12 14:59 UTC by Karolina Surma
Modified: 2025-06-19 12:47 UTC (History)
6 users (show)

Fixed In Version: python-pudb-2025.1-4.fc43
Clone Of:
Environment:
Last Closed: 2025-06-19 12:47:01 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources python-pudb pull-request 15 0 None None None 2025-06-18 09:48:23 UTC
Github inducer pudb issues 684 0 None open Compatibility with Python 3.14 2025-05-12 20:31:41 UTC

Description Karolina Surma 2025-05-12 14:59:02 UTC
python-pudb fails to build with Python 3.14.0b1.

__________________ TestFileSourceCodeProvider.test_get_lines ___________________

self = <pudb.debugger.FileSourceCodeProvider object at 0x7fe9af9d4cd0>
debugger_ui = <MagicMock id='140641643120016'>

    def get_lines(self, debugger_ui):
        from pudb.source_view import SourceLine, format_source
    
        if self.file_name == "<string>":
            return [SourceLine(debugger_ui, self.file_name)]
    
        breakpoints = debugger_ui.debugger.get_file_breaks(self.file_name)[:]
        breakpoints = [lineno for lineno in breakpoints if
            any(bp.enabled
                for bp in debugger_ui.debugger.get_breaks(self.file_name, lineno))]
        breakpoints += [i for f, i in debugger_ui.debugger.set_traces if f
            == self.file_name and debugger_ui.debugger.set_traces[f, i]]
        try:
            from linecache import getlines
>           lines = getlines(self.file_name)

pudb/debugger.py:725: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.14/linecache.py:42: in getlines
    return updatecache(filename, module_globals)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

filename = <Mock name='mock.canonic()' id='140641643119680'>
module_globals = None

    def updatecache(filename, module_globals=None):
        """Update a cache entry and return its list of lines.
        If something's wrong, print a message, discard the cache entry,
        and return an empty list."""
    
        # These imports are not at top level because linecache is in the critical
        # path of the interpreter startup and importing os and sys take a lot of time
        # and slows down the startup sequence.
        try:
            import os
            import sys
            import tokenize
        except ImportError:
            # These import can fail if the interpreter is shutting down
            return []
    
        if filename in cache:
            if len(cache[filename]) != 1:
                cache.pop(filename, None)
        if _source_unavailable(filename):
            return []
    
        if filename.startswith('<frozen ') and module_globals is not None:
            # This is a frozen module, so we need to use the filename
            # from the module globals.
            fullname = module_globals.get('__file__')
            if fullname is None:
                return []
        else:
            fullname = filename
        try:
>           stat = os.stat(fullname)
E           TypeError: stat: path should be string, bytes, os.PathLike or integer, not Mock

/usr/lib64/python3.14/linecache.py:143: TypeError

During handling of the above exception, another exception occurred:

self = <pudb.test.test_source_code_providers.TestFileSourceCodeProvider object at 0x7fe9af3c4550>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fe9af8d0250>

    def test_get_lines(self, mocker):
        provider = FileSourceCodeProvider(mocker.Mock(), "test file name")
>       result = provider.get_lines(mocker.MagicMock())

pudb/test/test_source_code_providers.py:30: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pudb.debugger.FileSourceCodeProvider object at 0x7fe9af9d4cd0>
debugger_ui = <MagicMock id='140641643120016'>

    def get_lines(self, debugger_ui):
        from pudb.source_view import SourceLine, format_source
    
        if self.file_name == "<string>":
            return [SourceLine(debugger_ui, self.file_name)]
    
        breakpoints = debugger_ui.debugger.get_file_breaks(self.file_name)[:]
        breakpoints = [lineno for lineno in breakpoints if
            any(bp.enabled
                for bp in debugger_ui.debugger.get_breaks(self.file_name, lineno))]
        breakpoints += [i for f, i in debugger_ui.debugger.set_traces if f
            == self.file_name and debugger_ui.debugger.set_traces[f, i]]
        try:
            from linecache import getlines
            lines = getlines(self.file_name)
            return format_source(
                    debugger_ui, list(decode_lines(lines)), set(breakpoints))
        except Exception:
>           from pudb.lowlevel import format_exception
E           ImportError: cannot import name 'format_exception' from 'pudb.lowlevel' (/builddir/build/BUILD/python-pudb-2025.1-build/pudb-2025.1/pudb/lowlevel.py)

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-b1/fedora-rawhide-x86_64/09023741-python-pudb/

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

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

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 Karolina Surma 2025-06-11 16:01:58 UTC
*** Bug 2372046 has been marked as a duplicate of this bug. ***

Comment 2 Fedora Update System 2025-06-19 12:44:01 UTC
FEDORA-2025-24f4f96a5e (python-pudb-2025.1-4.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-24f4f96a5e

Comment 3 Fedora Update System 2025-06-19 12:47:01 UTC
FEDORA-2025-24f4f96a5e (python-pudb-2025.1-4.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.


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