New submission from Christian Biesinger <cbiesin...@google.com>:

Because FILE* requires that the runtime library matches between Python and a 
program using it, it is very hard to use this correctly on Windows. It would be 
nice if Python provided either:

- A function to open a FILE* given a filename, suitable for passing to the 
various PyRun_* functions, or
- Versions of the functions that take a filename and internally open the file

(ref: https://docs.python.org/3.9/c-api/veryhigh.html, which talks about this 
but provides no useful guidance:
"One particular issue which needs to be handled carefully is that the FILE 
structure for different C libraries can be different and incompatible. Under 
Windows (at least), it is possible for dynamically linked extensions to 
actually use different libraries, so care should be taken that FILE* parameters 
are only passed to these functions if it is certain that they were created by 
the same library that the Python runtime is using."
)

----------
components: Windows
messages: 349598
nosy: cbiesinger, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: PyRun_SimpleFile should provide a version that does not need a FILE*
type: crash
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37844>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to