| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,9 +9,7 @@ | |||
| 9 | 9 | of *fixers* to transform it into valid Python 3.x code. The standard library | |
| 10 | 10 | contains a rich set of fixers that will handle almost all code. 2to3 supporting | |
| 11 | 11 | library :mod:`lib2to3` is, however, a flexible and generic library, so it is | |
| 12 | - possible to write your own fixers for 2to3. :mod:`lib2to3` could also be | ||
| 13 | - adapted to custom applications in which Python code needs to be edited | ||
| 14 | - automatically. | ||
| 12 | + possible to write your own fixers for 2to3. | ||
| 15 | 13 | ||
| 16 | 14 | ||
| 17 | 15 | .. _2to3-using: | |
@@ -466,9 +464,17 @@ and off individually. They are described here in more detail. | |||
| 466 | 464 | ||
| 467 | 465 | -------------- | |
| 468 | 466 | ||
| 467 | + .. deprecated:: 3.10 | ||
| 468 | + Python 3.9 will switch to a PEG parser (see :pep:`617`), and Python 3.10 may | ||
| 469 | + include new language syntax that is not parsable by lib2to3's LL(1) parser. | ||
| 470 | + The ``lib2to3`` module may be removed from the standard library in a future | ||
| 471 | + Python version. Consider third-party alternatives such as `LibCST`_ or | ||
| 472 | + `parso`_. | ||
| 473 | + | ||
| 469 | 474 | .. note:: | |
| 470 | 475 | ||
| 471 | 476 | The :mod:`lib2to3` API should be considered unstable and may change | |
| 472 | 477 | drastically in the future. | |
| 473 | 478 | ||
| 474 | - .. XXX What is the public interface anyway? | ||
| 479 | + .. _LibCST: https://libcst.readthedocs.io/ | ||
| 480 | + .. _parso: https://parso.readthedocs.io/ | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1 +1,8 @@ | |||
| 1 | - #empty | ||
| 1 | + import warnings | ||
| 2 | + | ||
| 3 | + | ||
| 4 | + warnings.warn( | ||
| 5 | + "lib2to3 package is deprecated and may not be able to parse Python 3.10+", | ||
| 6 | + PendingDeprecationWarning, | ||
| 7 | + stacklevel=2, | ||
| 8 | + ) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,6 +17,7 @@ def check_all(self, modname): | |||
| 17 | 17 | names = {} | |
| 18 | 18 | with support.check_warnings( | |
| 19 | 19 | (".* (module|package)", DeprecationWarning), | |
| 20 | + (".* (module|package)", PendingDeprecationWarning), | ||
| 20 | 21 | ("", ResourceWarning), | |
| 21 | 22 | quiet=True): | |
| 22 | 23 | try: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + The :mod:`lib2to3` module is pending deprecation due to :pep:`617`. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments