Christian Heimes [Sat, 24 Feb 2018 23:45:24 +0000 (00:45 +0100)]
bpo-31518: Change TLS protocol for Debian (#3660)
Debian Unstable has disabled TLS 1.0 and 1.1 for SSLv23_METHOD(). Change
TLS/SSL protocol of some tests to PROTOCOL_TLS or PROTOCOL_TLSv1_2 to
make them pass on Debian.
Signed-off-by: Christian Heimes <christian@python.org>
bpo-32923: Unittest doc: replace `whilst` with `while` (GH-5833)
`whilst` and `while` are both english words, `whilst` is not as commonly used.
This can be confusing to readers whose primary language is not english.
(cherry picked from commit 98f42aac23f3863973cb6e9964c5212cfd3a1d98)
Anselm Kruis [Fri, 23 Feb 2018 16:27:54 +0000 (17:27 +0100)]
[3.6] bpo-30028: make test.support.temp_cwd() fork-safe (GH-1066) (GH-5826)
Make test.support.temp_cwd() fork-safe. The context manager test.support.temp_cwd() no longer removes the temporary directory when executing in a process other than the parent it entered from.
If a forked child exits the context manager it won't do the cleanup..
(cherry picked from commit 33dddac00ba8d9b72cf21b8698504077eb3c23ad)
bpo-32905: IDLE - remove unused code in pyparse module (GH-5807)
dump is similar to print but less flexible. lastopenbracketpos is now always initialized in _study2, as was stmt_bracketing, so the class settings are not needed. get_last_open_bracket_pos is never called.
(cherry picked from commit 451d1edaf4d27c4e632d81246d308e8dd6ea945f)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
bpo-32008: don't use PROTOCOL_TLSv1 in example (GH-5789)
It's bad form to pin to an old version of TLS. ssl.SSLContext has the right
protocol default, so let's not pass anyway.
(cherry picked from commit e9edee0b65650c4f9db90cefc2e9a8125bad762c)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
closes bpo-32859: Don't retry dup3() if it is not available at runtime (GH-5708)
os.dup2() tests for dup3() system call availability at runtime,
but doesn't remember the result across calls, repeating
the test on each call with inheritable=False.
Since the caller of os.dup2() is expected to hold the GIL,
fix this by making the variable holding the test result static.
(cherry picked from commit b3caf388a0418f6c031e4dbdcc0c1ce7e5cc36bd)
bpo-32869: Fix incorrect dst buffer size for MultiByteToWideChar (GH-5739)
This function expects the destination buffer size to be given
in wide characters, not bytes.
(cherry picked from commit b3b4a9d3001f1fc7df8efcccdce081de54fa5eab)
Zachary Ware [Sun, 18 Feb 2018 01:27:22 +0000 (19:27 -0600)]
[3.6] bpo-30638: Add clinic to `make regen-all` (GH-5671)
Also, use PYTHON_FOR_REGEN for clinic and blake2s_impl.c rather than PYTHON_FOR_BUILD, and update .travis.yml to make use of the change.
(cherry picked from commit d6ff8a7037903497eff95fa32bdac2b6adf71505)
DOC: fix documentation for copyright and credits (GH-5706)
Adapt documentation for `copyright` and `credits` to reality. Previously, the documentation implied that all each of `copyright`,
`credits`, and `license`, would print a message to call the object in order to see the full text. In reality, only `license` exhibits this
behaviour, and `copyright` and `credit` print their full text either when printed, displayed, or called.
(cherry picked from commit 243d6d71265be1996a8326002deae429106a5fba)
Co-authored-by: Gerrit Holl <gerrit.holl@gmail.com>
bpo-32837: IDLE - require encoding argument for textview.view_file. (GH-5646)
Using the system and place-dependent default encoding for open()
is a bad idea for IDLE's system and location-independent files.
(cherry picked from commit 688722cedd6437910ff185ecf94fb3b749ad37f2)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
bpo-32826: Add "encoding=utf-8" to open() in idle_test/test_help_about. (GH-5639)
GUI test test_file_buttons() only looks at initial ascii-only lines,
but failed on systems where open() defaults to 'ascii' because
readline() internally reads and decodes far enough ahead to encounter
a non-ascii character in CREDITS.txt.
(cherry picked from commit f34e03ec0ea6a4cef8d966087c77e616c4a5893b)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Fix bug in travis configuration where it did not run the tests when
a change includes both code and doc changes.
(cherry picked from commit 32921f90821ab54ffb757b7e996e5b7a71fac25e)
bpo-6135: Fix subprocess.check_output doc to mention changes in 3.6 (GH-5564) (GH-5573)
Fixes the documentation for `subprocess.check_output()` not mentioning that the encoding and errors parameters were added in 3.6.
(cherry picked from commit fc1ce810f1da593648b4d19e7d582a235ec1dd37)
bpo-32777: Fix _Py_set_inheritable async-safety in subprocess (GH-5560) (GH-5563)
Fix a rare but potential pre-exec child process deadlock in subprocess on POSIX systems when marking file descriptors inheritable on exec in the child process. This bug appears to have been introduced in 3.4 with the inheritable file descriptors support.
This also changes Python/fileutils.c `set_inheritable` to use the "slow" two `fcntl` syscall path instead of the "fast" single `ioctl` syscall path when asked to be async signal safe (by way of being asked not to raise exceptions). `ioctl` is not a POSIX async-signal-safe approved function.
[3.6] bpo-8722: Document __getattr__ behavior with AttributeError in property (GH-5542)
When `__getattr__` is implemented, attribute lookup will always fall back to that,
even if the initial failure comes from `__getattribute__` or a descriptor's `__get__`
method (including property methods).
(cherry picked from commit d1f318105b8781b01f3507d5cb0fd841b977d5f2)
bpo-32720: Fixed the definition for width and precision in format mini-language doc (GH-5482) (GH-5525)
Changed the definition of width and precision from "integer" to "digit+" in format mini-language doc.
(cherry picked from commit 8b5fa289fdb04b6b919cf95fa99246aa872e47a8)
Fix typos found by codespell in docs, docstrings, and comments.
Fixes for the following files were in post-3.6 code and not backported:
Lib/ctypes/_aix.py (new), Lib/test/test_concurrent_futures.py,
Modules/_asynciomodule.c, Modules/_pickle.c, Objects/obmalloc.c.
Barry Warsaw [Sat, 3 Feb 2018 04:21:14 +0000 (23:21 -0500)]
[3.6] bpo-32303 - Consistency fixes for namespace loaders (GH-5481) (#5504)
* Make sure ``__spec__.loader`` matches ``__loader__`` for namespace packages.
* Make sure ``__spec__.origin` matches ``__file__`` for namespace packages.
Terry Jan Reedy [Fri, 2 Feb 2018 22:37:30 +0000 (17:37 -0500)]
[3.6] bpo-32614: Modify re examples to use a raw string to prevent wa… …rning (GH-5265) (GH-5500)
Modify RE examples in documentation to use raw strings to prevent DeprecationWarning.
Add text to REGEX HOWTO to highlight the deprecation. Approved by Serhiy Storchaka.
bpo-32674: Improve the docstring for __import__ (GH-5339) (GH-5489)
Clarify that the level argument is used to determine whether to
perform absolute or relative imports: 0 is absolute, while a positive number
is the number of parent directories to search relative to the current module.
(cherry picked from commit 461d225b195eec5269f317323b41115516144c41)
bpo-32735: Fix typo in f-strings datetime format specifier example (GH-5464) (GH-5465)
The f-string example for using datetime format specifier does not match the given output.
Changed the format from %b to %B so it matches the output of "January".
(cherry picked from commit b299393cc372f3ecbef4304f8eaa4c7838e975ca)
Xiang Zhang [Wed, 31 Jan 2018 13:34:17 +0000 (21:34 +0800)]
[3.6] bpo-32583: Fix possible crashing in builtin Unicode decoders (GH-5325) (#5459)
When using customized decode error handlers, it is possible for builtin decoders
to write out-of-bounds and then crash..
(cherry picked from commit 2c7fd46e11333ef5e5cce34212f7d087694f3658)
[3.6] closes bpo-30117: fix lib2to3 ParserIdempotency test (GH-1242) (GH-5443)
Fix two (in my opinion) spurious failure conditions in the lib2to3.tests.test_parser.TestParserIdempotency test_parser test.
Use the same encoding found in the initial file to write a temp file for a diff. This retains the BOM if the encoding was initially utf-8-sig.
If the file cannot be parsed using the normal grammar, try again with no print statement which should succeed for valid files using future print_function
For case (1), the driver was correctly handling a BOM in a utf-8 file, but then the test was not writing a comparison file using 'utf-8-sig' to diff against, so the BOM got removed. I don't think that is the fault of the parser, and lib2to3 will retain the BOM.
For case (2), lib2to3 pre-detects the use of from __future__ import print_function or allows the user to force this interpretation with a -p flag, and then selects a different grammar with the print statement removed. That makes the test cases unfair to this test as the driver itself doesn't know which grammar to use. As a minimal fix, the test will try using a grammar with the print statement, and if that fails fall back on a grammar without it. A more thorough handling of the idempotency test would to be to parse all files using both grammars and ignore if one of the two failed but otherwise check both. I didn't think this was necessary but can change..
(cherry picked from commit 14e976e00e65bf343ba0fca016c3c9132a843daf)
Document the error return of PyLong_As* APIs. (GH-5396) (#5404)
Document the error return of PyLong_As* APIs.
A frequent Python C API usage error is neglecting to check the return
value and/or PyErr_Occurred().
(cherry picked from commit f5b04a360e44aa9733f7a92dd66d2292d6c52955)
Antoine Pitrou [Sun, 28 Jan 2018 17:42:31 +0000 (18:42 +0100)]
[3.6] bpo-32228: Reset raw_pos after unwinding the raw stream (GH-4858) (#5389)
Ensure that ``truncate()`` preserves the file position (as reported by ``tell()``) after writes longer than the buffer size..
(cherry picked from commit 059f58ce938d9c3f0286412a4efb1b9131339421)
Travis when merging changes from a pull request onto the target branch
does not perform a rebase, instead it does a simple merge which causes
the PR commits to retain their commit dates. This means that the commit
log can potentially look like:
PR merge <-- HEAD
normal master commit <- master
more commits from normal workflow
PR commit 1
another master commit
PR commit 2
Performing a git diff from PR commit 2 to master will accidentally
include files that should not be there.
Cheryl Sabella [Sat, 27 Jan 2018 02:45:24 +0000 (21:45 -0500)]
[3.6] bpo-27505: Retrofit module __class__ documentation from 3.7 (GH-5321)
The module `__class__` attribute documentation added to 3.7 for PEP 562
(dynamic module attributes) also applies to earlier versions. This backports
that subset of the new docs to the 3.6 branch so that it will appear in the
main online documentation and in the final 3.6 binary release.
bpo-32667: Fix tests when $PATH contains a file (GH-5322) (#5323)
Some tests failed when the PATH environment variable contained a path
to an existing file. Fix tests to ignore also NotADirectoryError, not
only FileNotFoundError and PermissionError.
(cherry picked from commit b31206a223955d614d7769f95fb979d60f77bf87)