]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.9] bpo-40939: Deprecate the PyParser_SimpleParse* functions (GH-21012)
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Sun, 21 Jun 2020 01:15:45 +0000 (04:15 +0300)
committerGitHub <noreply@github.com>
Sun, 21 Jun 2020 01:15:45 +0000 (02:15 +0100)
Doc/c-api/veryhigh.rst
Doc/whatsnew/3.9.rst
Include/pythonrun.h
Misc/NEWS.d/next/Core and Builtins/2020-06-20-18-36-05.bpo-40939.V3eiAZ.rst [new file with mode: 0644]

index d6aecc394c9e70a8084750df748ed06a9065f22c..71aee140f62c1fe42853b2ecb77d9c75e2a2aa1a 100644 (file)
@@ -193,6 +193,8 @@ the same library that the Python runtime is using.
    :c:func:`PyParser_SimpleParseStringFlagsFilename` below, leaving  *filename* set
    to ``NULL`` and *flags* set to ``0``.
 
+   .. deprecated-removed:: 3.9 3.10
+
 
 .. c:function:: struct _node* PyParser_SimpleParseStringFlags( const char *str, int start, int flags)
 
@@ -200,6 +202,8 @@ the same library that the Python runtime is using.
    :c:func:`PyParser_SimpleParseStringFlagsFilename` below, leaving  *filename* set
    to ``NULL``.
 
+   .. deprecated-removed:: 3.9 3.10
+
 
 .. c:function:: struct _node* PyParser_SimpleParseStringFlagsFilename( const char *str, const char *filename, int start, int flags)
 
@@ -209,18 +213,24 @@ the same library that the Python runtime is using.
    many times. *filename* is decoded from the filesystem encoding
    (:func:`sys.getfilesystemencoding`).
 
+   .. deprecated-removed:: 3.9 3.10
+
 
 .. c:function:: struct _node* PyParser_SimpleParseFile(FILE *fp, const char *filename, int start)
 
    This is a simplified interface to :c:func:`PyParser_SimpleParseFileFlags` below,
    leaving *flags* set to ``0``.
 
+   .. deprecated-removed:: 3.9 3.10
+
 
 .. c:function:: struct _node* PyParser_SimpleParseFileFlags(FILE *fp, const char *filename, int start, int flags)
 
    Similar to :c:func:`PyParser_SimpleParseStringFlagsFilename`, but the Python
    source code is read from *fp* instead of an in-memory string.
 
+   .. deprecated-removed:: 3.9 3.10
+
 
 .. c:function:: PyObject* PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals)
 
index 8412d1fc6dbe32137cbe455c53f33044c557bb37..16250317b1ce7d9d7a82b8a35b7a4a5c817a40b1 100644 (file)
@@ -704,6 +704,11 @@ Deprecated
   users can leverage the Abstract Syntax Tree (AST) generation and compilation
   stage, using the :mod:`ast` module.
 
+* The Public C API functions :c:func:`PyParser_SimpleParseStringFlags`,
+  :c:func:`PyParser_SimpleParseStringFlagsFilename` and
+  :c:func:`PyParser_SimpleParseFileFlags` are deprecated and will be removed
+  in Python 3.10 together with the old parser.
+
 * Using :data:`NotImplemented` in a boolean context has been deprecated,
   as it is almost exclusively the result of incorrect rich comparator
   implementations. It will be made a :exc:`TypeError` in a future version
index 46091e09216330bb39b8bb68a8d718dea40cd33f..d6010053372ac1cfd9cd1c8d1797c763ba662ece 100644 (file)
@@ -72,16 +72,15 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject(
 #define PyParser_SimpleParseFile(FP, S, B) \
     PyParser_SimpleParseFileFlags(FP, S, B, 0)
 #endif
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
-                                                           int);
+Py_DEPRECATED(3.9) PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *,
+                                                                              int, int);
 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
-                                                                   const char *,
-                                                                   int, int);
+Py_DEPRECATED(3.9) PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
+                                                                                      const char *,
+                                                                                      int, int);
 #endif
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
-                                                         int, int);
-
+Py_DEPRECATED(3.9) PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
+                                                                            int, int);
 #ifndef Py_LIMITED_API
 PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
                                          PyObject *, PyCompilerFlags *);
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-20-18-36-05.bpo-40939.V3eiAZ.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-20-18-36-05.bpo-40939.V3eiAZ.rst
new file mode 100644 (file)
index 0000000..6e60bd9
--- /dev/null
@@ -0,0 +1 @@
+Deprecate :c:func:`PyParser_SimpleParseStringFlags`, :c:func:`PyParser_SimpleParseStringFlagsFilename` and :c:func:`PyParser_SimpleParseFileFlags`.
\ No newline at end of file