Commit Graph

80506 Commits

Author SHA1 Message Date
Jamie Davis 55d5bfba94 [2.7] closes bpo-32997: Fix REDOS in fpformat (GH-5984)
The regex to decode a number in fpformat is susceptible to catastrophic backtracking. This is a potential DOS vector if a server is using fpformat on untrusted number strings.

Replace it with an equivalent non-vulnerable regex. The match behavior of the new regex is slightly different. It captures the whole integer part of the number in one group, Leading zeros are stripped off later.
2018-03-05 21:59:02 -08:00
Benjamin Peterson e052d40cea
[2.7] bpo-32981: Fix catastrophic backtracking vulns (GH-5955)
* Prevent low-grade poplib REDOS (CVE-2018-1060)

The regex to test a mail server's timestamp is susceptible to
catastrophic backtracking on long evil responses from the server.

Happily, the maximum length of malicious inputs is 2K thanks
to a limit introduced in the fix for CVE-2013-1752.

A 2KB evil response from the mail server would result in small slowdowns
(milliseconds vs. microseconds) accumulated over many apop calls.
This is a potential DOS vector via accumulated slowdowns.

Replace it with a similar non-vulnerable regex.

The new regex is RFC compliant.
The old regex was non-compliant in edge cases.

* Prevent difflib REDOS (CVE-2018-1061)

The default regex for IS_LINE_JUNK is susceptible to
catastrophic backtracking.
This is a potential DOS vector.

Replace it with an equivalent non-vulnerable regex.

Also introduce unit and REDOS tests for difflib.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
Co-authored-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 0e6c8ee235)
2018-03-03 22:18:17 -08:00
Brett Cannon 20003f9162
bpo-32963: Fix the tutorial to state source has a default encoding of ASCII (GH-5961) 2018-03-02 14:10:21 -08:00
Alexey Izbyshev aa40f92240 [2.7] bpo-32903: Fix a memory leak in os.chdir() on Windows (GH-5801). (#5947)
(cherry picked from commit 3e197c7a67)

Co-authored-by: Alexey Izbyshev <izbyshev@users.noreply.github.com>
2018-03-01 18:27:34 +08:00
bennorth c20c97f612 bpo-18533: Avoid RuntimeError from repr() of recursive dictview (#4823) (#5357)
(cherry picked from commit d7773d92bd)
2018-02-27 00:35:03 +02:00
Miss Islington (bot) ecaa372f74
bpo-32500: Correct the documentation for PySequence_Size() and PySequence_Length() (GH-5767)
Dropped the part that says: "For objects that do not provide sequence protocol".
(cherry picked from commit 7a1e1786f9)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2018-02-25 13:22:43 -08:00
Cheryl Sabella b7c1a94f94 [2.7] bpo-25059: Clarify the print separator usage in tutorial (GH-5879)
By default `print` adds spaces between its arguments.

(cherry picked from commit 84c4b0cc67)
2018-02-25 12:50:26 -08:00
Miss Islington (bot) 76349471ad
bpo-31454: Include information about "import X as Y" in Modules tutorial (GH-4041)
(cherry picked from commit fbee88244e)

Co-authored-by: Mario Corchero <mariocj89@gmail.com>
2018-02-25 11:38:24 -08:00
Miss Islington (bot) 07c13eee79
Delete a broken threading.local example (GH-5870)
This code never did anything correct or useful. The class attribute will never be affected, and the condition will never be true.
(cherry picked from commit 5fb632e831)

Co-authored-by: Aaron Gallagher <habnabit@users.noreply.github.com>
2018-02-25 07:34:46 -08:00
Christian Heimes df1732a473
[2.7] bpo-30622: Fix NPN for OpenSSL 1.1.1-pre1 (GH-5876) (#5882)
Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 29eab55309)

Co-authored-by: Christian Heimes <christian@python.org>
2018-02-25 14:28:55 +01:00
Christian Heimes 439956a149
Fix ssl module, Python 2.7 doesn't have Py_MAX (#5878)
Signed-off-by: Christian Heimes <christian@python.org>
2018-02-25 13:08:05 +01:00
Christian Heimes 4bb9b9aea0
[2.7] bpo-32647: Link ctypes extension with libdl. (GH-5550) (#5877)
The ctypes module used to depend on indirect linking for dlopen. The shared
extension is now explicitly linked against libdl on platforms with dl.

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 5bb9692575)

Co-authored-by: Christian Heimes <christian@python.org>
2018-02-25 12:31:17 +01:00
Christian Heimes 3d87f4cf9c
[2.7] bpo-30622: Improve NPN support detection (GH-5859) (#5863)
The ssl module now detects missing NPN support in LibreSSL.

Co-Authored-By: Bernard Spil <brnrd@FreeBSD.org>
Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 6cdb7954b0)

Co-authored-by: Christian Heimes <christian@python.org>
2018-02-25 10:21:03 +01:00
Miss Islington (bot) a5c9112300 [2.7] bpo-32185: Don't send IP in SNI TLS extension (GH-5865) (#5871)
The SSL module no longer sends IP addresses in SNI TLS extension on
platforms with OpenSSL 1.0.2+ or inet_pton.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit e9370a4738)

Co-authored-by: Christian Heimes <christian@python.org>
2018-02-25 10:16:37 +01:00
Christian Heimes 6e8f395001
bpo-25404: SSLContext.load_dh_params() non-ASCII path (GH-3459)
SSLContext.load_dh_params() now supports non-ASCII path.

Signed-off-by: Christian Heimes <christian@python.org>
2018-02-25 09:48:02 +01:00
Christian Heimes 8d4d17399f
bpo-31518: Change TLS protocol for Debian (#3661)
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>
2018-02-25 00:45:53 +01:00
Miss Islington (bot) 8a7f1f4b0f
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 98f42aac23)

Co-authored-by: Mariatta <Mariatta@users.noreply.github.com>
2018-02-23 10:16:56 -08:00
Anselm Kruis 61bd4d2e63 [2.7] bpo-30028: make test.support.temp_cwd() fork-safe (GH-1066) (GH-5825)
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 33dddac00b)

