Skip to content

Commit 0f91f58

Browse files
authored
bpo-42599: Remove useless PyModule_GetWarningsModule() (GH-23691)
Removed PyModule_GetWarningsModule() which is useless due to the _warnings module was converted to a builtin module in 2.6.
1 parent b6d98c1 commit 0f91f58

3 files changed

Lines changed: 5 additions & 11 deletions

File tree

Doc/whatsnew/3.10.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,11 @@ Removed
480480
into their code.
481481
(Contributed by Dong-hee Na and Terry J. Reedy in :issue:`42299`.)
482482

483+
* Removed the :c:func:`PyModule_GetWarningsModule` function that was useless
484+
now due to the _warnings module was converted to a builtin module in 2.6.
485+
(Contributed by Hai Shi in :issue:`42599`.)
486+
487+
483488
Porting to Python 3.10
484489
======================
485490

Python/errors.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,9 +1534,6 @@ PyErr_WriteUnraisable(PyObject *obj)
15341534
}
15351535

15361536

1537-
extern PyObject *PyModule_GetWarningsModule(void);
1538-
1539-
15401537
void
15411538
PyErr_SyntaxLocation(const char *filename, int lineno)
15421539
{

Python/pylifecycle.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,6 @@ _Py_IsFinalizing(void)
9797
int (*_PyOS_mystrnicmp_hack)(const char *, const char *, Py_ssize_t) = \
9898
PyOS_mystrnicmp; /* Python/pystrcmp.o */
9999

100-
/* PyModule_GetWarningsModule is no longer necessary as of 2.6
101-
since _warnings is builtin. This API should not be used. */
102-
PyObject *
103-
PyModule_GetWarningsModule(void)
104-
{
105-
return PyImport_ImportModule("warnings");
106-
}
107-
108100

109101
/* APIs to access the initialization flags
110102
*

0 commit comments

Comments
 (0)