Commit Graph

105292 Commits

Author SHA1 Message Date
Jason R. Coombs a0d4aac50b
[3.8] bpo-38121: Sync importlib.metadata with 0.22 backport (GH-15993) (GH-16064)
* bpo-38121: Sync importlib.metadata with 0.22 backport

* 📜🤖 Added by blurb_it..
(cherry picked from commit 8ed6503eca)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2019-09-12 16:41:31 +01:00
Miss Islington (bot) d04c85f5a7 bpo-38096: Complete the "structseq" and "named tuple" cleanup (GH-16010) (GH-16062)
(cherry picked from commit 4210ad5ebd)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-09-12 08:20:31 -07:00
Miss Islington (bot) 98a4a713d0 bpo-37935: Added tests for os.walk(), glob.iglob() and Path.glob() (GH-15956) (GH-16043)
Test that they do not keep too many file descriptors open for the host OS in a reasonable test scenario.

See [bpo-37935](https://bugs.python.org/issue37935).
(cherry picked from commit f9dc2ad890)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-09-12 16:07:47 +01:00
Stéphane Wirtel 36c29e444d [3.8] bpo-38137: Re-add OpenSSL 1.0.2 compat (GH-16051) (GH-16057)
The defines are required for OpenSSL 1.0.2 and LibreSSL.

https://bugs.python.org/issue38134

Automerge-Triggered-By: @tiran
(cherry picked from commit 9a4963b932)

Co-authored-by: Christian Heimes <christian@python.org>


https://bugs.python.org/issue38137



Automerge-Triggered-By: @matrixise
2019-09-12 07:57:03 -07:00
Miss Islington (bot) 307c5fe942
bpo-37488 : Document a warning for datetime.utcnow() and utcfromtimestamp() (GH-15773)
https://bugs.python.org/issue37488

Automerge-Triggered-By: @pganssle
(cherry picked from commit 1a53c785e6)

Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>
2019-09-12 07:55:48 -07:00
Miss Islington (bot) 824407f76e
bpo-21872: fix lzma library decompresses data incompletely (GH-14048)
* 1. add test case with wrong behavior
* 2. fix bug when max_length == -1
* 3. allow b"" as valid input data for decompress_buf()
* 4. when max_length >= 0, let needs_input mechanism works
* add more asserts to test case
(cherry picked from commit 4ffd05d7ec)

Co-authored-by: animalize <animalize@users.noreply.github.com>
2019-09-12 07:41:11 -07:00
Miss Islington (bot) 8976359c59
Overhaul datetime documentation (GH-13410)
This is a restructuring of the datetime documentation to hopefully make
them more user-friendly and approachable to new users without losing any
of the detail.

Changes include:
 - Creating dedicated subsections for some concepts such as:
    - "Constants"
    - "Naive vs Aware"
    - "Determining if an Object is Aware"
 - Give 'naive vs aware' its own subsection
 - Give 'constants' their own subsection
 - Overhauling the strftime-strptime section by:
    - Breaking it into logical, linkable, and digestable parts
    - Adding a high-level comparison table
    - Moving the technical detail to bottom: readers come to this
      section primarily to remind themselves to things:
      - How do I write the format code for X?
      - strptime/strftime: which one is which again?
 - Touching up fromisoformat + isoformat sections by:
    - Revising fromisoformat + isoformat for date, time, and
      datetime
    - Adding basic examples
    - Enforcing consistency about putting formats (i.e. ``HH:MM``)
      in double backticks.  This was previously done in some places
      but not all
    - Putting long 'supported formats', on their own line to improve
      readability
 - Moving the 'seealso' section to the top and add a link to dateutil
    Rationale: This doesn't really belong nested under the
    'constants' section.  Let readers know right away that
    datetime is one of several related tools.
 - Moving common features of several types into one place:
    Previously, each type went out of its way to note separately
    that it was hashable and picklable.  These can be brought
    into one single place that is more prominent.
 - Reducing some verbose explanations to improve readability
 - Breaking up long paragraphs into digestable chunks
 - Displaying longer "equivalent to" examples, as short code blocks
 - Using the dot notation for datetime/time classes:
    Use :class:`.time` and :class:`.datetime` rather than :class:`time` and
    :class:`datetime`; otherwise, the generated links will route to the
    respective modules, not classes.
 - Rewording the tzinfo class description
    The top paragraph should get straight to the point of telling the reader
    what subclasses of tzinfo _do_.  Previously, that was hidden in a later
    paragraph.
 - Adding a note on .today() versus .now()
 - Rearranging and expanding example blocks, including:
    - Moved long, multiline inline examples to standalone examples
    - Simplified the example block for timedelta arithmetic:
        - Broke the example into two logical sections:
          1. normalization/parameter 'merging'
          2. timedelta arithmetic
        - Reduced the complexity of the some of the examples.  Show
          reasonable, real-world uses cases that are easy to follow
          along with and progres in difficult slightly.
    - Broke up the example sections for date and datetime sections by putting
      the easy examples first, progressing to more esoteric situations and
      breaking it up into logical sections based on what the methods are
      doing at a high level.
    - Simplified the KabulTz example:
        - Put the class definition itself into a non-REPL block since there is
          no interactive output involved there
        - Briefly explained what's happening before launching into the code
        - Broke the example section into visually separate chunks
 - Various whitespace, formatting, style and grammar fixes including:
    - Consistently using backctics for 'date_string' formats
    - Consistently using one space after periods.
    - Consistently using bold for vocab terms
    - Consistently using italics when referring to params:
      See https://devguide.python.org/documenting/GH-id4
    - Using '::' to lead into code blocks
        Per https://devguide.python.org/documenting/GH-source-code, this will
        let the reader use the 'expand/collapse' top-right button for REPL
        blocks to hide or show the prompt.
    - Using consistent captialization schemes
    - Removing use of the default role
    - Put 'example' blocks in Markdown subsections

This is a combination of 66 commits.

See bpo-36960: https://bugs.python.org/issue36960
(cherry picked from commit 3fb1363fe8)

Co-authored-by: Brad <brad.solomon.1124@gmail.com>
2019-09-12 07:37:36 -07:00
Miss Islington (bot) 717cc61ed1
bpo-36991: Fix incorrect exception escaping ZipFile.extract() (GH-13632)
(cherry picked from commit 2f1b857562)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2019-09-12 07:33:53 -07:00
Miss Islington (bot) 0d7cb5bb29
bpo-38132: Check EVP_DigestUpdate for error (GH-16041)
(cherry picked from commit 8c74574e0a)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-12 06:50:46 -07:00
Miss Islington (bot) 2f01cf6187
bpo-37363: Document internal audit events (GH-14663)
Three internal cpython events were not documented, yet.

Signed-off-by: Christian Heimes <christian@python.org>

https://bugs.python.org/issue37363
(cherry picked from commit ed4b3216e5)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-12 06:20:26 -07:00
Miss Islington (bot) 67b90a079c bpo-38132: Simplify _hashopenssl code (GH-16023) (#16040)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 5a4f82f457)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-12 14:03:50 +01:00
Miss Islington (bot) 345bfc990f
bpo-36373: Deprecate explicit loop in task and subprocess API (GH-16033)
(cherry picked from commit a488879cba)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-12 05:59:50 -07:00
Miss Islington (bot) 535863e3f5
bpo-26868: Fix example usage of PyModule_AddObject. (GH-15725)
* Add a note to the PyModule_AddObject docs.

* Correct example usages of PyModule_AddObject.

* Whitespace.

* Clean up wording.

* 📜🤖 Added by blurb_it.

* First code review.

* Add < 0 in the tests with PyModule_AddObject
(cherry picked from commit 224b8aaa7e)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2019-09-12 05:26:46 -07:00
Miss Islington (bot) 14afe203d6
bpo-35325: Doc: imp.find_module() return value documentation discrepancy (GH-11040)
(cherry picked from commit 967b84c913)

Co-authored-by: Windson yang <wiwindson@outlook.com>
2019-09-12 05:25:54 -07:00
Miss Islington (bot) 80e33655a2
bpo-38134: Remove PKBDF2_HMAC_fast from _hashopenssl (GH-16028)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 64117e059b)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-12 05:18:38 -07:00
Miss Islington (bot) 648494b44a
bpo-35685: Add examples of unittest.mock.patch.dict usage (GH-11456)
(cherry picked from commit 31a82e25b6)

Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
2019-09-12 04:37:05 -07:00
Miss Islington (bot) 94a684734f
bpo-36675: Remove obsolete code. (GH-16024)
Does no longer work since Sphinx moved the trim_doctest_flag option in
the configuration.
(cherry picked from commit 2c910c1e73)

Co-authored-by: Julien Palard <julien@palard.fr>
2019-09-12 04:31:17 -07:00
Stéphane Wirtel 1fc84b64f9
[3.8] bpo-32008: Prefer client or TLSv1_2 in examples (GH-5797) (GH-16027)
Prefer client or TLSv1_2 in examples

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

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-12 12:25:02 +01:00
Miss Islington (bot) 84eb42e3c9
bpo-38110: Use fdwalk for os.closerange() when available. (GH-15224)
Use fdwalk() on platforms that support it to implement os.closerange().
(cherry picked from commit e20134f889)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2019-09-12 04:19:21 -07:00
Miss Islington (bot) db0d8a5b2c bpo-37972: unittest.mock._Call now passes on __getitem__ to the __getattr__ chaining so that call() can be subscriptable (GH-15565) (GH-15965)
* bpo-37972: unittest.mock._Call now passes on __getitem__ to the __getattr__ chaining so that call() can be subscriptable

* 📜🤖 Added by blurb_it.

* Update 2019-08-28-21-40-12.bpo-37972.kP-n4L.rst

added name of the contributor

* bpo-37972: made all dunder methods chainable for _Call

* bpo-37972: delegate only attributes of tuple instead to __getattr__
(cherry picked from commit 72c359912d)

Co-authored-by: blhsing <github@ydooby.com>
2019-09-12 12:52:49 +02:00
Miss Islington (bot) f60fd95dcc closes bpo-37405: Make socket.getsockname() always return a tuple for AF_CAN. (GH-14392) (GH-16018)
This fixes a regression from 3.5. In recent releases, `getsockname()` in the AF_CAN case has returned a string.
(cherry picked from commit 954900a3f9)

Co-authored-by: bggardner <brent@ebrent.net>
2019-09-12 11:34:28 +01:00
Miss Islington (bot) 52baf90a74
bpo-38008: Move builtin protocol whitelist to mapping instead of list (GH-15647)
Fixes https://bugs.python.org/issue38008
(cherry picked from commit 692a0dc915)

Co-authored-by: Divij Rajkumar <drajkuma1@gmail.com>
2019-09-12 03:32:36 -07:00
Miss Islington (bot) 1e17c4d414
bpo-13927: time.ctime and time.asctime return string explantion (GH-11303)
* bpo-13927: time.ctime and time.asctime return string explantion

* Add note explaining that time.ctime and time.asctime returns a space padded date value in case it contains a single digit date

* Reformat linebreaks
(cherry picked from commit 2d32bf1ef2)

Co-authored-by: Harmandeep Singh <harmandeep.singh1@delhivery.com>
2019-09-12 03:31:43 -07:00
Miss Islington (bot) 79cbaf50ac
closes bpo-38127: _ctypes: PyObject_IsSubclass() should be checked for failure. (GH-16011)
An exception may occur during a PyObject_IsSubclass() call.
(cherry picked from commit ea683deccc)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-09-12 03:28:05 -07:00
Petr Viktorin 3562ae2540
[3.8] bpo-37879: Suppress subtype_dealloc decref when base type is a C heap type (GH-15323, GH-16004) (GH-15966)
The instance destructor for a type is responsible for preparing
an instance for deallocation by decrementing the reference counts
of its referents.

If an instance belongs to a heap type, the type object of an instance
has its reference count decremented while for static types, which
are permanently allocated, the type object is unaffected by the
instance destructor.

Previously, the default instance destructor searched the class
hierarchy for an inherited instance destructor and, if present,
would invoke it.

Then, if the instance type is a heap type, it would decrement the
reference count of that heap type.  However, this could result in the
premature destruction of a type because the inherited instance
destructor should have already decremented the reference count
of the type object.

This change avoids the premature destruction of the type object
by suppressing the decrement of its reference count when an
inherited, non-default instance destructor has been invoked.

Finally, an assertion on the Py_SIZE of a type was deleted.  Heap
types have a non zero size, making this into an incorrect assertion.

https://github.com/python/cpython/pull/15323.
(cherry picked from commit ff023ed36e)
Fixup: https://github.com/python/cpython/pull/16004.
(cherry picked from commit 5e9caeec76)

Co-authored-by: Eddie Elizondo <eduardo.elizondorueda@gmail.com>
2019-09-12 10:44:46 +01:00
Miss Islington (bot) eb19c45298 Doc: Update pickle.rst (GH-14128) (GH-16014)
* Edits for readability and grammar
(cherry picked from commit 362f5350eb)

Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
2019-09-12 09:19:12 +01:00
Paul Ganssle 2bb6bf0c8c bpo-38096: Clean up the "struct sequence" / "named tuple" docs (GH-15895) (GH-15961) 2019-09-11 19:50:29 -07:00
Miss Islington (bot) a5a7102636
closes bpo-38124: Fix bounds check in PyState_AddModule. (GH-16007)
The >=, checking whether a module index was in already in the module-by-index list, needed to be strict.

Also, fold nested ifs into one and fix some bad spacing.
(cherry picked from commit 39de95b746)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2019-09-11 17:04:27 -07:00
Miss Islington (bot) 8af4e0c994 Correct typo in min version test (GH-16001)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit de606ea169)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-11 11:19:12 -07:00
Miss Islington (bot) f79a022d76
bpo-36270: Doc: add link to traceback object reference (GH-13119)
(cherry picked from commit 9936371af2)

