Commit Graph

98662 Commits

Author SHA1 Message Date
Miss Islington (bot) 688b6dec4e bpo-32137: The repr of deeply nested dict now raises a RecursionError (GH-4570) (GH-4689)
instead of crashing due to a stack overflow.

This perhaps will fix similar problems in other extension types.
(cherry picked from commit 1fb72d2ad2)
2018-02-01 13:57:28 +02:00
Miss Islington (bot) 581ce25e1f 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 b299393cc3)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2018-01-31 17:17:02 -05:00
Miss Islington (bot) 85a92d00bd bpo-32727: smtplib's SMTP.send_message behaves differently with from_addr and to_addrs (GH-5451) (#5455)
Do not pass the name field in the 'from' address in the SMTP envelope.
(cherry picked from commit 8d83e4ba78)

Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
2018-01-31 15:54:09 -05:00
Xiang Zhang ea94fce696
[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 2c7fd46e11)
2018-01-31 21:34:17 +08:00
Benjamin Peterson eb126eddbd
[3.6] compare with difflib not diff(1) (GH-5450) (GH-5453)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
2018-01-30 11:31:10 -08:00
Benjamin Peterson a23a2c555c
[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 14e976e00e)
2018-01-30 10:23:17 -08:00
Miss Islington (bot) 6b2bbcc4cc closes bpo-32721: do not fail test_hashlib if _md5 isn't available (GH-5441) (GH-5442)
(cherry picked from commit 95441809ef)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2018-01-29 23:01:32 -08:00
Benjamin Peterson 88fa79a10a
[3.6] replace dynamic import with 'exec' with importlib.import_module (GH-5433) (GH-5440)
(cherry picked from commit 77526f05fa)
2018-01-29 22:02:09 -08:00
Nick Coghlan 05f91a42cd
[3.6] Revert "bpo-32690: Preserve order of locals() (GH-5379) (#5390)"
This reverts commit 9105879bfd
in order to keep the behaviour of locals() consistent between
3.6.4 and 3.6.5+.
2018-01-30 15:27:41 +10:00
Miss Islington (bot) 04f99ba9d7 bpo-32701: Clarify the quotetabs flag in quopri documentation (GH-5401) (GH-5438)
(cherry picked from commit 9424dcbb3e)

Co-authored-by: Julien Palard <julien@palard.fr>
2018-01-29 20:16:21 -08:00
Miss Islington (bot) 6ea75b174d bpo-27931: Fix email address header parsing error (GH-5329) (GH-5431)
Correctly handle addresses whose username is an empty quoted string.
(cherry picked from commit aa218d1649)

