classification
Title: Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10
Type: Stage: resolved
Components: Unicode Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, gvanrossum, jmadden, python-dev, vstinner, xtreak
Priority: normal Keywords: patch

Created on 2020-02-18 11:26 by vstinner, last changed 2021-04-08 23:29 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18545 merged vstinner, 2020-02-18 11:29
PR 18552 merged vstinner, 2020-02-18 16:32
PR 18747 merged vstinner, 2020-03-02 17:04
PR 18748 merged vstinner, 2020-03-02 17:06
PR 18767 merged vstinner, 2020-03-03 15:20
PR 18776 merged vstinner, 2020-03-04 13:43
PR 25280 closed python-dev, 2021-04-08 16:05
PR 25281 merged python-dev, 2021-04-08 16:05
Messages (13)
msg362196 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-18 11:26
Following discussion on python-dev, I propose to revert the removal of a few deprecated functions to keep them in Python 3.9, and only remove them in Python 3.10. Please see the following email for the longer rationale, and the discussion for further details:

https://mail.python.org/archives/list/python-dev@python.org/thread/EYLXCGGJOUMZSE5X35ILW3UNTJM3MCRE/

With Python 3.8, it was possible to have a single code base working on Python 2.7 and 3.8. Some functions emits DeprecationWarning, but these warnings are ignored (silent) by default. With removed deprecated functions in Python 3.9, *new* code is required to support Python 2.7. The problem is that Python 2.7 is no longer supported. Adding new code to support Python 2.7 sounds painful. Dropping Python 2.7 support isn't free. Projects have to drop Python 2 code, drop CI tests on Python 2, warn users, etc.

The idea is to give maintainers one more year (until Python 3.10) to organize their project to schedule properly the removal of Python 2 support. The first motivation is to ease adoption of Python 3.9.

--

I propose to start with reverting the removal of collections aliases to Abstract Base Classes (ABC) like collections.Mapping alias to collections.abc.Mapping. Removing these aliases is the change which caused most issues when testing Python projects on Python 3.9.

I also propose to modify the What's New In Python 3.9 document to strongly suggest to test your applications with -W default or even -W error to see DeprecationWarning and PendingDeprecationWarning.
msg362220 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-02-18 15:25
Yes please.

I have one exception. I f we manage to get the new parser (pegen) in, we have to remove the old parser module.
msg362222 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-18 15:29
New changeset af5ee3ff610377ef446c2d88bbfcbb3dffaaf0c9 by Victor Stinner in branch 'master':
bpo-39674: Revert "bpo-25988: Do not expose abstract collection classes in the collections module. (GH-10596)" (GH-18545)
https://github.com/python/cpython/commit/af5ee3ff610377ef446c2d88bbfcbb3dffaaf0c9
msg362225 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-18 16:33
PR 18552 adds a section to What's New In Python 3.9 to strongly advice to check for DeprecationWarning in your Python projects.
msg363195 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-02 17:45
Andrew Bartlett of the Samba project asked to revert the removal of the "U" mode:
https://bugs.python.org/issue37330#msg362362

We should consider to revert the removal, and only remove the "U" mode in Python 3.10.
msg363263 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-03 15:12
Another candidate is to revert the ignored "U" mode in open(): commit e471e72977c83664f13d041c78549140c86c92de of bpo-37330.

Removing "U" mode of open() broke 11 packages in Fedora:

* aubio
* openvswitch
* python-SALib
* python-altgraph
* python-apsw
* python-magic-wormhole-mailbox-server
* python-munch
* python-parameterized
* python-pylibmc
* python-sphinx-testing
* veusz