Co-authored-by: Björn Meier <bjoern@opentrash.org>
2019-09-11 11:12:35 -07:00
Miss Islington (bot) d6ac67f48f bpo-34001: Fix test_ssl with LibreSSL (GH-13783) (#15997)
(cherry picked from commit c9bc49c5f6)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-11 19:59:13 +02:00
Miss Islington (bot) c0acc0e53e Improve clarity of try-return-finally-return (GH-15677) (GH-15981)
Clarify execution in try-return-finally-return case.
(cherry picked from commit 0cc27417f2)

Co-authored-by: toonarmycaptain <toonarmycaptain@hotmail.com>
2019-09-11 19:42:21 +02:00
Stéphane Wirtel 965e53a9de
[3.8] bpo-37698: Update doc of PyBuffer_ToContiguous (GH-14992) (GH-15999)
https://bugs.python.org/issue37698
(cherry picked from commit 15f5a7527b)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2019-09-11 19:36:00 +02:00
Miss Islington (bot) d47993664e
Doc: recursive glob ** follows symlinks to directories (GH-12918)
(cherry picked from commit e24594bfe7)

Co-authored-by: Marc <Marc.Herbert+github@gmail.com>
2019-09-11 10:32:26 -07:00
Miss Islington (bot) 4cab7eb9e1 bpo-37750: Add doc of PyBuffer_FromContiguous (GH-15988) (GH-15990)
https://bugs.python.org/issue37750

Automerge-Triggered-By: @matrixise
(cherry picked from commit 5a56ce4a0e)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2019-09-11 19:09:57 +02:00
Miss Islington (bot) 0b7f3706e6
bpo-38117: Test with OpenSSL 1.1.1d (GH-15983)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 58ab13479d)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-11 10:09:28 -07:00
Miss Islington (bot) f90cbcbfe3
bpo-36528: Remove duplicate re tests. (GH-2689)
Co-Authored-By: Makdon <makdon@makdon.me>
(cherry picked from commit e6557d3c62)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-11 09:46:29 -07:00
Miss Islington (bot) 05d692b08b
Doc: Fix missing negation. (GH-14640)
Reported by Hug Capella on docs@.

