diff 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
line wrap: on
line diff
--- a/Python/sysmodule.c	Sat Apr 12 22:24:04 2008 +0000
+++ b/Python/sysmodule.c	Sat Apr 12 23:44:07 2008 +0000
@@ -940,6 +940,12 @@
 	}
 }
 
+int
+PySys_HasWarnOptions(void)
+{
+    return warnoptions ? 1 : 0;
+}
+
 /* XXX This doc string is too long to be a single string literal in VC++ 5.0.
    Two literals concatenated works just fine.  If you have a K&R compiler
    or other abomination that however *does* understand longer strings,
@@ -1165,6 +1171,7 @@
 	/* {"unbuffered",		"-u"}, */
 	{"unicode",		"-U"},
 	/* {"skip_first",		"-x"}, */
+	{"bytes_warning", "-b"},
 	{0}
 };
 
@@ -1211,6 +1218,7 @@
 	/* SetFlag(saw_unbuffered_flag); */
 	SetFlag(Py_UnicodeFlag);
 	/* SetFlag(skipfirstline); */
+    SetFlag(Py_BytesWarningFlag);
 #undef SetFlag
 
 	if (PyErr_Occurred()) {