mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
* pythonmain.c: -k option, usage message, more environment flags.
(the latter also in frozenmain.c) * ceval.c: global 'killprint' flag raises exception when printing an expression statement's value (useful for finding stray output) * timemodule.c: add asctime() and ctime(). Change julian date to 1-based origin (as intended and documented). * Removed unused DO_TIMES stuff from timemodule.c. Added 'epoch' and 'day0' globals (year where time.time() == 0 and day of the week the epoch started).
This commit is contained in:
parent
5ef74b8f8e
commit
9e90a672b4
5 changed files with 118 additions and 59 deletions
|
@ -49,6 +49,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#define CHECKEXC 1 /* Double-check exception checking */
|
||||
#endif
|
||||
|
||||
/* Global option, may be set by main() */
|
||||
int killprint;
|
||||
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
|
@ -639,6 +642,11 @@ eval_code(co, globals, locals, owner, arg)
|
|||
softspace(x, 1);
|
||||
err = writeobject(v, x, 0);
|
||||
flushline();
|
||||
if (killprint) {
|
||||
err_setstr(RuntimeError,
|
||||
"printing expression statement");
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
DECREF(v);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue