mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-135648: Document that shutil.copyfileobj
doesn't flush (#135737)
Some checks are pending
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Undefined behavior sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
Some checks are pending
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Undefined behavior sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
Adds a note about flush/close on copyfileobj, and updates the Emscripten build script to follow documented advice.
This commit is contained in:
parent
2793b68f75
commit
34393cbdd4
2 changed files with 9 additions and 1 deletions
|
@ -47,6 +47,13 @@ Directory and files operations
|
||||||
0, only the contents from the current file position to the end of the file will
|
0, only the contents from the current file position to the end of the file will
|
||||||
be copied.
|
be copied.
|
||||||
|
|
||||||
|
:func:`copyfileobj` will *not* guarantee that the destination stream has
|
||||||
|
been flushed on completion of the copy. If you want to read from the
|
||||||
|
destination at the completion of the copy operation (for example, reading
|
||||||
|
the contents of a temporary file that has been copied from a HTTP stream),
|
||||||
|
you must ensure that you have called :func:`~io.IOBase.flush` or
|
||||||
|
:func:`~io.IOBase.close` on the file-like object before attempting to read
|
||||||
|
the destination file.
|
||||||
|
|
||||||
.. function:: copyfile(src, dst, *, follow_symlinks=True)
|
.. function:: copyfile(src, dst, *, follow_symlinks=True)
|
||||||
|
|
||||||
|
|
|
@ -167,11 +167,12 @@ def make_build_python(context, working_dir):
|
||||||
@subdir(HOST_BUILD_DIR, clean_ok=True)
|
@subdir(HOST_BUILD_DIR, clean_ok=True)
|
||||||
def make_emscripten_libffi(context, working_dir):
|
def make_emscripten_libffi(context, working_dir):
|
||||||
shutil.rmtree(working_dir / "libffi-3.4.6", ignore_errors=True)
|
shutil.rmtree(working_dir / "libffi-3.4.6", ignore_errors=True)
|
||||||
with tempfile.NamedTemporaryFile(suffix=".tar.gz") as tmp_file:
|
with tempfile.NamedTemporaryFile(suffix=".tar.gz", delete_on_close=False) as tmp_file:
|
||||||
with urlopen(
|
with urlopen(
|
||||||
"https://github.com/libffi/libffi/releases/download/v3.4.6/libffi-3.4.6.tar.gz"
|
"https://github.com/libffi/libffi/releases/download/v3.4.6/libffi-3.4.6.tar.gz"
|
||||||
) as response:
|
) as response:
|
||||||
shutil.copyfileobj(response, tmp_file)
|
shutil.copyfileobj(response, tmp_file)
|
||||||
|
tmp_file.close()
|
||||||
shutil.unpack_archive(tmp_file.name, working_dir)
|
shutil.unpack_archive(tmp_file.name, working_dir)
|
||||||
call(
|
call(
|
||||||
[EMSCRIPTEN_DIR / "make_libffi.sh"],
|
[EMSCRIPTEN_DIR / "make_libffi.sh"],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue