cpython: 3120a988a1a3 (original) (raw)

Mercurial > cpython

changeset 74359:3120a988a1a3

Closes #13761: add a "flush" keyword argument to print(). [#13761]

Georg Brandl georg@python.org
date Fri, 13 Jan 2012 19:41:25 +0100
parents 87331661042b
children 609482c6710e
files Doc/library/functions.rst Lib/test/test_print.py Misc/NEWS Python/bltinmodule.c
diffstat 4 files changed, 55 insertions(+), 9 deletions(-)[+] [-] Doc/library/functions.rst 11 Lib/test/test_print.py 26 Misc/NEWS 3 Python/bltinmodule.c 24

line wrap: on

line diff

--- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -946,7 +946,7 @@ are always available. They are listed h must be of integer types, and y must be non-negative. -.. function:: print([object, ...], *, sep=' ', end='\n', file=sys.stdout) +.. function:: print([object, ...], *, sep=' ', end='\n', file=sys.stdout, flush=False) Print object(s) to the stream file, separated by sep and followed by end. sep, end and file, if present, must be given as keyword @@ -959,9 +959,12 @@ are always available. They are listed h end. The file argument must be an object with a write(string) method; if it

.. function:: property(fget=None, fset=None, fdel=None, doc=None)

--- a/Lib/test/test_print.py +++ b/Lib/test/test_print.py @@ -111,6 +111,32 @@ class TestPrint(unittest.TestCase): self.assertRaises(TypeError, print, '', end=3) self.assertRaises(AttributeError, print, '', file='')

+

+

+ def test_main(): support.run_unittest(TestPrint)

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1? Core and Builtins ----------------- +- Issue #13761: Add a "flush" keyword argument to the print() function,

--- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1484,15 +1484,15 @@ equivalent to (x**y) % z, but may be mor static PyObject * builtin_print(PyObject *self, PyObject *args, PyObject *kwds) {

@@ -1543,6 +1543,20 @@ builtin_print(PyObject *self, PyObject * if (err) return NULL;

+ Py_RETURN_NONE; }