]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42599: Remove useless PyModule_GetWarningsModule() (GH-23691)
authorHai Shi <shihai1992@gmail.com>
Tue, 8 Dec 2020 14:42:42 +0000 (22:42 +0800)
committerGitHub <noreply@github.com>
Tue, 8 Dec 2020 14:42:42 +0000 (15:42 +0100)
Removed PyModule_GetWarningsModule() which is useless due to
the _warnings module was converted to a builtin module in 2.6.

Doc/whatsnew/3.10.rst
Python/errors.c
Python/pylifecycle.c

index a5cb4e30616cd0217c74b29c77ba600688055b5b..23e28aa4fd8fc2a9c518323d3edc9fe1b8e11b24 100644 (file)
@@ -480,6 +480,11 @@ Removed
   into their code.
   (Contributed by Dong-hee Na and Terry J. Reedy in :issue:`42299`.)
 
+* Removed the :c:func:`PyModule_GetWarningsModule` function that was useless
+  now due to the _warnings module was converted to a builtin module in 2.6.
+  (Contributed by Hai Shi in :issue:`42599`.)
+
+
 Porting to Python 3.10
 ======================
 
index 8242ac69785d4f8c3ad7fbe5a12a7c3277880550..213108f681bb7995193eeca2450708a858d407af 100644 (file)
@@ -1534,9 +1534,6 @@ PyErr_WriteUnraisable(PyObject *obj)
 }
 
 
-extern PyObject *PyModule_GetWarningsModule(void);
-
-
 void
 PyErr_SyntaxLocation(const char *filename, int lineno)
 {
index 428c887ef41c5006ad176db3d41ee5bf5729902a..70824ff674129a1f429d4676e68025aaea449ee8 100644 (file)
@@ -97,14 +97,6 @@ _Py_IsFinalizing(void)
 int (*_PyOS_mystrnicmp_hack)(const char *, const char *, Py_ssize_t) = \
     PyOS_mystrnicmp; /* Python/pystrcmp.o */
 
-/* PyModule_GetWarningsModule is no longer necessary as of 2.6
-since _warnings is builtin.  This API should not be used. */
-PyObject *
-PyModule_GetWarningsModule(void)
-{
-    return PyImport_ImportModule("warnings");
-}
-
 
 /* APIs to access the initialization flags
  *