Skip to content

Use bool in fileinput.input inplace docstring and tests #111998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/fileinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_fileinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down