Automerge-Triggered-By: @matrixise
(cherry picked from commit 1fae844451)

Co-authored-by: Julien Palard <julien@palard.fr>
2019-09-11 09:25:40 -07:00
Miss Islington (bot) c5a672315d bpo-36260: Add pitfalls to zipfile module documentation (GH-13378) (GH-15976)
* bpo-36260: Add pitfalls to zipfile module documentation

We saw vulnerability warning description (including zip bomb) in Doc/library/xml.rst file.
This gave us the idea of documentation improvement.

So, we moved a little bit forward :P
And the doc patch can be found (pr).

* fix trailing whitespace

* 📜🤖 Added by blurb_it.

* Reformat text for consistency.
(cherry picked from commit 3ba51d587f)

Co-authored-by: JunWei Song <sungboss2004@gmail.com>
2019-09-11 17:03:18 +01:00
Miss Islington (bot) 436cd2c20b
bpo-38114: Do not include pip.ini in Nuget package (GH-15964)
(cherry picked from commit 19f6940cd7)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-11 08:57:54 -07:00
Miss Islington (bot) 43ee0e2ca3
bpo-33166: Change os.cpu_count to return active (real) processors (GH-15949)
(cherry picked from commit aa929273ca)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-11 08:56:13 -07:00
Miss Islington (bot) 63eefc3567 bpo-37885: venv: Don't produce unbound variable warning on deactivate (GH-15973)
Before, running deactivate from a bash shell configured to treat undefined variables as errors (`set -u`) would produce a warning:

