[pypy-issue] [issue1097] data loss in file.write()

hm tracker at bugs.pypy.org
Sun Mar 25 01:39:33 CET 2012


New submission from hm <hacman0 at gmail.com>:

http://pypy.org/compat.html mentions that 

open("filename", "w").write("stuff")

will not work as expected because there is no reference counting in pypy.  In fact, that line can cause data loss, as demonstrated in the 
attached file.

$ pypy pypyfile.py 
$ python pypyfile.py
$ cat CPython-output.txt
11111
234
$ cat PyPy-output.txt
11111

# my system:
$ pypy --version
Python 2.7.2 (2346207d99463f299f09f3e151c9d5fa9158f71b, Feb 20 2012, 04:52:48)
[PyPy 1.8.0]
$ uname -mrsv
Darwin 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
$ python --version
Python 2.7.2
# (also ran this on linux/python2.6 with the same results)

----------
files: pypyfile.py
messages: 4135
nosy: hacman, pypy-issue
priority: bug
status: unread
title: data loss in file.write()

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1097>
________________________________________


More information about the pypy-issue mailing list