Co-authored-by: Anselm Kruis <a.kruis@science-computing.de>
2018-02-23 08:27:28 -08:00
Miss Islington (bot) b852d8c1f0 [2.7] bpo-31848: Fix broken error handling in Aifc_read.initfp() when the SSND chunk is not found (GH-5240) (GH-5781)
Initialize self._ssnd_chunk so that aifc.Error is raised as intended,
not AttributeError.
(cherry picked from commit 80d20b918b)


Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2018-02-21 08:37:18 +02:00
Benjamin Peterson 6c7edba166
[2.7] closes bpo-32008: don't use PROTOCOL_TLSv1 in example (GH-5789) (#5792)
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 e9edee0b65)
2018-02-20 22:17:10 -08:00
Raymond Hettinger 5dc275a2c0
Fix typo in docs (GH-5763) 2018-02-19 15:39:20 -08:00
Éric Araujo eeb33651bf [2.7] bpo-21060 Improve error message for "setup.py upload" without dist files (GH-5726).
(cherry picked from commit 08a6926b25)

Co-authored-by: Éric Araujo <merwok@netwok.org>
2018-02-18 19:56:06 -08:00
Zachary Ware 21f53e7249
[2.7] Clean up Travis config (GH-5727)
(cherry picked from commit 7eb3f8226e)
2018-02-18 15:45:48 -06:00
Miss Islington (bot) fd9d1c901d
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 243d6d7126)

Co-authored-by: Gerrit Holl <gerrit.holl@gmail.com>
2018-02-16 20:11:48 -08:00
Miss Islington (bot) 836b642148
Update comment in posixmodule.c (GH-5681)
A closing parentheses was missing.

Signed-off-by: Ngie Cooper <yaneurabeya@gmail.com>
(cherry picked from commit 7745ec4e35)

Co-authored-by: ngie-eign <1574099+ngie-eign@users.noreply.github.com>
2018-02-14 12:43:17 -08:00
Miss Islington (bot) 877112567a
Fix installation instructions for *nix (GH-5605)
Remove pkg_add -r python from FreeBSD installation section.
Moved to OpenBSD.
(cherry picked from commit 3384d38d51)