Co-authored-by: jayyyin <jayyin11043@hotmail.com>
2018-01-29 14:27:55 -08:00
Miss Islington (bot) 5869861823 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 f5b04a360e)
2018-01-29 09:24:11 -08:00
Victor Stinner 0cecc22842
bpo-20891: Remove test_capi.test_bpo20891() (#5425)
My first fix is not enough to make test_bpo20891() reliable. A second
fix is needed and it was decided to not backport it, so remove the
test instead.

For Python 3.6, the workaround is to call PyEval_InitThreads() before
spawning the first C thread.

Python 3.7 will have both fixes.
2018-01-29 16:35:50 +01:00
Miss Islington (bot) 757aad6748 Add a test for pdb until command in coroutine (GH-5427) (#5428)
(cherry picked from commit 4f4ef0acba)
2018-01-29 16:56:46 +02:00
Miss Islington (bot) d9c743b2d1 bpo-32650: Add an asyncgen pdb test (GH-5406) (#5419)
(cherry picked from commit 9ee1bf9ab5)
2018-01-29 12:41:34 +02:00
Miss Islington (bot) 190de183e5 Fix minor markup typo (GH-5407) (#5416)
(cherry picked from commit 2a3260bb03)
2018-01-29 01:24:09 -08:00
Andrew Svetlov 3cfb84c657
[3.6] bpo-32650 Add support for async generators and more test for coroutines in pdb (GH-5403). (#5411)
(cherry picked from commit c7ab581db2)
2018-01-29 08:51:07 +02:00
Miss Islington (bot) 543ec005a4 bpo-32650: Add native coroutine support to bdb when stepping over line (GH-5400) (#5402)
(cherry picked from commit 4687702442)
2018-01-29 07:57:06 +02:00
Miss Islington (bot) 9105879bfd bpo-32690: Preserve order of locals() (GH-5379) (#5390)
(cherry picked from commit a4d0001256)
2018-01-28 10:13:17 -08:00
Antoine Pitrou 1d896ed2cd
[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 059f58ce93)
2018-01-28 18:42:31 +01:00
Miss Islington (bot) 33febfb039 Fix PyTrace_RETURN documentation (GH-5384) (GH-5386)
It will be triggered when propagating an exception.
(cherry picked from commit 79db11ce99)
2018-01-28 23:33:23 +08:00
Miss Islington (bot) b3b4b81d01 bpo-32685: Improve suggestion for print statement (GH-5380)
Better account for single-line compound statements and
semi-colon separated statements when suggesting
Py3 replacements for Py2 print statements.

Initial patch by Nitish Chandra.
(cherry picked from commit 43c0f1ac5e)
2018-01-28 21:31:48 +10:00
Miss Islington (bot) 854f0424de bpo-32687: Fix wrong meaning of args for PyTrace_LINE/CALL in documentation (GH-5361) (GH-5377)
(cherry picked from commit 9ed0aee27c)
2018-01-28 16:41:05 +08:00
Miss Islington (bot) 0135dfdc1f Minor grammar fixes to License.rst (GH-1174) (GH-5373)
(cherry picked from commit 8312fba0a1)
2018-01-27 21:06:12 -08:00
Miss Islington (bot) d331515847 [3.6] bpo-32664: Add missing "|" connector in Exceptions doc (GH-1173) (GH-5372)
(cherry picked from commit 992ae6444c)
2018-01-27 19:52:52 -08:00
Miss Islington (bot) 4d2dd64471 Fix changed file detection on Travis (GH-3129)
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.

Closes python/core-workflow#14

(cherry picked from commit b2ec3615c8)
2018-01-28 01:48:09 +03:00
Miss Islington (bot) d7274c6638 Fix wrong assert in unicodeobject (GH-5340)
(cherry picked from commit 7cc95f5069)
2018-01-28 02:41:24 +09:00
Christian Heimes 12ae40766e
[3.6] bpo-32521: nis libnsl (GH-5190) (#5352)
* bpo-32521: nis libnsl (#5190)

The nismodule is now compatible with new libnsl and headers location

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 29a7df7827)
2018-01-27 09:39:16 +01:00
Cheryl Sabella 8f68cb7db3 [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.

Patch by Cheryl Sabella.
2018-01-27 12:45:24 +10:00
Bo Bayles 995c60d265 [3.6] bpo-32304: Fix distutils upload for tar files ending with b'\r' (GH-5264) (GH-5330)
Patch by Bo Bayles.
2018-01-26 21:18:58 -05:00
Miss Islington (bot) 255dbd2102 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 b31206a223)
2018-01-25 22:39:36 +01:00
Miss Islington (bot) 196b8cbab2 bpo-32651 Recommend getpass.getuser() (GH-5301) (#5304)
* bpo-32651 - In the documentation for os.getlogin(), recommend getpass.getuser()
(cherry picked from commit d499031f5f)
2018-01-24 14:09:56 -05:00
Xiang Zhang fd844efa9c
bpo-17799: Explain real behaviour of sys.settrace and sys.setprofile (GH-4056) (#5298)
(cherry picked from commit 131fd7f96c)
2018-01-24 22:44:53 +08:00
Bo Bayles d69794f4df [3.6] bpo-32502: Discard 64-bit (and other invalid) hardware addresses (GH-5254) (#5290)
* [3.6] bpo-32502: Discard 64-bit (and other invalid) hardware addresses (GH-5254).
(cherry picked from commit 6b273f7f40)
2018-01-24 08:27:14 -05:00
Miss Islington (bot) 8e230e1eb3 bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (GH-5284) (#5296)
glibc is deprecating libcrypt in favor of libxcrypt, however python assumes
that crypt.h will always be included. This change makes the header inclusion
explicit when libxcrypt is present on the system.
(cherry picked from commit e768c86ef4)
2018-01-24 11:11:16 +01:00
Miss Islington (bot) 6abbf14a87 bpo-32618: Fix test_mutatingdecodehandler not testing test.mutating (GH-5269) (#5285)
It should test both test.replacing and test.mutating instead of test test.replacing twice.
(cherry picked from commit 370d04d1dc)
2018-01-23 23:47:15 +08:00
Miss Islington (bot) 4002d5dbf4 [3.6] bpo-32028: Fix suggestions for indented print statements (GH-5249)
The suggested replacement for print statements previously failed to account
for leading whitespace and hence could end up including unwanted text in
the proposed call to the print builtin.

Patch by Sanyam Khurana.
(cherry picked from commit d57f26c753)
2018-01-20 13:56:31 +10:00
Miss Islington (bot) 051650ab8d Removed unnecesssary bit inversion which doesn't improve dispersion statistics (GH-5235) (#5236)
(cherry picked from commit fa78806041)
2018-01-18 14:27:22 -08:00
Steve Dower ccf7f05c5d
[3.6] bpo-32588 Move _distutils_findvs into its own module (GH-5227) (#5228) 2018-01-19 09:09:49 +11:00
Miss Islington (bot) f31c70b0d6 Fix typo in thread_nt.h code comment (GH-5211) (GH-5226)
The comment for PyThread_allocate_lock says "It has too be implemented ...".
There was an extra "o" in ".. to be implemented.."
(cherry picked from commit 6027802ca7)
2018-01-17 16:40:33 -08:00
Miss Islington (bot) 8d1e41d414 Use assertCountEqual instead of assertEqual. (GH-5223) (#5225)
This test doesn't care about order, the underlying filesystem APIs do not
guarantee directory listings on subsequent calls will be in the same order.
(cherry picked from commit 3941499d6c)
2018-01-17 15:51:27 -08:00
Miss Islington (bot) 4e09c0c858 pythoninfo: add time.time and datetime.datetime.now (GH-5214) (#5219)
(cherry picked from commit 7d91c02504)
2018-01-17 17:36:04 +01:00
Miss Islington (bot) c2740e8a26 Skip test_readline.test_nonascii() on C locale (GH-5203) (#5204)
bpo-29240: On FreeBSD, if the LC_CTYPE locale is "C" or "POSIX",
writing and reading non-ASCII bytes into/from a TTY works,
but readline or ncurses ignores non-ASCII bytes on read.
(cherry picked from commit c495e799ed)
2018-01-16 18:27:29 +01:00
Miss Islington (bot) e7dbd06583 bpo-26163: Frozenset hash improvement (GH-5194) (#5198)
(cherry picked from commit b44c5169f6)
2018-01-16 02:27:15 -08:00
Victor Stinner b92c159efa
[3.6] bpo-32555: Fix locale encodings (#5193)
On FreeBSD and Solaris, os.strerror() now always decode the byte
string from the current locale encoding, rather than using
ASCII/surrogateescape in some cases.

Changes:

* Add _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() which has an
  additional current_locale parameter.
* PyUnicode_DecodeLocale(), PyUnicode_DecodeLocaleAndSize() and
* PyUnicode_EncodeLocale() now always use the current locale
* encoding, instead of using Py_DecodeLocale()/Py_EncodeLocale().
* Document encoding in Py_DecodeLocale() and Py_EncodeLocale()
  documentations.
* Add USE_FORCE_ASCII define to not define
  decode_ascii_surrogateescape() on Android.
2018-01-15 23:43:24 +01:00
Victor Stinner 5f959c4f9e
[3.6] bpo-31900: Fix localeconv() encoding for LC_NUMERIC (#4174) (#5192)
* Add _Py_GetLocaleconvNumeric() function: decode decimal_point and
  thousands_sep fields of localeconv() from the LC_NUMERIC encoding,
  rather than decoding from the LC_CTYPE encoding.
* Modify locale.localeconv() and "n" formatter of str.format() (for
  int, float and complex to use _Py_GetLocaleconvNumeric()
  internally.

(cherry picked from commit cb064fc232)
2018-01-15 23:23:47 +01:00
Miss Islington (bot) fb8569e36f bpo-26330: Update shutil.disk_usage() documentation (GH-5184) (GH-5188)
Clarify that on Windows, path must be a directory.
On Unix, path can be a file or a directory.
(cherry picked from commit ee3b83547c)
2018-01-15 06:32:11 -08:00
Miss Islington (bot) bb80645d06 bpo-15221: Update os.path.is*() documentation (GH-5185) (GH-5186)
`os.path.is*()` can return False if the file can't be accessed.
The behaviour is documented in details in `os.path.exists()`.
Link to `os.path.exists()` from `os.path.is*()`.
(cherry picked from commit b3dd18d403)
2018-01-14 21:44:49 -08:00
Miss Islington (bot) cf4cd4bccb Add itertools recipe for directly finding the n-th combination (GH-5161) (#5174)
(cherry picked from commit d37258dd2e)
2018-01-13 11:21:15 -08:00
Miss Islington (bot) 29b1aff718 Improve enum.Flag code example (GH-5167) (GH-5171)
The code example that demonstrate how to use enum.Flag was missing
the import of enum.auto.
(cherry picked from commit 0f31c74fcf)
2018-01-12 20:23:21 -08:00