homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients martin.panter, python-dev, vstinner, yselivanov
Date 2016年10月18日.23:40:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1476834024.04.0.722890120919.issue26685@psf.upfronthosting.co.za>
In-reply-to
Content
Another example: some asyncio (run with uvloop) code:
 
 conn, _ = lsock.accept()
 f = loop.create_task(
 loop.connect_accepted_socket(
 proto_factory, conn))
 # More code
 loop.run_forever()
 conn.close()
Suppose the above snippet of code is some real-world program.
Now, in Python 3.5 everything works as expected. In Python 3.6, "conn.close()" will raise an exception.
Why: uvloop passes the FD of "conn" to libuv, which does its thing and closes the connection when it should be closed.
Now:
> 1. Your code should call sock0.detach() rather than fileno(), so that sock0 no longer "owns" the file descriptor, or
I can't modify "connect_accepted_socket" to call "detach" on "conn", as it would make "conn" unusable right after the call. This option can't be implemented, as it would break the backwards compatibility.
> 2. libuv should not close file descriptors that it doesn’t own.
This is not just about uvloop/libuv. It's about any Python program out there that will break in 3.6. A lot of code extracts the FD out of socket objects and does something with it. We can't just make socket.close() to raise in 3.6 -- that's not how backwards compatibility promise works.
Guido, what do you think about this issue?
History
Date User Action Args
2016年10月18日 23:40:24yselivanovsetrecipients: + yselivanov, vstinner, python-dev, martin.panter
2016年10月18日 23:40:24yselivanovsetmessageid: <1476834024.04.0.722890120919.issue26685@psf.upfronthosting.co.za>
2016年10月18日 23:40:24yselivanovlinkissue26685 messages
2016年10月18日 23:40:23yselivanovcreate

AltStyle によって変換されたページ (->オリジナル) /