[Python-bugs-list] Python 1.5.2 bug, tried to post but got error (PR#121)

Guido van Rossum guido@CNRI.Reston.VA.US
Wed, 03 Nov 1999 20:08:11 -0500


> I tried to post a bug, but got this error:
> 
> The system encountered a fatal error 

We were being slammed by a defective spider (or, if you're more
paranoid, by a hacker) so we temporarily turned off the webserver.  It
should be back on now.

> Here's what I said for Python 1.5.2 on Win32 #0
> 
> PyRun_SimpleFile, PyRun_File and other functions that take a FILE * are not 
> usable on WIN32 from non-VC applications because python15.dll is statically 
> linked to the MS runtime DLL. Embedding applications that try to use these 
> functions are passing in FILE * structures that do not match MS's runtime 
> format. 
> 
> For example, I'm using Python in a Borland C++ Builder application. Although I 
> can open a FILE *, when passed to python15.dll the FILE * is not usable.
> 
> The addition of two helper functions would solve this problem:
> 
> FILE * PyRun_OpenFile(char *file, char *mode) 
> {
>   return fopen(file,mode)
> }
> 
> int PyRun_CloseFile(FILE *ptr)
> {
>   return fclose(ptr)
> }
> 
> This way embedding apps could get python15.dll to open the file and it would 
> work.
> 
> A temporary workaround is to always load the .pyc file in PyRun_SimpleFile..

This is an elegant solution.  I think I'll add it.

Could you mail me your suggestion again with the legal boilerplate
included?  See http://www.python.org/1.5/bugrelease.html for the text
and explanation.  Our lawyers require that I request this silliness...

--Guido van Rossum (home page: http://www.python.org/~guido/)