Skip to content

Commit 4ccf119

Browse files
committed
initregex(): Check return value of PyErr_Warn() and propagate the exception
(if any.)
1 parent 4e566ab commit 4ccf119

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Modules/regexmodule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,10 @@ initregex(void)
660660
m = Py_InitModule("regex", regex_global_methods);
661661
d = PyModule_GetDict(m);
662662

663-
PyErr_Warn(PyExc_DeprecationWarning,
664-
"the regex module is deprecated; please use the re module");
663+
if (PyErr_Warn(PyExc_DeprecationWarning,
664+
"the regex module is deprecated; "
665+
"please use the re module") < 0)
666+
return NULL;
665667

666668
/* Initialize regex.error exception */
667669
v = RegexError = PyErr_NewException("regex.error", NULL, NULL);

0 commit comments

Comments
 (0)