Skip to content

Commit d301d94

Browse files
authored
[3.9] bpo-40939: Deprecate the PyParser_SimpleParse* functions (GH-21012)
1 parent fd2c8a7 commit d301d94

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

Doc/c-api/veryhigh.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,17 @@ the same library that the Python runtime is using.
193193
:c:func:`PyParser_SimpleParseStringFlagsFilename` below, leaving *filename* set
194194
to ``NULL`` and *flags* set to ``0``.
195195
196+
.. deprecated-removed:: 3.9 3.10
197+
196198
197199
.. c:function:: struct _node* PyParser_SimpleParseStringFlags( const char *str, int start, int flags)
198200
199201
This is a simplified interface to
200202
:c:func:`PyParser_SimpleParseStringFlagsFilename` below, leaving *filename* set
201203
to ``NULL``.
202204
205+
.. deprecated-removed:: 3.9 3.10
206+
203207
204208
.. c:function:: struct _node* PyParser_SimpleParseStringFlagsFilename( const char *str, const char *filename, int start, int flags)
205209
@@ -209,18 +213,24 @@ the same library that the Python runtime is using.
209213
many times. *filename* is decoded from the filesystem encoding
210214
(:func:`sys.getfilesystemencoding`).
211215
216+
.. deprecated-removed:: 3.9 3.10
217+
212218
213219
.. c:function:: struct _node* PyParser_SimpleParseFile(FILE *fp, const char *filename, int start)
214220
215221
This is a simplified interface to :c:func:`PyParser_SimpleParseFileFlags` below,
216222
leaving *flags* set to ``0``.
217223
224+
.. deprecated-removed:: 3.9 3.10
225+
218226
219227
.. c:function:: struct _node* PyParser_SimpleParseFileFlags(FILE *fp, const char *filename, int start, int flags)
220228
221229
Similar to :c:func:`PyParser_SimpleParseStringFlagsFilename`, but the Python
222230
source code is read from *fp* instead of an in-memory string.
223231
232+
.. deprecated-removed:: 3.9 3.10
233+
224234
225235
.. c:function:: PyObject* PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals)
226236

Doc/whatsnew/3.9.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,11 @@ Deprecated
704704
users can leverage the Abstract Syntax Tree (AST) generation and compilation
705705
stage, using the :mod:`ast` module.
706706

707+
* The Public C API functions :c:func:`PyParser_SimpleParseStringFlags`,
708+
:c:func:`PyParser_SimpleParseStringFlagsFilename` and
709+
:c:func:`PyParser_SimpleParseFileFlags` are deprecated and will be removed
710+
in Python 3.10 together with the old parser.
711+
707712
* Using :data:`NotImplemented` in a boolean context has been deprecated,
708713
as it is almost exclusively the result of incorrect rich comparator
709714
implementations. It will be made a :exc:`TypeError` in a future version

Include/pythonrun.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,15 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject(
7272
#define PyParser_SimpleParseFile(FP, S, B) \
7373
PyParser_SimpleParseFileFlags(FP, S, B, 0)
7474
#endif
75-
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
76-
int);
75+
Py_DEPRECATED(3.9) PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *,
76+
int, int);
7777
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
78-
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
79-
const char *,
80-
int, int);
78+
Py_DEPRECATED(3.9) PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
79+
const char *,
80+
int, int);
8181
#endif
82-
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
83-
int, int);
84-
82+
Py_DEPRECATED(3.9) PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
83+
int, int);
8584
#ifndef Py_LIMITED_API
8685
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
8786
PyObject *, PyCompilerFlags *);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deprecate :c:func:`PyParser_SimpleParseStringFlags`, :c:func:`PyParser_SimpleParseStringFlagsFilename` and :c:func:`PyParser_SimpleParseFileFlags`.

0 commit comments

Comments
 (0)