Christian Clauss
745c9d9dfc
Fix typos in the Lib directory (GH-28775)
...
Fix typos in the Lib directory as identified by codespell.
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2021-10-06 16:13:48 -07:00
Serhiy Storchaka
2a8127cafe
bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005)
2021-08-29 14:04:40 +03:00
CAM Gerlach
bd2fa3c416
bpo-29982: Add "ignore_cleanup_errors" param to tempfile.TemporaryDirectory() (GH-24793)
2021-03-14 11:06:56 -07:00
Eric L
9c7927400c
bpo-40701: tempfile mixes str and bytes in an inconsistent manner (GH-20442)
...
The case of tempfile.tempdir variable being bytes is now handled consistently.
The getters return the right type and no more error of mixing str and bytes unless explicitly caused by the user.
Adds a regression test.
Expands the documentation to clarify the behavior.
Co-authored-by: Eric L <ewl+git@lavar.de>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2021-03-03 12:36:22 -08:00
Inada Naoki
d2810054c7
tempfile: Use random.choises() instead of choise() (GH-23068)
2020-11-01 20:02:03 +09:00
Inada Naoki
43ca084c88
Revert "bpo-42160: tempfile: Reduce overhead of pid check. (GH-22997)"
...
`_RandomNameSequence` is not true singleton so using `os.register_at_fork` doesn't make sense unlike `random._inst`.
This reverts commit 8e409cebad
.
2020-10-31 11:15:38 +09:00
Eric W
8e409cebad
bpo-42160: tempfile: Reduce overhead of pid check. (GH-22997)
...
The _RandomSequence class in tempfile used to check the current pid every time its rng property was used.
This commit replaces this code with `os.register_at_fork` to reduce the overhead.
2020-10-30 13:56:28 +09:00
Hai Shi
0c4f0f3b29
bpo-40275: Use new test.support helper submodules in tests (GH-21169)
2020-06-30 15:46:31 +02:00
Victor Stinner
57572b103e
bpo-40443: Remove unused imports in tests (GH-19805)
2020-04-30 01:48:37 +02:00
Inada Naoki
485e715cb1
bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540)
...
It has not returned the file position after the seek.
2020-04-17 15:56:35 +09:00
Guido van Rossum
48b069a003
bpo-39481: Implementation for PEP 585 ( #18239 )
...
This implements things like `list[int]`,
which returns an object of type `types.GenericAlias`.
This object mostly acts as a proxy for `list`,
but has attributes `__origin__` and `__args__`
that allow recovering the parts (with values `list` and `(int,)`.
There is also an approximate notion of type variables;
e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`.
Type variables are objects of type `typing.TypeVar`.
2020-04-07 09:50:06 -07:00
Victor Stinner
278c1e159c
bpo-40094: Add test.support.wait_process() (GH-19254)
...
Moreover, the following tests now check the child process exit code:
* test_os.PtyTests
* test_mailbox.test_lock_conflict()
* test_tempfile.test_process_awareness()
* test_uuid.testIssue8621()
* multiprocessing resource tracker tests
2020-03-31 20:08:12 +02:00
Batuhan Taşkaya
09c482fad1
bpo-39019: Implement missing __class_getitem__ for SpooledTemporaryFile (GH-17560)
2019-12-30 16:08:08 +00:00
Inada Naoki
ea9835c5d1
bpo-26730: Fix SpooledTemporaryFile data corruption (GH-17400)
...
SpooledTemporaryFile.rollback() might cause data corruption
when it is in text mode.
Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
2019-11-27 22:22:06 +09:00
Anthony Sottile
370138ba9c
bpo-35803: Document and test dir=PathLike for tempfile (GH-11644)
...
Co-Authored-By: Ammar Askar <ammar_askar@hotmail.com>
2019-09-09 10:54:34 -05:00
Serhiy Storchaka
e9b51c0ad8
bpo-26660, bpo-35144: Fix permission errors in TemporaryDirectory cleanup. (GH-10320)
...
TemporaryDirectory.cleanup() failed when non-writeable or non-searchable
files or directories were created inside a temporary directory.
2019-05-31 11:30:37 +03:00
Serhiy Storchaka
5b10b98247
bpo-22831: Use "with" to avoid possible fd leaks in tests (part 2). (GH-10929)
2019-03-05 10:06:26 +02:00
Anthony Sottile
8377cd4fcd
Clean up code which checked presence of os.{stat,lstat,chmod} ( #11643 )
2019-02-25 23:32:27 +01:00
sth
825aab95fd
bpo-27300: Add the errors parameter to tempfile classes. (GH-6696)
2018-05-23 08:07:01 +03:00
Victor Stinner
6c8c2943d9
bpo-31160: test_tempfile: Fix reap_children() warning ( #3056 )
...
TestRandomNameSequence.test_process_awareness() now calls
os.waitpid() to avoid leaking a zombie process.
2017-08-10 13:05:06 +02:00
Serhiy Storchaka
d1a1def7bf
bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. ( #1341 )
...
* bpo-30197: Enhance functions swap_attr() and swap_item() in test.support.
They now work when delete replaced attribute or item inside the with
statement. The old value of the attribute or item (or None if it doesn't
exist) now will be assigned to the target of the "as" clause, if there is
one.
* Update docstrings.
2017-04-28 18:17:26 +02:00
Victor Stinner
1e62bf145b
bpo-30030: Revert f50354ad
(tempfile) ( #1187 )
...
Revert f50354adaaafebe95ad09d09b825804a686ea843: it introduced a
regression in test_threadedtempfile.
2017-04-19 22:59:51 +02:00
Serhiy Storchaka
f50354adaa
Reimplement tempfile._RandomNameSequence using a generator function. ( #1075 )
2017-04-11 22:45:59 +03:00
Martin Panter
7869a22779
Issue #26385 : Cleanup NamedTemporaryFile if open() fails, by SilentGhost
2016-02-28 05:22:20 +00:00
Gregory P. Smith
ad577b938b
Issue 24230: The tempfile module now accepts bytes for prefix, suffix and dir
...
parameters and returns bytes in such situations (matching the os module APIs).
2015-05-22 16:18:14 -07:00
Serhiy Storchaka
492f027793
Issue #22107 : tempfile.gettempdir() and tempfile.mkdtemp() now try again
...
when a directory with the chosen name already exists on Windows as well as
on Unix. tempfile.mkstemp() now fails early if parent directory is not
valid (not exists or is a file) on Windows.
2015-05-20 00:14:00 +03:00
Serhiy Storchaka
5d6b7b1cb7
Issue #22107 : tempfile.gettempdir() and tempfile.mkdtemp() now try again
...
when a directory with the chosen name already exists on Windows as well as
on Unix. tempfile.mkstemp() now fails early if parent directory is not
valid (not exists or is a file) on Windows.
2015-05-20 00:11:48 +03:00
Berker Peksag
ce643913a9
Issue #9517 : Move script_helper to the support package.
...
Patch by Christie Wilson.
2015-05-06 06:33:17 +03:00
Zachary Ware
38c707e7e0
Issue #21741 : Update 147 test modules to use test discovery.
...
I have compared output between pre- and post-patch runs of these tests
to make sure there's nothing missing and nothing broken, on both
Windows and Linux. The only differences I found were actually tests
that were previously *not* run.
2015-04-13 15:00:43 -05:00
Serhiy Storchaka
56cefa69ee
Issue #23700 : Iterator of NamedTemporaryFile now keeps a reference to
...
NamedTemporaryFile instance. Patch by Bohuslav Kabrda.
2015-03-19 15:23:15 +02:00
Serhiy Storchaka
5e193ac0bd
Issue #22427 : TemporaryDirectory no longer attempts to clean up twice when
...
used in the with statement in generator.
2014-09-24 13:26:25 +03:00
Victor Stinner
c61c170b41
Issue #18174 : Fix leak of file descriptor in test_tempfile
2014-07-29 01:13:39 +02:00
Victor Stinner
87d13ea56d
Issue #21058 : fix typo in a comment. Patch written by Vajrasky Kok.
2014-03-25 18:19:17 +01:00
Victor Stinner
1f99f9d5c2
Issue #21058 : Fix a leak of file descriptor in tempfile.NamedTemporaryFile(),
...
close the file descriptor if io.open() fails
2014-03-25 09:18:04 +01:00
Serhiy Storchaka
a28632be56
Issue #19077 : tempfile.TemporaryDirectory cleanup no longer fails when
...
called during shutdown. Emitting resource warning in __del__ no longer fails.
Original patch by Antoine Pitrou.
2014-01-27 11:21:54 +02:00
Serhiy Storchaka
99e033b02e
Issue #19077 : tempfile.TemporaryDirectory cleanup is now most likely
...
successful when called during nulling out of modules during shutdown.
Misleading exception no longer raised when resource warning is emitted
during shutdown.
2014-01-27 11:18:27 +02:00
Antoine Pitrou
2b7f69851d
Issue #18879 : When a method is looked up on a temporary file, avoid closing the file before the method is possibly called.
2013-12-21 22:16:19 +01:00
Antoine Pitrou
17c93260a6
Issue #18879 : When a method is looked up on a temporary file, avoid closing the file before the method is possibly called.
2013-12-21 22:14:56 +01:00
Zachary Ware
101d9e7250
Issue 19572: More silently skipped tests explicitly skipped.
2013-12-08 00:44:27 -06:00
Zachary Ware
9fe6d86709
Issue 19572: More silently skipped tests explicitly skipped.
2013-12-08 00:20:35 -06:00
Tim Golden
6d09f09d8b
Issue14255 Don't flatten case of tempdir
2013-10-25 18:38:16 +01:00
Eli Bendersky
7290608af7
Issue #18945 : Add tests for tempfile name collision handling.
...
Patch by Vlad Shcherbina
2013-09-13 05:30:00 -07:00
Eli Bendersky
aa04f9ae7d
Issue #18945 : Add tests for tempfile name collision handling.
...
Patch by Vlad Shcherbina
2013-09-13 05:28:20 -07:00
Eli Bendersky
309836c5c8
Issue #18849 : Fixed a Windows-specific tempfile bug where collision with an
...
existing directory caused mkstemp and related APIs to fail instead of
retrying. Report and fix by Vlad Shcherbina.
2013-09-06 06:14:16 -07:00
Eli Bendersky
f315df31bd
Issue #18849 : Fixed a Windows-specific tempfile bug where collision with an
...
existing directory caused mkstemp and related APIs to fail instead of
retrying. Report and fix by Vlad Shcherbina.
2013-09-06 06:11:19 -07:00
Victor Stinner
daf455554b
Issue #18571 : Implementation of the PEP 446: file descriptors and file handles
...
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Victor Stinner
97869103ba
Close #12015 : The tempfile module now uses a suffix of 8 random characters
...
instead of 6, to reduce the risk of filename collision. The entropy was reduced
when uppercase letters were removed from the charset used to generate random
characters.
2013-08-14 01:28:28 +02:00
Serhiy Storchaka
94cd10fa19
Issue #16800 : tempfile.gettempdir() no longer left temporary files when
...
the disk is full. Original patch by Amir Szekely.
2013-02-13 00:38:48 +02:00
Serhiy Storchaka
ff7fef9601
Issue #16800 : tempfile.gettempdir() no longer left temporary files when
...
the disk is full. Original patch by Amir Szekely.
2013-02-13 00:37:29 +02:00
Serhiy Storchaka
f6b361ec1a
Issue #16800 : tempfile.gettempdir() no longer left temporary files when
...
the disk is full. Original patch by Amir Szekely.
2013-02-13 00:35:30 +02:00