Skip to content

Re-enable gdb stubtest - #16813

Merged
srittau merged 1 commit into
python:mainfrom
soaring0616:gdb-reenable-stubtest
Nov 15, 2026
Merged

srittau merged 1 commit into
python:mainfrom
soaring0616:gdb-reenable-stubtest

Conversation

@soaring0616

Copy link
Copy Markdown
Contributor

Fixes #15236

The gdb venv is now created with gdb's own Python (the version is queried from gdb and passed to uv venv --python). With that fixed, stubtest reported 71 errors that are unrelated to the venv. I fixed the stubs where they were already wrong for 16.3 (checked against the gdb 16.3 sources) and allowlisted what is new or changed in GDB 17.

I'm happy to split the stub fixes into a separate PR if that's easier to review.

I used Claude for guidance and review; the changes were written by me.

Detailed changes

tests/stubtest_third_party.py

  • Create the gdb venv with the Python version that gdb itself reports (gdb embeds the system Python, 3.14 on ubuntu-latest).
  • Accept two-component gdb versions such as 17.1 in the version check.

stubs/gdb/METADATA.toml

  • Remove skip = true.

stubs/gdb/gdb/__init__.pyi (all present in 16.3)

  • Value: add the missing reflected operators (__rand__, __ror__, __rxor__, __rlshift__, __rrshift__, __rpow__).
  • Add Architecture.void_type(), Block.subblocks, Symbol.domain, RecordAuxiliary and the module-level missing_file_handlers.
  • RecordGap: rename error_code/error_string to reason_code/reason_string, which is what gdb actually exposes.

stubs/gdb/gdb/printing.pyi

  • Add NoOpStringPrinter.

stubs/gdb/gdb/dap/ (all present in 16.3)

  • server.pyi: add DeferredRequest, the missing CancellationHandler and Server methods, call_function_later, export_line and import_line; remove CancellationHandler.starting/done, which exist in neither 16.3 nor 17.1.
  • scopes.pyi: the scope references take and store frameId, not a frame object.
  • events.pyi, startup.pyi, sources.pyi, frames.pyi, launch.pyi: add missing parameters, defaults and definitions.

stubs/gdb/@tests/stubtest_allowlist.txt

  • Remove 8 entries that are no longer needed.
  • Allowlist the differences between the 16.3 stubs and GDB 17.1, which is what the runner installs (15 additions, 3 removals/changes). These entries depend on the runner's gdb version and will need updating when it changes or when the stubs are updated to 17.
  • Allowlist two modules without stubs (gdb.dap.globalvars, gdb.ptwrite) and a few internal helpers.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@soaring0616

Copy link
Copy Markdown
Contributor Author

I've checked the failing check. The only failing check is "stubsabot: dry run", which hit a GitHub API rate limit (403) on an unrelated package (braintree). It doesn't seem related to this change.

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@srittau
srittau merged commit 7598a40 into python:main Nov 15, 2026
100 of 101 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-enable gdb stubtest

2 participants