msg164142 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2012-06-27 10:29 |
Since Python 2.3 many open functions supports "Universal line mode" (PEP 278). Since 3.0 (and 2.6) PEP 3116 suggests better alternative -- io.TextWrapper.
Now support for the 'U' mode in the different open functions is heterogeneous. Some functions simply ignore the 'U' mode (but accept it), others perceive it as a synonym for text-mode, others just pass it on lower lever, other attempt to implement it, but the implementation is obtained imperfect and contradictory (as in ZipExtFile). The documentation for built-in open does not advise the use of the 'U' mode. The 'U' mode support cumbersome. I propose to deprecate the 'U' mode. If someone wanted to work with the universal line support, he'll surely need to work with encodings too, and io.TextWrapper provides is better choise.
The deprecation plan for the 'U' mode of open functions might be as follow:
3.3. Deprecating the 'U' mode in docs for all opens (building open, io.open, codecs.open, gzip.open, ZipFile.open, etc). Add suggestion about io.TextWrapper.
3.4. Raise a warning on use of the 'U' mode.
3.5. Raise an exception on use of the 'U' mode.
3.6 (or 4.0?). Remove the 'U' mode processing code.
As the first stage involves only the changes to the documentation, I hope deprecation can starts in 3.3.
|
msg164144 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2012-06-27 10:50 |
Related issues: #2091, #5148, #6759, #12900.
|
msg164145 - (view) |
Author: Antoine Pitrou (pitrou) * |
Date: 2012-06-27 10:53 |
Starting to deprecate "U" in the 3.3 docs sounds reasonable to me.
|
msg164153 - (view) |
Author: R. David Murray (r.david.murray) * |
Date: 2012-06-27 13:31 |
Unless there are places where it is actually broken, I don't think there is a good reason to have step 3.5, though. Just add the deprecation warning and remove it in 4.0.
|
msg164232 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2012-06-28 09:30 |
> Unless there are places where it is actually broken, I don't think there is a good reason to have step 3.5, though. Just add the deprecation warning and remove it in 4.0.
Well. In any case, the 'U' mode in most cases has no effect, and the
code, where it has an effect (in zipfile), is very rarely used (and it
is actually complicated and broken).
Here are the patches for the first (documentation) and the second stage
(warnings).
|
msg164296 - (view) |
Author: Nadeem Vawda (nadeem.vawda) * |
Date: 2012-06-28 21:28 |
+1 for the general idea of deprecating and eventually removing the "U"
modes.
But I agree with David, that it doesn't make sense to have separate steps
for 3.5 and 3.6/4.0. If you make the code raise an exception when "U" is
used, how is that different from what will happen when you remove the
code for processing it? Surely we want it to eventually be treated just
like any other invalid mode string?
|
msg168247 - (view) |
Author: Raymond Hettinger (rhettinger) * |
Date: 2012-08-15 00:41 |
The only people affected by deprecating "U" are the people who are currently using it for some reason -- presumably they are expecting that it does something useful for their code.
Ideally, this proposed deprecation should be mentioned on python-dev so that those folks will have an opportunity to respond.
|
msg171546 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2012-09-28 21:59 |
> Ideally, this proposed deprecation should be mentioned on python-dev so that those folks will have an opportunity to respond.
http://comments.gmane.org/gmane.comp.python.devel/134996
|
msg171547 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2012-09-28 22:02 |
Chris, you did a great job on improving the documentation (including about universal newlines). Can you help with this issue?
For the first stage should be clearly shown that "U" mode is not only should not be used in new code, but must be removed from the old code.
Stage 1 patch updated to resolve conflicts with Chris changes.
|
msg171549 - (view) |
Author: Chris Jerdonek (chris.jerdonek) * |
Date: 2012-09-28 23:28 |
Thanks, Serhiy. :) Sure, I should be able to help with the documentation portion of this issue if the community is in agreement. Would the deprecation need to be moved up to 3.4 though now?
|
msg179190 - (view) |
Author: Antoine Pitrou (pitrou) * |
Date: 2013-01-06 15:48 |
> Would the deprecation need to be moved up to 3.4 though now?
Yes, I think so.
|
msg195865 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2013-08-22 07:27 |
Here is an updated patch. I think we can combine 1 and 2 stages (change the documentation and add warnings).
|
msg195875 - (view) |
Author: Vajrasky Kok (vajrasky) * |
Date: 2013-08-22 09:50 |
http://bugs.python.org/review/15204/diff/9032/Tools/iobench/iobench.py
Line 10 in New:
import io
But io module is never used.
|
msg203421 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2013-11-19 20:38 |
Could anyone please review the patch?
|
msg203432 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2013-11-19 21:58 |
Updated patch addresses Victor's comments.
|
msg204081 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2013-11-23 19:47 |
Updated patch addresses Ezio's comments.
|
msg204092 - (view) |
Author: Roundup Robot (python-dev) |
Date: 2013-11-23 20:13 |
New changeset 70bd6f7e013b by Serhiy Storchaka in branch 'default':
Issue #15204: Deprecated the 'U' mode in file-like objects.
http://hg.python.org/cpython/rev/70bd6f7e013b
|
msg204094 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2013-11-23 20:14 |
Thanks Victor and Ezio for the reviews.
|
msg204269 - (view) |
Author: Roundup Robot (python-dev) |
Date: 2013-11-24 21:13 |
New changeset 694e2708b4a8 by Serhiy Storchaka in branch 'default':
Issue #15204: Silence and check the 'U' mode deprecation warnings in tests.
http://hg.python.org/cpython/rev/694e2708b4a8
|
msg213002 - (view) |
Author: Roundup Robot (python-dev) |
Date: 2014-03-10 01:35 |
New changeset 2d5544afb510 by R David Murray in branch 'default':
whatsnew: 'U' mode deprecation (#15204).
http://hg.python.org/cpython/rev/2d5544afb510
|
msg229527 - (view) |
Author: Василий Макаров (Василий.Макаров) |
Date: 2014-10-16 12:53 |
open() documentation is probably broken a little now. Here is what one can see at the end of open() description:
"...
Deprecated since version 3.4, will be removed in version 4.0.
The 'U' mode."
Reader may assume open() function is what will be removed. Which is frightening :)
|
msg229693 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2014-10-19 20:20 |
Please open new issue for this.
|
|
Date |
User |
Action |
Args |
2022-04-11 14:57:32 | admin | set | github: 59409 |
2014-10-19 20:20:15 | serhiy.storchaka | set | messages:
+ msg229693 |
2014-10-16 12:53:09 | Василий.Макаров | set | nosy:
+ Василий.Макаров messages:
+ msg229527
|
2014-03-10 01:35:01 | python-dev | set | messages:
+ msg213002 |
2013-11-24 21:15:30 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
2013-11-24 21:13:49 | python-dev | set | messages:
+ msg204269 |
2013-11-23 20:14:27 | serhiy.storchaka | set | messages:
+ msg204094 |
2013-11-23 20:13:13 | python-dev | set | nosy:
+ python-dev messages:
+ msg204092
|
2013-11-23 19:47:20 | serhiy.storchaka | set | files:
+ deprecate-U-mode_3.patch
messages:
+ msg204081 |
2013-11-20 22:39:38 | martin.panter | set | nosy:
+ martin.panter
|
2013-11-20 07:50:58 | serhiy.storchaka | set | files:
- deprecate-U-mode-stage1_2.patch |
2013-11-20 07:49:59 | serhiy.storchaka | set | files:
- deprecate-U-mode-stage2.patch |
2013-11-19 21:58:11 | serhiy.storchaka | set | files:
+ deprecate-U-mode_2.patch
messages:
+ msg203432 |
2013-11-19 21:22:45 | gvanrossum | set | nosy:
- gvanrossum, jackjansen
|
2013-11-19 20:38:36 | serhiy.storchaka | set | messages:
+ msg203421 |
2013-08-22 09:50:50 | vajrasky | set | nosy:
+ vajrasky messages:
+ msg195875
|
2013-08-22 07:27:08 | serhiy.storchaka | set | files:
+ deprecate-U-mode.patch
messages:
+ msg195865 |
2013-01-06 15:48:26 | pitrou | set | messages:
+ msg179190 versions:
- Python 3.3 |
2013-01-06 05:27:15 | ezio.melotti | set | stage: patch review versions:
+ Python 3.4 |
2012-09-28 23:28:52 | chris.jerdonek | set | messages:
+ msg171549 |
2012-09-28 22:03:00 | serhiy.storchaka | set | files:
- deprecate-U-mode-stage1.patch |
2012-09-28 22:02:50 | serhiy.storchaka | set | files:
+ deprecate-U-mode-stage1_2.patch
messages:
+ msg171547 |
2012-09-28 21:59:28 | serhiy.storchaka | set | messages:
+ msg171546 |
2012-08-15 00:41:15 | rhettinger | set | nosy:
+ rhettinger messages:
+ msg168247
|
2012-08-14 16:01:23 | asvetlov | set | nosy:
+ asvetlov
|
2012-08-03 08:24:06 | chris.jerdonek | set | nosy:
+ chris.jerdonek
|
2012-06-28 21:28:35 | nadeem.vawda | set | messages:
+ msg164296 |
2012-06-28 09:32:47 | serhiy.storchaka | set | files:
+ deprecate-U-mode-stage2.patch |
2012-06-28 09:32:08 | serhiy.storchaka | set | files:
+ deprecate-U-mode-stage1.patch keywords:
+ patch |
2012-06-28 09:30:28 | serhiy.storchaka | set | messages:
+ msg164232 |
2012-06-27 15:52:50 | Arfrever | set | nosy:
+ Arfrever
|
2012-06-27 13:31:01 | r.david.murray | set | nosy:
+ r.david.murray messages:
+ msg164153
|
2012-06-27 10:53:21 | pitrou | set | nosy:
+ georg.brandl, nadeem.vawda messages:
+ msg164145
|
2012-06-27 10:50:57 | serhiy.storchaka | set | messages:
+ msg164144 |
2012-06-27 10:32:30 | serhiy.storchaka | set | nosy:
+ gvanrossum, jackjansen, pitrou, stutzbach
|
2012-06-27 10:29:50 | serhiy.storchaka | create | |