Repository navigation
gh-89756: make SpooledTemporaryFile.truncate return new file size and improve documentation #29197
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
Changes from 2 commits
717a927
5ebc370
fa3b08f
a1455f6
1c40e9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -172,6 +172,9 @@ The module defines the following user-callable items: | |
| :class:`io.TextIOBase` abstract base classes (depending on whether binary | ||
| or text *mode* was specified). | ||
|
|
||
| .. versionchanged:: 3.12 | ||
| The truncate method returns new file size. | ||
|
|
||
|
|
||
| .. class:: TemporaryDirectory(suffix=None, prefix=None, dir=None, ignore_cleanup_errors=False, *, delete=True) | ||
|
|
||
|
|
@@ -388,6 +391,7 @@ Here are some examples of typical usage of the :mod:`tempfile` module:: | |
| >>> fp.write(b'Hello world!') | ||
| # read data from file | ||
| >>> fp.seek(0) | ||
| 0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we add
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And later, This output should be:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems this file is not tested by doctest. Please leave it. Otherwise, we need to fix all output and remove all comments in sample code. |
||
| >>> fp.read() | ||
| b'Hello world!' | ||
| # close the file, it will be removed | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Make :meth:`tempfile.SpooledTemporaryFile.truncate()` to return new file size. |
Uh oh!
There was an error while loading. Please reload this page.