Skip to content

Commit

Permalink
bpo-42599: Remove useless PyModule_GetWarningsModule() (GH-23691)
Browse files Browse the repository at this point in the history
Removed PyModule_GetWarningsModule() which is useless due to 
the _warnings module was converted to a builtin module in 2.6.
  • Loading branch information
shihai1991 committed Dec 8, 2020
1 parent b6d98c1 commit 0f91f58
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
5 changes: 5 additions & 0 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
======================

Expand Down
3 changes: 0 additions & 3 deletions Python/errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -1534,9 +1534,6 @@ PyErr_WriteUnraisable(PyObject *obj)
}


extern PyObject *PyModule_GetWarningsModule(void);


void
PyErr_SyntaxLocation(const char *filename, int lineno)
{
Expand Down
8 changes: 0 additions & 8 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 0f91f58

Please sign in to comment.