[issue35928] socket makefile read-write discards received data

2020-10-03 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz
nosy_count: 5.0 -> 6.0
pull_requests: +21538
pull_request: https://github.com/python/cpython/pull/22535

___
Python tracker 

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



[issue35928] socket makefile read-write discards received data

2019-02-15 Thread nr


nr  added the comment:

Added PR 11878, this will pass both this bug report and PR 3918 regression, the 
commit Ammar noted, it is an addition to this change.

--
nosy: +nr

___
Python tracker 

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



[issue35928] socket makefile read-write discards received data

2019-02-15 Thread nr


Change by nr :


--
keywords: +patch
pull_requests: +11912
stage: needs patch -> patch review

___
Python tracker 

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



[issue35928] socket makefile read-write discards received data

2019-02-10 Thread Ammar Askar


Ammar Askar  added the comment:

Recreatable on master as well, also Martin your suspicion seems correct, 
reverting 
https://github.com/python/cpython/commit/23db935bcf258657682e66464bf8512def8af830
 fixes it.

--
nosy: +ammar2, serhiy.storchaka
stage:  -> needs patch
versions: +Python 3.8

___
Python tracker 

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



[issue35928] socket makefile read-write discards received data

2019-02-10 Thread Palle Ravn


Palle Ravn  added the comment:

>>> f = TextIOWrapper(BufferedRWPair(BytesIO(b"Hello\nYou\n"), BytesIO()))
>>> f.readline()
'Hello\n'
>>> f.write(_)
6
>>> f.readline()  # Returns empty string
''

--

___
Python tracker 

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



[issue35928] socket makefile read-write discards received data

2019-02-08 Thread Martin Panter


Martin Panter  added the comment:

Looking over the changelog, my guess (untested) is this is caused by commit 
d6a283b3 for Issue 25862. That change looks like it drops the internal 
TextIOWrapper decoding buffer for each successful write.

I don't have the right version of Python to test with, but I expect this to 
also be broken without using a socket:

>>> f = TextIOWrapper(BufferedRWPair(BytesIO(b"Hello\nYou\n"), BytesIO()))
>>> f.readline()
'Hello\n'
>>> f.write(_)
6
>>> f.readline()  # Does this now return EOF?
'You\n'

--
keywords: +3.6regression
nosy: +martin.panter

___
Python tracker 

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



[issue35928] socket makefile read-write discards received data

2019-02-07 Thread Palle Ravn


New submission from Palle Ravn :

Using socket.makefile in read-write mode had a bug introduced between version 
3.6.6 and 3.6.7. The same bug is present in version 3.7.x.

The below code example will behave very differently between 3.6.6 and 3.6.7. 
It's based on the echo-server example from the docs.

import socket

HOST = '127.0.0.1'
PORT = 0

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST, PORT))

print(f'Waiting for connection on port {s.getsockname()[1]}')
s.listen(1)

conn, addr = s.accept()
print(f'Connected by {addr}')

with conn:
f = conn.makefile(mode='rw')

while True:
m = f.readline()
print(f'msg: {m!r}')

if not m:
exit(0)

f.write(m)
f.flush()


Python 3.6.7:
Sending the string "Hello\nYou\n" will only print "Hello\n" and also only 
return "Hello\n" to the client.
Removing the lines with f.write(m) and f.flush() and both "Hello\n" and "You\n" 
will be returned to the client.
It's like the call to f.write() somehow empties the read buffer.

Python 3.6.6:
Sending "Hello\nYou\n" will return "Hello\n" and "You\n" to the client without 
any modifications to the above code.

--
components: IO
messages: 335017
nosy: pravn
priority: normal
severity: normal
status: open
title: socket makefile read-write discards received data
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

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