Re: [PATCH v2 4/9] gdb: add new helpers for retrieving a type's fully qualified name

Tom Tromey
2026-03-06T19:46:22Z

>> I think this case can't actually be hit... can it?

> It currently can when you build GDB with python 3.11 for instance with
> --enable-py-limited-api=yes. Unfortunately, I haven't added the logic
> to error when someone requests to build GDB against the limited API,
> but does not have a suitable version of Python. This #error were a
> workaround to provide a meaningful message to the developer in this
> case.

Ah ok, I see.

I guess I was assuming that we'd get an error from "somewhere" (Python I
guess) since gdb would be requesting a limited API with a version newer
than what's available.

> Here is the fix to remove #error macros, and detect the issue at configure time.
> I will split the configure fix from the removal of the #error macros in the next revision.

> + # The choice of the minimal version for the Python limited API won't be
> + # frozen until the end of the migration.
> + AM_PYTHON_CHECK_VERSION([$python_prog], [3.14], [
> + AC_DEFINE(Py_LIMITED_API, 0x030e0000,
> + [Define if GDB should be built against the Python limited C API.])
> + ],[
> + AC_MSG_ERROR([Python limited API support requires at least Python version 3.14])
> + ])
> fi

Seems reasonable, thanks.

FWIW for a speciality configure option like this, I think it's also fine
to bail out at build time, like just a check and a #error in python-internal.h.
But configure failing is definitely a bit friendlier.

thanks,
Tom