[New-bugs-announce] [issue35304] The return of truncate(size=None) (file io) is unexpected
liugang
report at bugs.python.org
Fri Nov 23 14:35:08 EST 2018
New submission from liugang <liugang93 at 163.com>:
-- run in Windows 10
1 -
f = open('test', "w+")
f.write('xxx\nyyy\nzzz')
f.seek(0)
f.readline()
print(f.tell()) # output 5 (xxx\r\n)
x = f.truncate()
print(x) # output 13 (xxx\r\nyyy\r\nzzz), why it is 13, not 5?
2 -
f = open('test', "w+")
f.write('xxx\nyyy\nzzz')
f.seek(0)
f.readline()
print(f.tell()) # output 5 (xxx\r\n)
f.seek(f.tell())
x = f.truncate()
print(x) # output 5
----------
components: IO
messages: 330357
nosy: liugang93
priority: normal
severity: normal
status: open
title: The return of truncate(size=None) (file io) is unexpected
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35304>
_______________________________________
More information about the New-bugs-announce
mailing list