Add restriction on the offset parameter for mmap.flush.
Explain that ALLOCATIONGRANULARITY is the same as PAGESIZE in Unix.
(cherry picked from commit 027664a3d5)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
path_error() uses GetLastError() on Windows, but some os functions
are implemented via CRT APIs which report errors via errno.
This may result in raising OSError with invalid error code (such
as zero).
Introduce posix_path_error() function and use it where appropriate.
(cherry picked from commit 834603112e)
Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
On failure, _PyBytes_Resize() will deallocate the bytes object and set
"result" to NULL.
https://bugs.python.org/issue34824
(cherry picked from commit 365ad2ead5)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
The xml.sax and xml.dom.domreg modules now obey
sys.flags.ignore_environment.
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 223e501fb9)
Co-authored-by: Christian Heimes <christian@python.org>
Address a C undefined behavior signed integer overflow issue in set object table resizing. Our -fwrapv compiler flag and practical reasons why sets are unlikely to get this large should mean this was never an issue but it was incorrect code that generates code analysis warnings.
Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
The docs in `library/unittest.mock` have been updated to remove
confusing terms about submock and be explicit about the behavior
expected.
(cherry picked from commit 96200eb2ff)
Co-authored-by: Mario Corchero <mariocj89@gmail.com>
The reprlib code was copied here instead of importing reprlib. I'm not sure if we really need to avoid the import, but since I expect dataclasses to be more common that reprlib, it seems wise. Plus, the code is small.
(cherry picked from commit dd13c88b53)
Co-authored-by: Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) <srinivasreddy@users.noreply.github.com>
Adding `max_num_fields` to `cgi.FieldStorage` to make DOS attacks harder by
limiting the number of `MiniFieldStorage` objects created by `FieldStorage`.
(cherry picked from commit 209144831b)
Co-authored-by: matthewbelisle-wf <matthew.belisle@workiva.com>
According to the versionchanged note, the `strict` argument was removed in 3.3 and `policy` was added, but the name of the argument in the paragraph wasn't updated.
(cherry picked from commit a5ca98537b)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
C implementation of xml.etree.ElementTree.Element.__setstate__()
leaked references to children when called for already initialized
element.
(cherry picked from commit 6f906b3d72)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
On macOS, fix reading from and writing into a file with a size larger than 2 GiB.
(cherry picked from commit 74a8b6ea7e)
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
Restores the use of pyexpatns.h to isolate our embedded copy of the expat C
library so that its symbols do not conflict at link or dynamic loading time
with an embedding application or other extension modules with their own
version of libexpat.
5dc3f23b5fGH-diff-3afaf7274c90ce1b7405f75ad825f545 inadvertently removed it when upgrading expat.
(cherry picked from commit 9d4712bc8f)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
https://bugs.python.org/issue35011
[3.7] [bpo-23420](https://bugs.python.org/issue23420): Verify the value of '-s' when execute the CLI of cProfile (GH-9925)
Verify the value for the parameter '-s' of the cProfile CLI. Patch by Robert
Kuska.
Co-authored-by: Robert Kuska <rkuska@gmail.com>
(cherry picked from commit fcd5e84a51)
https://bugs.python.org/issue23420
Fix test_cmd_line_script.test_nonexisting_script(): the test must not
rely on sys.executable, since main.c uses config->program which can
be different than sys.executable in many cases (for example, on macOS
when using the framework).
(cherry picked from commit ea75187c68)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
python-gdb.py now handles errors on computing the line number
of a Python frame.
Changes:
* PyFrameObjectPtr.current_line_num() now catchs any Exception on
calling addr2line(), instead of failing with a surprising "<class
'TypeError'> 'FakeRepr' object is not subscriptable" error.
* All callers of current_line_num() now handle current_line_num()
returning None.
* PyFrameObjectPtr.current_line() now also catchs IndexError on
getting a line from the Python source file.
(cherry picked from commit 2e438cc255)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
* Add News entry for the change in multiprocessing.reduction.recvfds
made in GH-9613.
(cherry picked from commit bd036d3d15)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Replace "Availability: xxx" with ".. availability:: xxx" in the doc.
Original patch by Georg Brandl.
Co-Authored-By: Georg Brandl <georg@python.org>
(cherry picked from commit 2d6097d027)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
* fix dangling mention of key=str.lower in heapq doc
* Fix dangling mention of keyfunc example for sorted()
(cherry picked from commit 6bdb6f7675)
Co-authored-by: Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de>
Methods find(), findtext() and findall() of xml.etree.ElementTree.Element
were not able to find chldren which are instances of Element subclasses.
(cherry picked from commit b11c5667f9)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
A Windows build with _tkinter, tkinter, and idlelib
but without ctypes is unlikely but apparently possible.
(cherry picked from commit d274afb5e5)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Covered all special cases: bytes, tuple, list, differend
kinds of iterables and iterators.
(cherry picked from commit 1a997eb291)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
For 3.7.1rc1 and 3.6.7rc1 we used a pre-release development
snapshot of Tk 8.6 to pick up some post-8.6.8 fixes for macOS.
But the snapshot introduced at least one regression (bpo-34927).
For rc2, revert to using the standard release 8.6.8 for now.
This reverts commit d9cfe5ed2c.
With macOS framework builds, test case test_nonexisting_script in
test_nonexisting_script fails because the test case assumes that
the file name in sys.executable will appear in the error message.
For macOS framework builds, sys.executable is the file name of the
stub launcher and its file name bears no relationship to the file
name of the actual python executable. For now, skip the test in
this case.
(cherry picked from commit f6c29a65e2)
Co-authored-by: Ned Deily <nad@python.org>
It was proposed to add an warning for http.server regarding security
issues. The wording was provided at bpo-26005 by @orsenthil
(cherry picked from commit 1d26c72e6a)
Co-authored-by: Felipe Rodrigues <felipe@felipevr.com>