[Python-checkins] r87549 - in python/branches/py3k: Doc/library/sys.rst Include/pydebug.h Misc/NEWS Modules/main.c Python/pythonrun.c Python/sysmodule.c
georg.brandl
python-checkins at python.org
Tue Dec 28 19:30:19 CET 2010
Author: georg.brandl
Date: Tue Dec 28 19:30:18 2010
New Revision: 87549
Log:
Add sys.flags.quiet attribute for the new -q option, as noted missing by Eric in #1772833.
Modified:
python/branches/py3k/Doc/library/sys.rst
python/branches/py3k/Include/pydebug.h
python/branches/py3k/Misc/NEWS
python/branches/py3k/Modules/main.c
python/branches/py3k/Python/pythonrun.c
python/branches/py3k/Python/sysmodule.c
Modified: python/branches/py3k/Doc/library/sys.rst
==============================================================================
--- python/branches/py3k/Doc/library/sys.rst (original)
+++ python/branches/py3k/Doc/library/sys.rst Tue Dec 28 19:30:18 2010
@@ -264,6 +264,11 @@
+------------------------------+------------------------------------------+
| :const:`bytes_warning` | -b |
+------------------------------+------------------------------------------+
+ | :const:`quiet` | -q |
+ +------------------------------+------------------------------------------+
+
+ .. versionchanged:: 3.2
+ Added ``quiet`` attribute for the new :option:`-q` flag.
.. data:: float_info
Modified: python/branches/py3k/Include/pydebug.h
==============================================================================
--- python/branches/py3k/Include/pydebug.h (original)
+++ python/branches/py3k/Include/pydebug.h Tue Dec 28 19:30:18 2010
@@ -7,6 +7,7 @@
PyAPI_DATA(int) Py_DebugFlag;
PyAPI_DATA(int) Py_VerboseFlag;
+PyAPI_DATA(int) Py_QuietFlag;
PyAPI_DATA(int) Py_InteractiveFlag;
PyAPI_DATA(int) Py_InspectFlag;
PyAPI_DATA(int) Py_OptimizeFlag;
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Tue Dec 28 19:30:18 2010
@@ -15,6 +15,8 @@
- Issue #10779: PyErr_WarnExplicit() decodes the filename from the filesystem
encoding instead of UTF-8.
+- Add sys.flags attribute for the new -q command-line option.
+
Library
-------
Modified: python/branches/py3k/Modules/main.c
==============================================================================
--- python/branches/py3k/Modules/main.c (original)
+++ python/branches/py3k/Modules/main.c Tue Dec 28 19:30:18 2010
@@ -319,7 +319,6 @@
int stdin_is_interactive = 0;
int help = 0;
int version = 0;
- int quiet = 0;
int saw_unbuffered_flag = 0;
PyCompilerFlags cf;
@@ -427,7 +426,7 @@
break;
case 'q':
- quiet++;
+ Py_QuietFlag++;
break;
/* This space reserved for other options */
@@ -594,7 +593,7 @@
#endif
Py_Initialize();
- if (!quiet && (Py_VerboseFlag ||
+ if (!Py_QuietFlag && (Py_VerboseFlag ||
(command == NULL && filename == NULL &&
module == NULL && stdin_is_interactive))) {
fprintf(stderr, "Python %s on %s\n",
Modified: python/branches/py3k/Python/pythonrun.c
==============================================================================
--- python/branches/py3k/Python/pythonrun.c (original)
+++ python/branches/py3k/Python/pythonrun.c Tue Dec 28 19:30:18 2010
@@ -78,6 +78,7 @@
int Py_DebugFlag; /* Needed by parser.c */
int Py_VerboseFlag; /* Needed by import.c */
+int Py_QuietFlag; /* Needed by sysmodule.c */
int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */
int Py_InspectFlag; /* Needed to determine whether to exit at SystemError */
int Py_NoSiteFlag; /* Suppress 'import site' */
Modified: python/branches/py3k/Python/sysmodule.c
==============================================================================
--- python/branches/py3k/Python/sysmodule.c (original)
+++ python/branches/py3k/Python/sysmodule.c Tue Dec 28 19:30:18 2010
@@ -1417,7 +1417,8 @@
#endif
/* {"unbuffered", "-u"}, */
/* {"skip_first", "-x"}, */
- {"bytes_warning", "-b"},
+ {"bytes_warning", "-b"},
+ {"quiet", "-q"},
{0}
};
@@ -1461,6 +1462,7 @@
/* SetFlag(saw_unbuffered_flag); */
/* SetFlag(skipfirstline); */
SetFlag(Py_BytesWarningFlag);
+ SetFlag(Py_QuietFlag);
#undef SetFlag
if (PyErr_Occurred()) {
More information about the Python-checkins
mailing list