Author andreymal
Recipients andreymal
Date 2017-12-05.23:19:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1512515954.76.0.213398074469.issue32228@psf.upfronthosting.co.za>
In-reply-to
Content
See attached file.

As documentation about "truncate" says, "The current stream position isn’t changed." This is true for most cases. But this is not true for "wtf1.py" example. If you run it with Linux (Tested Debian 8 and Arch; Windows was not tested by me) and Python 3.3+ (or with Python 2.7 using backported "io" module), then these lines:

print('tell:', fp.tell())
print('truncate:', fp.truncate())
print('tell again:', fp.tell())

prints this:

tell: 4098
truncate: 4098
tell again: 4

As you can see, "tell" before truncate and "tell" after truncate are different. Looks like bug.

This bug will not reproduce with Python 2.7 and builtin "open" function; it affects only "io.open".
History
Date User Action Args
2017-12-05 23:19:14andreymalsetrecipients: + andreymal
2017-12-05 23:19:14andreymalsetmessageid: <1512515954.76.0.213398074469.issue32228@psf.upfronthosting.co.za>
2017-12-05 23:19:14andreymallinkissue32228 messages
2017-12-05 23:19:14andreymalcreate