Mercurial > cpython-lru_cache-weakref
comparison Python/sysmodule.c @ 46414:840064802952 legacy-trunk
Re-implement the 'warnings' module in C. This allows for usage of the
'warnings' code in places where it was previously not possible (e.g., the
parser). It could also potentially lead to a speed-up in interpreter start-up
if the C version of the code (_warnings) is imported over the use of the
Python version in key places.
Closes issue #1631171.
| author | Brett Cannon <bcannon@gmail.com> |
|---|---|
| date | Sat, 12 Apr 2008 23:44:07 +0000 |
| parents | 84bb7701efba |
| children | 39ea2fc4503d |
comparison
equal
deleted
inserted
replaced
| 46413:2a9858255de1 | 46414:840064802952 |
|---|---|
| 936 str = PyString_FromString(s); | 936 str = PyString_FromString(s); |
| 937 if (str != NULL) { | 937 if (str != NULL) { |
| 938 PyList_Append(warnoptions, str); | 938 PyList_Append(warnoptions, str); |
| 939 Py_DECREF(str); | 939 Py_DECREF(str); |
| 940 } | 940 } |
| 941 } | |
| 942 | |
| 943 int | |
| 944 PySys_HasWarnOptions(void) | |
| 945 { | |
| 946 return warnoptions ? 1 : 0; | |
| 941 } | 947 } |
| 942 | 948 |
| 943 /* XXX This doc string is too long to be a single string literal in VC++ 5.0. | 949 /* XXX This doc string is too long to be a single string literal in VC++ 5.0. |
| 944 Two literals concatenated works just fine. If you have a K&R compiler | 950 Two literals concatenated works just fine. If you have a K&R compiler |
| 945 or other abomination that however *does* understand longer strings, | 951 or other abomination that however *does* understand longer strings, |
| 1163 {"riscos_wimp", "???"}, | 1169 {"riscos_wimp", "???"}, |
| 1164 #endif | 1170 #endif |
| 1165 /* {"unbuffered", "-u"}, */ | 1171 /* {"unbuffered", "-u"}, */ |
| 1166 {"unicode", "-U"}, | 1172 {"unicode", "-U"}, |
| 1167 /* {"skip_first", "-x"}, */ | 1173 /* {"skip_first", "-x"}, */ |
| 1174 {"bytes_warning", "-b"}, | |
| 1168 {0} | 1175 {0} |
| 1169 }; | 1176 }; |
| 1170 | 1177 |
| 1171 static PyStructSequence_Desc flags_desc = { | 1178 static PyStructSequence_Desc flags_desc = { |
| 1172 "sys.flags", /* name */ | 1179 "sys.flags", /* name */ |
| 1209 SetFlag(Py_RISCOSWimpFlag); | 1216 SetFlag(Py_RISCOSWimpFlag); |
| 1210 #endif | 1217 #endif |
| 1211 /* SetFlag(saw_unbuffered_flag); */ | 1218 /* SetFlag(saw_unbuffered_flag); */ |
| 1212 SetFlag(Py_UnicodeFlag); | 1219 SetFlag(Py_UnicodeFlag); |
| 1213 /* SetFlag(skipfirstline); */ | 1220 /* SetFlag(skipfirstline); */ |
| 1221 SetFlag(Py_BytesWarningFlag); | |
| 1214 #undef SetFlag | 1222 #undef SetFlag |
| 1215 | 1223 |
| 1216 if (PyErr_Occurred()) { | 1224 if (PyErr_Occurred()) { |
| 1217 return NULL; | 1225 return NULL; |
| 1218 } | 1226 } |
