[issue42733] io's r+ mode truncate(0)

2020-12-28 Thread

施文峰  added the comment:

hi Terry

you are right
i download python version 3.0.1 to check this case

'''
Python 3.0.1 (r301:69556, Dec 28 2020, 14:14:02) 
[GCC 7.5.0] on linux5
Type "help", "copyright", "credits" or "license" for more information.
>>> from test_case import test
[43552 refs]
>>> test()
beginning tell 0
tell after read 32
tell after delete content 0
tell after write 32
[52665 refs]
>>> 

'''

--

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



[issue42733] [issue] io's r+ mode truncate(0)

2020-12-25 Thread

施文峰  added the comment:

hi Steven

thanks for check my post

first test have a problem,you didn’t use r+ mode
step is 
1. f.read
2. f.truncate(0)
3. f.write(something)

my test msg tell you

“
tell after delete content 33
content 0 
tell after write 65
“

so you know after truncate f.tell =33
but no content in file
and after you write something into file
msg tell you f.tell =65
but “ {"how_dare_you": "how_dare_you"}” is only 33 length 
so you know must have someing in file

please use editor open the file
you will find it

--

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



[issue42733] [issue] io's r+ mode truncate(0)

2020-12-24 Thread

New submission from 施文峰 :

happen at io's reading & updating(r+) mode
after read,
file object's postion stay in last if you remove whole content ( truncate(0) ),
postion wil not back to 0 still stay in the last
then you start writing from last position(not 0)
that's why problem happen

test case can check here https://github.com/841020/open_source

--
components: IO
files: Screenshot from 2020-12-25 10-46-42.png
hgrepos: 396
messages: 383710
nosy: ke265379ke
priority: normal
severity: normal
status: open
title: [issue] io's r+ mode truncate(0)
type: enhancement
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49697/Screenshot from 2020-12-25 
10-46-42.png

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



[issue41441] io reading & updating fix

2020-07-30 Thread

Change by 施文峰 :


--
pull_requests: +20837
pull_request: https://github.com/python/cpython/pull/21686

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



[issue41441] io reading & updating fix

2020-07-30 Thread

Change by 施文峰 :


--
pull_requests:  -20829

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



[issue41441] io reading & updating fix

2020-07-30 Thread

Change by 施文峰 :


--
stage: patch review -> resolved
status: open -> closed

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



[issue41441] io reading & updating fix

2020-07-30 Thread

施文峰  added the comment:

Please refer to the test case-  https://github.com/841020/open_source

--

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



[issue41441] io reading & updating fix

2020-07-30 Thread

Change by 施文峰 :


--
resolution:  -> fixed

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



[issue41441] io reading & updating fix

2020-07-30 Thread

New submission from 施文峰 :

happen at io's reading & updating(r+) mode
if you remove whole content ( truncate(0) ), tell wil not back to 0
then you start writing will start at current position
that's why problem happen

--

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



[issue41441] io reading & updating fix

2020-07-30 Thread

Change by 施文峰 :


--
keywords: +patch
pull_requests: +20829
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21686

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



[issue41441] io reading & updating fix

2020-07-30 Thread

Change by 施文峰 :


--
components: IO
nosy: ke265379ke
priority: normal
severity: normal
status: open
title: io  reading & updating fix
type: enhancement
versions: Python 3.8

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