Co-authored-by: Eitan Adler <grimreaper@users.noreply.github.com>
2018-02-13 19:55:09 -08:00
Benjamin Peterson 23f0a5eabc
[2.7] remove mercurial dot files (GH-5558).
(cherry picked from commit 2b86f4cb2c)
2018-02-13 19:17:10 -08:00
Serhiy Storchaka 17cec70a38
bpo-30109: Fix reindent.py for non-ASCII files. (#5637)
It now processes files as binary streams.

This also fixes "make reindent".
2018-02-12 20:16:42 +02:00
Miss Islington (bot) 4029064716
Fix typo in Include/objimpl.h, the word "has" was missing (GH-5568) (GH-5571)
It now reads: ...be aware that Python has no control over...
(cherry picked from commit 517da1e58f)

Co-authored-by: Alexey <forestbiiird@gmail.com>
2018-02-12 00:06:48 -08:00
Miss Islington (bot) 2cf880498a Fix AppVeyor doc short-circuit (GH-5635)
(cherry picked from commit 6ea20fc719)
2018-02-11 16:29:11 -06:00
Zachary Ware 239e13b3b8
[2.7] Add short-circuit for doc changes to AppVeyor (GH-5629)
(cherry picked from commit 28607e0dd9)
2018-02-11 13:57:11 -06:00
Miss Islington (bot) ea6e6444bd bpo-32800: Update link to w3c doc for xml default namespaces (GH-5609) (GH-5613)
The new link is given in a red box on the old page.
(cherry picked from commit 8d1f2f4038)

Co-authored-by: sblondon <sblondon@users.noreply.github.com>
2018-02-10 19:42:42 -05:00
Serhiy Storchaka e7197936c9
[2.7] bpo-30157: Fix csv.Sniffer.sniff() regex pattern. (GH-5601) (GH-5604)
Co-authored-by: Jake Davis <jcdavis@awedge.net>.
(cherry picked from commit 2411292ba8)
2018-02-10 00:02:04 +02:00
Stéphane Wirtel 672fd7d816 bpo-32784: Wrong argument name for csv.DictReader in documentation (GH-5575)
Use `f` as the name of the first parameter of `csv.DictReader` and
`csv.DictWriter` classes.
2018-02-07 08:05:35 -08:00
INADA Naoki 2942b909d9
bpo-32616: Disable computed gotos by default for clang < 5 (GH-5574) 2018-02-07 19:09:36 +09:00
Benjamin Peterson 0a18422b31
allow the test suite to pass if the strop module doesn't exist (GH-5566)
strop is highly legacy and can be safely compiled out in most installations. Let's not fail the test suite for its absence.
2018-02-06 09:29:21 -08:00
Raymond Hettinger 2a4e2ea112
Fix typo -- missing "not" (GH-5532) 2018-02-04 10:34:29 -08:00
Raymond Hettinger 42e8ea9f69
bpo-32739: Show default value for rotate() (GH-5517)
Manual backport of GH-5485
2018-02-03 13:57:02 -08:00
Ned Deily 2357cd71b0 Update Doc build for split off of 3.7 branch 2018-02-03 16:31:41 -05:00
Mariatta 9b7b3a6456
bpo-32674: Improve the docstring for __import__ (GH-5339) (GH-5494)
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 461d225b19)

Co-authored-by: oldk <oldk1331@users.noreply.github.com>
2018-02-02 11:23:53 -05:00
Serhiy Storchaka b7a2c17be8
[2.7] bpo-32137: The repr of deeply nested dict now raises a RuntimeError (GH-4570) (#5493)
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-02 16:29:02 +02:00
Victor Stinner b60f43a0e6
bpo-30595: Increase test_queue_feeder_donot_stop_onexc() timeout (GH-2148) (GH-5429)
_test_multiprocessing.test_queue_feeder_donot_stop_onexc() now uses a
timeout of 1 second on Queue.get(), instead of 0.1 second, for slow
buildbots.

(cherry picked from commit 8f6eeaf21c)
2018-01-29 16:54:29 +01:00
Bo Bayles f5a793522d bpo-32304: Fix distutils upload for tar files ending with b'\r' (GH-5264) (GH-5331)
Patch by Bo Bayles.
2018-01-29 09:31:32 -05:00
Miss Islington (bot) 5679277fdd Fix PyTrace_RETURN documentation (GH-5384) (GH-5387)
It will be triggered when propagating an exception.
(cherry picked from commit 79db11ce99)
2018-01-28 23:49:14 +08:00
Miss Islington (bot) 745e9de7dd bpo-32687: Fix wrong meaning of args for PyTrace_LINE/CALL in documentation (GH-5361) (GH-5378)
(cherry picked from commit 9ed0aee27c)
2018-01-28 16:41:29 +08:00
Christian Heimes 38487a05cc
[2.7] bpo-32521: nis libnsl (GH-5190) (#5353)
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:39 +01:00
Mariatta f5e8f71fe3
[2.7] bpo-32640: Clarify the behavior of str.join and unicode object (GH-5333)
In str.join, if any of the iterable contains a Unicode object,
str.join will return a Unicode object.

A Type error will be raised if iterable contains values other
than a string or Unicode object.
2018-01-26 09:55:15 -08:00
Victor Stinner 6996f284d4
bpo-32667: Fix tests when $PATH contains a file (#5324)
test_subprocess.test_leaking_fds_on_error() failed when the PATH
environment variable contains a path to an existing file. Fix the
test: ignore also ENOTDIR, not only ENOENT and EACCES.
2018-01-25 22:41:38 +01:00
Xiang Zhang e64a47b37d
bpo-17799: Explain real behaviour of sys.settrace and sys.setprofile (GH-4056). (#5299)
(cherry picked from commit 131fd7f96c)
2018-01-24 22:53:42 +08:00
Miss Islington (bot) 6ccdad7b1f bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (GH-5284) (#5295)
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 10:51:39 +01:00