```
$ python3 -m venv test
$ source test/bin/activate
(test) $ deactivate
-bash: $1: unbound variable
```
(cherry picked from commit 5209e586b7)

Co-authored-by: Daniel Abrahamsson <hamsson@gmail.com>
2019-09-11 08:55:57 -07:00
Miss Islington (bot) 893653357c bpo-36182: Update pathlib.Path.write_text() docs (GH-12161) (GH-15977)
with the case of an existing file
(cherry picked from commit af636f4f91)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2019-09-11 17:55:31 +02:00
Miss Islington (bot) 20f80bfc83
bpo-36634: Fixes activate.bat when existing values contain double quotes (GH-15924)
(cherry picked from commit 574b324bdc)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-11 08:21:58 -07:00
Miss Islington (bot) be2aa58fdc bpo-35224: Additional documentation for Assignment Expressions (GH-15935) (GH-15967)
Add or update assignment expression documentation for:
- FAQ - Design
- Reference - Expressions
- Reference - Lexical Analysis

https://bugs.python.org/issue35224

Automerge-Triggered-By: @matrixise
(cherry picked from commit 6357c95716)

Co-authored-by: Emily Morehouse <emily@cuttlesoft.com>
2019-09-11 17:12:09 +02:00
Miss Islington (bot) e784bb7c6b
bpo-37651: Document CancelledError is now a subclass of BaseException (GH-15950)
https://bugs.python.org/issue37651

