A root cause of bpo-37936 is that it's easy to write a .gitignore
rule that's intended to apply to a specific file (e.g., the
`pyconfig.h` generated by `./configure`) but actually applies to all
similarly-named files in the tree (e.g., `PC/pyconfig.h`.)
Specifically, any rule with no non-trailing slashes is applied in an
"unrooted" way, to files anywhere in the tree. This means that if we
write the rules in the most obvious-looking way, then
* for specific files we want to ignore that happen to be in
subdirectories (like `Modules/config.c`), the rule will work
as intended, staying "rooted" to the top of the tree; but
* when a specific file we want to ignore happens to be at the root of
the repo (like `platform`), then the obvious rule (`platform`) will
apply much more broadly than intended: if someone tries to add a
file or directory named `platform` somewhere else in the tree, it
will unexpectedly get ignored.
That's surprising behavior that can make the .gitignore file's
behavior feel finicky and unpredictable.
To avoid it, we can simply always give a rule "rooted" behavior when
that's what's intended, by systematically using leading slashes.
Further, to help make the pattern obvious when looking at the file and
minimize any need for thinking about the syntax when adding new rules:
separate the rules into one group for each type, with brief comments
identifying them.
For most of these rules it's clear whether they're meant to be rooted
or unrooted, but in a handful of cases I've only guessed. In that
case the safer default (the choice that won't hide information) is the
narrower, rooted meaning, with a leading slash. If for some of these
the unrooted meaning is desired after all, it'll be easy to move them
to the unrooted section at the top.
(cherry picked from commit 455122a009)
Co-authored-by: Greg Price <gnprice@gmail.com>
Fixes a possible hang when using a timeout on subprocess.run() while
capturing output. If the child process spawned its own children or otherwise
connected its stdout or stderr handles with another process, we could hang
after the timeout was reached and our child was killed when attempting to read
final output from the pipes.
(cherry picked from commit 580d2782f7)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Add unittests for executables with a zipfile appended to test_zipfile, as zipfile.is_zipfile and zipfile.ZipFile work properly on these today.
(cherry picked from commit 3f4db4a0ba)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
The `wb.len = -1` assignment is unneeded since its introduction in 161d695fb0 as `PyObject_GetBuffer` always fills it in.
(cherry picked from commit afdeb189e9)
Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
In text mode, the "size" parameter indicates the number of characters, not bytes.
(cherry picked from commit faff81c05f)
Co-authored-by: William Andrea <william.j.andrea@gmail.com>
* Write a message when killing a worker process
* Put a timeout on the second popen.communicate() call
(after killing the process)
* Put a timeout on popen.wait() call
* Catch popen.kill() and popen.wait() exceptions
(cherry picked from commit de2d9eed8b)
As described in Doc/c-api/init.rst, PyEval_InitThreads() cannot be called
before Py_Initialize() function.
(cherry picked from commit 9e61066355)
Co-authored-by: Kenta Murata <mrkn@users.noreply.github.com>
feed_eof(), feed_data(), set_exception(), and set_transport() are prefixed with underscore now.
https://bugs.python.org/issue38066
(cherry picked from commit 12c122ae95)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Update the docs as patch can now return an AsyncMock if the patched
object is an async function.
(cherry picked from commit f5e7f39d29)
Co-authored-by: Mario Corchero <mcorcherojim@bloomberg.net>
This PR deprecate explicit loop parameters in all public asyncio APIs
This issues is split to be easier to review.
fourth step: queue.py
https://bugs.python.org/issue36373
(cherry picked from commit 9008be303a)
Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
This PR deprecate explicit loop parameters in all public asyncio APIs
This issues is split to be easier to review.
Third step: locks.py
https://bugs.python.org/issue36373
(cherry picked from commit 537877d85d)
Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
Accumulate certificates in a set instead of doing a costly list contain
operation. A Windows cert store can easily contain over hundred
certificates. The old code would result in way over 5,000 comparison
operations
Signed-off-by: Christian Heimes <christian@python.org>
* bpo-351428: Updates documentation to reflect AsyncMock call_count after await.
* Adds skip and fixes warning.
* Removes extra >>>.
* Adds ... in front of await mock().
(cherry picked from commit b9f65f01fd)
Co-authored-by: Lisa Roach <lisaroach14@gmail.com>
This only happened when initializing the subprocess to run a module.
This recent bug only affected 3.7.4 and 3.8.0b2 to 3.8.0b4.
(cherry picked from commit c59295a1ca)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
The "A4" pdfs were previously the wrong size due to a change in the options in Sphinx 1.5.
See also sphinx-doc/sphinxGH-5235
(cherry picked from commit b5381f6697)
Authored-by: Jean-François B <jfbu@free.fr>
The link we have points to the version from Unicode 6.0.0, dated 2010.
There have been numerous updates to it since then:
https://www.unicode.org/reports/tr44/GH-Modifications
Change the link to one that points to the current version. Also, use HTTPS.
(cherry picked from commit 64c6ac74e2)
Co-authored-by: Greg Price <gnprice@gmail.com>
In debug mode, visit_decref() now calls _PyObject_IsFreed() to ensure
that the object is not freed. If it's freed, the program fails with
an assertion error and Python dumps informations about the freed
object.
(cherry picked from commit d91d4de317)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
weakref.WeakValueDictionary defines a local remove() function used as
callback for weak references. This function was created with a
closure. Modify the implementation to avoid the closure.
(cherry picked from commit a2af05a0d3)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
The Rot-13 codec is for educational use but does not have unit tests,
dragging down test coverage. This adds a few very simple tests.
(cherry picked from commit b3b48c81f0)
Co-authored-by: Zeth <theology@gmail.com>
Constants added by the site module like exit() "should not be used in programs"
(cherry picked from commit e3c59a7527)
Co-authored-by: Alan Yee <alanyee@users.noreply.github.com>
* bpo-34596: Fallback to a default reason when @unittest.skip is uncalled
* Change default reason to empty string
* Fix rst formatting of NEWS entry
(cherry picked from commit d5fd75c53f)
Co-authored-by: Naitree Zhu <Naitreey@gmail.com>