[issue32228] truncate() changes tell() result

2017-12-05 Thread andreymal

New submission from andreymal :

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".

--
components: IO
files: wtf1.py
messages: 307698
nosy: andreymal
priority: normal
severity: normal
status: open
title: truncate() changes tell() result
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: https://bugs.python.org/file47321/wtf1.py

___
Python tracker 
<https://bugs.python.org/issue32228>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32228] truncate() changes current stream position

2017-12-05 Thread andreymal

Change by andreymal :


--
title: truncate() changes tell() result -> truncate() changes current stream 
position

___
Python tracker 
<https://bugs.python.org/issue32228>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32228] truncate() changes current stream position

2017-12-05 Thread andreymal

Change by andreymal :


--
type:  -> behavior

___
Python tracker 
<https://bugs.python.org/issue32228>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com