summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorCristian Ciupitu <cristian.ciupitu@yahoo.com>2019-02-21 07:53:06 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2019-02-21 07:53:06 (GMT)
commit11fa0e48a958716186eb99348a46064e944eccf6 (patch)
tree6bbc2f5b96281a5817aaba01987582404d1f7641 /Doc
parentebc793d6acb9650b9f497808e059805892031d74 (diff)
downloadcpython-11fa0e48a958716186eb99348a46064e944eccf6.zip
cpython-11fa0e48a958716186eb99348a46064e944eccf6.tar.gz
cpython-11fa0e48a958716186eb99348a46064e944eccf6.tar.bz2
Doc: fix example for iter() function. (GH-11959)
read() returns bytes for a file opened in binary mode, so b'' should be used as a sentinel instead of ''. Otherwise the loop will be infinite.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/functions.rst2
1 files changed, 1 insertions, 1 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index cca28ff..ebbee71 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -816,7 +816,7 @@ are always available. They are listed here in alphabetical order.
from functools import partial
with open('mydata.db', 'rb') as f:
- for block in iter(partial(f.read, 64), ''):
+ for block in iter(partial(f.read, 64), b''):
process_block(block)