Keeping "U" mode in Python 3.9 is also a formal request from Andrew Bartlett of the Samba project: https://bugs.python.org/issue37330#msg362362
msg363276 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-03 16:31
New changeset 91fe4142642286b65c166f7b6e27de16f42b1286 by Victor Stinner in branch 'master':
bpo-39674: Update collections ABC deprecation doc (GH-18747)
https://github.com/python/cpython/commit/91fe4142642286b65c166f7b6e27de16f42b1286
msg363277 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-03 16:31
New changeset 2aa694dd55202eb6d062fdf49c07cf95f8520f2d by Victor Stinner in branch '3.8':
bpo-39674: Update collections ABC deprecation doc (GH-18748)
https://github.com/python/cpython/commit/2aa694dd55202eb6d062fdf49c07cf95f8520f2d
msg363308 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-03 21:52
New changeset 116fd4af7370706d0d99ac7c70541ef965672d4e by Victor Stinner in branch 'master':
bpo-39674: Suggest to test with DeprecationWarning (GH-18552)
https://github.com/python/cpython/commit/116fd4af7370706d0d99ac7c70541ef965672d4e
msg363350 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-04 14:11
New changeset a6d3546d003d9873de0f71b319ad79d203374bf0 by Victor Stinner in branch 'master':
bpo-39674: Fix typo in What's New In Python 3.9 (GH-18776)
https://github.com/python/cpython/commit/a6d3546d003d9873de0f71b319ad79d203374bf0
msg363367 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-04 17:50
New changeset 942f7a2dea2e95a0fa848329565c0d0288d92e47 by Victor Stinner in branch 'master':
bpo-39674: Revert "bpo-37330: open() no longer accept 'U' in file mode (GH-16959)" (GH-18767)
https://github.com/python/cpython/commit/942f7a2dea2e95a0fa848329565c0d0288d92e47
msg367159 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-23 23:04
I close this issue.

So far, it seems like the number of incompatible changes in Python 3.9 is reasonable. If more incompatible changes should be reverted, I suggest to open new issues.
msg390571 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-08 23:29
New changeset 20d56bd41b56023ce9fa3739c0c9aa8be8d48bfa by Markus Gerstel in branch '3.8':
bpo-39674: Fix collections ABC deprecation notice (GH-25281)
https://github.com/python/cpython/commit/20d56bd41b56023ce9fa3739c0c9aa8be8d48bfa
History
Date User Action Args
2021-04-08 23:29:27vstinnersetmessages: + msg390571
2021-04-08 16:05:16python-devsetpull_requests: + pull_request24017
2021-04-08 16:05:03python-devsetnosy: + python-dev

pull_requests: + pull_request24016
2021-04-08 07:22:20ttx11529setnosy: + ezio.melotti

components: + Unicode, - Library (Lib)
versions: + Python 3.10, - Python 3.9
2020-04-23 23:04:03vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg367159

stage: patch review -> resolved
2020-03-04 17:50:25vstinnersetmessages: + msg363367
2020-03-04 14:11:47vstinnersetmessages: + msg363350
2020-03-04 13:43:40vstinnersetpull_requests: + pull_request18133
2020-03-03 21:52:27vstinnersetmessages: + msg363308
2020-03-03 16:31:28vstinnersetmessages: + msg363277
2020-03-03 16:31:18vstinnersetmessages: + msg363276
2020-03-03 15:20:46vstinnersetpull_requests: + pull_request18124
2020-03-03 15:12:26vstinnersetmessages: + msg363263
2020-03-02 17:45:46vstinnersetmessages: + msg363195
2020-03-02 17:06:23vstinnersetpull_requests: + pull_request18103
2020-03-02 17:04:51vstinnersetpull_requests: + pull_request18102
2020-02-18 16:33:19vstinnersetmessages: + msg362225
2020-02-18 16:32:17vstinnersetpull_requests: + pull_request17933
2020-02-18 15:29:01vstinnersetmessages: + msg362222
2020-02-18 15:25:11gvanrossumsetnosy: + gvanrossum
messages: + msg362220
2020-02-18 12:42:35jmaddensetnosy: + jmadden
2020-02-18 11:29:36vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request17922
2020-02-18 11:27:29xtreaksetnosy: + xtreak
2020-02-18 11:26:29vstinnercreate