https://github.com/python/cpython/commit/a768e12f094a9b14a9a1680fb50330e1050716c4
commit: a768e12f094a9b14a9a1680fb50330e1050716c4
branch: main
author: Ville Skyttä <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2024-01-27T23:47:55+02:00
summary:

Use bool in fileinput.input() docstring and tests for the inplace argument 
(GH-111998)

The `.rst` docs, most tests, and typeshed already use bool for it.

files:
M Lib/fileinput.py
M Lib/test/test_fileinput.py

diff --git a/Lib/fileinput.py b/Lib/fileinput.py
index 1b25f28f3d3432..3dba3d2fbfa967 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -53,7 +53,7 @@
 sequence must be accessed in strictly sequential order; sequence
 access and readline() cannot be mixed.
 
-Optional in-place filtering: if the keyword argument inplace=1 is
+Optional in-place filtering: if the keyword argument inplace=True is
 passed to input() or to the FileInput constructor, the file is moved
 to a backup file and standard output is directed to the input file.
 This makes it possible to write a filter that rewrites its input file
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py
index 786d9186634305..b3ad41d2588c4c 100644
--- a/Lib/test/test_fileinput.py
+++ b/Lib/test/test_fileinput.py
@@ -151,7 +151,7 @@ def test_buffer_sizes(self):
             print('6. Inplace')
         savestdout = sys.stdout
         try:
-            fi = FileInput(files=(t1, t2, t3, t4), inplace=1, encoding="utf-8")
+            fi = FileInput(files=(t1, t2, t3, t4), inplace=True, 
encoding="utf-8")
             for line in fi:
                 line = line[:-1].upper()
                 print(line)
@@ -256,7 +256,7 @@ def test_detached_stdin_binary_mode(self):
     def test_file_opening_hook(self):
         try:
             # cannot use openhook and inplace mode
-            fi = FileInput(inplace=1, openhook=lambda f, m: None)
+            fi = FileInput(inplace=True, openhook=lambda f, m: None)
             self.fail("FileInput should raise if both inplace "
                              "and openhook arguments are given")
         except ValueError:

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to