[PATCH v4] Make GDB compile with Python 3 on MinGW
Simon Marchi
simark@simark.ca
Thu Aug 22 22:24:00 GMT 2019
On 2019-08-15 2:49 p.m., Christian Biesinger via gdb-patches wrote:
> PyFile_FromString and PyFile_AsFile have been removed in Python 3.
> There is no obvious replacement that works here, and we can't just
> pass our FILE* to a DLL in Windows because it may use a different
> C runtime.
>
> So we just call a Python function which reads and executes file
> contents. Care must be taken to execute it in the context of
> __main__.
>
> Tested by inverting the ifdef and running the testsuite on Debian
> Linux (even without the patch, I failed at running the testsuite
> on Windows). I did test with both Python 2 and 3.
>
> gdb/ChangeLog:
>
> 2019-08-13 Christian Biesinger <cbiesinger@google.com>
>
> * python/lib/gdb/__init__.py: Add an execute_file function.
This can be written as:
* python/lib/gdb/__init__.py (_execute_file): New function.
> * python/python.c (python_run_simple_file): Call gdb.execute_file
> on Windows.
Please update "execute_file" to "_execute_file" in both entries.
The patch LGTM with this fixed.
Thanks,
Simon
More information about the Gdb-patches
mailing list