Skip to content

gdb events are imported incorrectly #11208

Closed
@disconnect3d

Description

@disconnect3d

Hi,

There is an issue with gdb/events.pyi being imported incorrectly. The gdb-stubs/__init__.pyi file should do an from .events import * because the gdb module should see the gdb.NewObjFileEvent type.

Without this, for a simple file like this:

# cat x.py
import gdb

x: gdb.NewObjFileEvent = 1

We get the following issue:

# ./.venv/bin/python3 -m mypy x.py
x.py:3: error: Name "gdb.NewObjFileEvent" is not defined  [name-defined]
    x: gdb.NewObjFileEvent = 1
       ^
Found 1 error in 1 file (checked 1 source file)

Which should not be there.

Here are the versions I tested this on:

# ./.venv/bin/python3 -m pip freeze | egrep -e 'types-gdb|mypy'
mypy==1.3.0
mypy-extensions==1.0.0
types-gdb==12.1.4.5

And here is a proof that this type should be available from the gdb module:

# gdb --quiet --nx --batch --ex 'pi import gdb; print(gdb.NewObjFileEvent)'
<class 'gdb.NewObjFileEvent'>

And here is the GDB version I tested this on:

# gdb --version
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions