python regression tests - a monster hammer to keep wine "in check" :)

Hin-Tak Leung hintak_leung at yahoo.co.uk
Sat Jan 17 19:52:50 CST 2009


--- On Sat, 17/1/09, Luke Kenneth Casson Leighton <lkcl at lkcl.net> wrote:

> > but the behaviour of msvcrt wrt crlf is _definitely_
> not right, as it
> > stands, and as a result it completely screws any
> possibility for
> > running python.exe under wine.  completely.  you
> can't have files that
> > you write to, that are different from when they are
> read back.
> 
>  ok .... this turns out to be a _really_ interesting
> edge-case :)
> 
> lkcl at gonzalez:~/src/python2.5-2.5.2$ ./python.exe
> Python 2.5.2 (r252:60911, Jan 16 2009, 22:06:34)
> [gcc-mingw32] on win32
> Type "help", "copyright",
> "credits" or "license" for more
> information.
> >>> f = open("tst", "w")
> >>> f.write("hell\n")
> >>> f.write("back\n")
> >>> f.close()
> >>>
> [80]+  Stopped                 ./python.exe
> lkcl at gonzalez:~/src/python2.5-2.5.2$ more tst
> hell
> back
> lkcl at gonzalez:~/src/python2.5-2.5.2$ %
> ./python.exe
> f = open("tst", "r")
> >>> x = f.readline(5)
> >>> x
> 'hell\r'   <------- wrongggggg
> >>> f.seek(0)
> >>> f.readline()
> 'hell\n'  <-------- ah _ha_.  if you
> don't specify the length to be read....
> >>> f.seek(0)
> >>> f.readline(4)
> 'hell'
> >>> f.readline()
> '\n'
> >>>
> 
> will raise this as a bug, now that there's a known test
> case for it.

But that's as much a problem as mingw, as wine, as usage of python... I am about to go back to fix a bug with ghostscript's ijs interface when compiled with non-MSVC: IJS is a binary protocol (for communicating with non-postscript printer drivers), but if you don't explicitly declare "wb" and "rb", and precise behavior - whether to do \n to \r\n translation - is dependent on both compilers (mingw, msvc, borland) and C runtime (wine or native windows). So if you want it to work correctly, you explicitly declare everything.

I think python supports a wb/rb argument to open()? It is probably your usage of python is wrong here.

The detail is at http://bugs.ghostscript.com/show_bug.cgi?id=688714 , if you are interested


      



More information about the wine-devel mailing list