Automerge-Triggered-By: @1st1
(cherry picked from commit 7b69069e9a)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-11 08:08:47 -07:00
Miss Islington (bot) aa527174f0
Doc: Indicate locations of parse_qs, parse_qsl, escape (GH-14828)
Since they have been removed from cgi it's useful to remind people where they
can be found instead.
(cherry picked from commit 1abf54336f)

Co-authored-by: Simon Willison <swillison@gmail.com>
2019-09-11 08:04:02 -07:00
Miss Islington (bot) 2f2a867fe3
Update ftplib.all_errors documentation to match code (GH-15026)
The documentation doesn't mention the `EOFError` that https://github.com/python/cpython/blob/master/Lib/ftplib.pyGH-L66 includes
(cherry picked from commit 51adfc6ed2)

Co-authored-by: Andrew Scheller <github@loowis.durge.org>
2019-09-11 07:54:44 -07:00
Miss Islington (bot) 6cf0ba8a63 bpo-33187: Document ElementInclude (XInclude) support in ElementTree (GH-8861) (GH-15958)
(cherry picked from commit 97b817eae3)

Co-authored-by: Anjali Bansal <anjali.mca17.du@gmail.com>
2019-09-11 15:48:33 +01:00
Zachary Ware 8ee8ad22d7
[3.8] Turn off AppVeyor CI (GH-15929) (GH-15941)
(cherry picked from commit 6f55b0394b)
2019-09-11 15:39:32 +01:00