From 9211e2fd81fe1db6f73ded70752b144cc9691ab6 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Tue, 30 Jul 2019 12:04:01 +0100 Subject: bpo-37268: Add deprecation notice and a DeprecationWarning for the parser module (GH-15017) Deprecate the parser module and add a deprecation warning triggered on import and a warning block in the documentation. https://bugs.python.org/issue37268 Automerge-Triggered-By: @pablogsal --- Modules/parsermodule.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Modules/parsermodule.c') diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 079d00f32a..b2495fc8b3 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -1158,6 +1158,12 @@ PyInit_parser(void) { PyObject *module, *copyreg; + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "The parser module is deprecated and will be removed " + "in future versions of Python", 7) != 0) { + return NULL; + } + if (PyType_Ready(&PyST_Type) < 0) return NULL; module = PyModule_Create(&parsermodule); -- cgit v1.2.1