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.

classification
Title: Deprecate pyio
Type: enhancement Stage: resolved
Components: Versions: Python 3.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, brett.cannon, larry, pitrou, vstinner
Priority: normal Keywords:

Created on 2013-12-13 11:41 by larry, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (13)
msg206060 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-12-13 11:41
Does it make sense to finally deprecate pyio, so we can eventually delete it?
msg206061 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-12-13 11:44
I like the _pyio module! It's useful to test some new features.

For example, I'm using it to identify where a file is destroyed without being closed (get where the object was created):
https://bitbucket.org/haypo/misc/src/tip/python/res_warn.py

I didn't find how to implement that using the C module.

It's name is "_pyio", not "pyio". It is a private module.

It was also written to provide a working and well tested pure Python implementation for other Python virtual machines like PyPy, IronPython and Jython.
msg206063 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-12-13 11:49
Larry, I think Brett won't like you.
(have you read PEP 399?)
msg206064 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-12-13 11:51
I hadn't!  I guess we're signed up to maintain two implementations of a bunch of things for eternity, then.
msg206083 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-12-13 13:50
Only if we keep the C version around do we have to care about two versions. =)
msg206087 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-12-13 14:07
We tried a pure python implementation of io once.  Didn't go so well.  :p
msg206088 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-12-13 14:09
> We tried a pure python implementation of io once.  Didn't go so well.  :p

It is _pyio.

Note: _pyio is not 100% *pure* Python, it relies on FileIO which is implemented in C. I always found this surprising. One day I will maybe rewrite it using os.read() and os.write() :-)
msg206089 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-12-13 14:11
> Note: _pyio is not 100% *pure* Python, it relies on FileIO which is
> implemented in C. I always found this surprising. One day I will maybe
> rewrite it using os.read() and os.write() :-)

Then you need to rewrite os.read() and os.write() in pure Python!
msg206090 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-12-13 14:24
Key point is it didn't go so well **for us**; works fine for PyPy.
msg206092 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2013-12-13 14:32
PyPy also has a "C-translated" version of the io module.
It's a bit faster I think, but more importantly it has correct behavior with signals and other asynchronous errors.

_pyio.py can be stopped in the middle of any function, and is not completely signal-safe.
msg206097 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-12-13 15:42
Then if Jython and IronPython are not using _pyio we can probably remove the file.
msg206099 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-12-13 15:47
> Then if Jython and IronPython are not using _pyio we can probably remove the file.

_pyio can be useful for prototyping. Whether or not other
implementations use it is quite irrelevant IMO.
msg206100 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-12-13 15:49
Yes, but it's a small utility.  If it costs nothing to maintain _pyio then okay.  But if we're spending measurable time on it but it's only a nice-to-have then we should drop it.

(Full disclosure: I have no idea how much work goes into maintaining _pyio.)
History
Date User Action Args
2022-04-11 14:57:55adminsetgithub: 64172
2013-12-13 15:49:19larrysetmessages: + msg206100
2013-12-13 15:47:39pitrousetmessages: + msg206099
2013-12-13 15:42:57brett.cannonsetmessages: + msg206097
2013-12-13 14:32:40amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg206092
2013-12-13 14:24:29brett.cannonsetmessages: + msg206090
2013-12-13 14:11:23pitrousetmessages: + msg206089
2013-12-13 14:09:13vstinnersetmessages: + msg206088
2013-12-13 14:07:47larrysetmessages: + msg206087
2013-12-13 13:50:25brett.cannonsetmessages: + msg206083
2013-12-13 11:51:56larrysetstatus: open -> closed
type: enhancement
messages: + msg206064

resolution: wont fix
stage: resolved
2013-12-13 11:49:32pitrousetnosy: + brett.cannon
messages: + msg206063
2013-12-13 11:44:45vstinnersetnosy: + vstinner
messages: + msg206061
2013-12-13 11:41:35larrysetnosy: + pitrou
2013-12-13 11:41:24larrycreate