initregex(): Check return value of PyErr_Warn() and propagate the exception
(if any.)
This commit is contained in:
parent
4e566ab904
commit
4ccf119053
|
@ -660,8 +660,10 @@ initregex(void)
|
||||||
m = Py_InitModule("regex", regex_global_methods);
|
m = Py_InitModule("regex", regex_global_methods);
|
||||||
d = PyModule_GetDict(m);
|
d = PyModule_GetDict(m);
|
||||||
|
|
||||||
PyErr_Warn(PyExc_DeprecationWarning,
|
if (PyErr_Warn(PyExc_DeprecationWarning,
|
||||||
"the regex module is deprecated; please use the re module");
|
"the regex module is deprecated; "
|
||||||
|
"please use the re module") < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Initialize regex.error exception */
|
/* Initialize regex.error exception */
|
||||||
v = RegexError = PyErr_NewException("regex.error", NULL, NULL);
|
v = RegexError = PyErr_NewException("regex.error", NULL, NULL);
|
||||||
|
|
Loading…
Reference in New Issue