This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/15600] New: The use of PyFile_FromString and PyFile_AsFile causes build error in _WIN32 - IS_PY3K build


http://sourceware.org/bugzilla/show_bug.cgi?id=15600

            Bug ID: 15600
           Summary: The use of PyFile_FromString and PyFile_AsFile causes
                    build error in _WIN32 - IS_PY3K build
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: gldrayton at gmail dot com

Source file -- gdb/python/python.c
Function -- python_run_simple_file (FILE *file, const char *filename)

The _WIN32 special handling for FILE differences between mingw gdb build and
mvsc build of python dll uses the python2 functions PyFile_FromString and
PyFile_AsFile to have Python create the FILE for gdb so that it uses the msvc
version of FILE.

These functions were deprecated (removed) with Python3 and in fact the Python
io subsystem was reworked. Most PyFile... functions have been removed.

I did some searching and there does not seem to be direct replacements for the
PyFile methods in Python3.  Most re-work solutions suggested importing the new
Python io module and then invoking io.open(), then using the
PyObject_AsFileDescriptor() (still supported in Py3) to get a file descriptor.

This doesn't appear to help in this case since the gdb code can't create a FILE
object that is acceptable to python.

I suspect that if a work-around already requires importing and calling python
code such as io.open(), it may be worth simply running the script in Python by
passing the file name into Python.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]