mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Adding a warning about the regex module. This is the first official
use of PyErr_Warn()! This module is a good guinea pig because it's been obsolete since 1.5.0 was released.
This commit is contained in:
parent
fad81f0838
commit
b1d136174a
1 changed files with 3 additions and 0 deletions
|
@ -657,6 +657,9 @@ 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,
|
||||||
|
"the regex module is deprecated; please use the re module");
|
||||||
|
|
||||||
/* Initialize regex.error exception */
|
/* Initialize regex.error exception */
|
||||||
v = RegexError = PyErr_NewException("regex.error", NULL, NULL);
|
v = RegexError = PyErr_NewException("regex.error", NULL, NULL);
|
||||||
if (v == NULL || PyDict_SetItemString(d, "error", v) != 0)
|
if (v == NULL || PyDict_SetItemString(d, "error", v) != 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue