]> granicus.if.org Git - python/log
python
5 years agobpo-25810: Clarify eval() docs, it does not keywords (GH-15173)
smokephil [Wed, 11 Sep 2019 10:30:04 +0000 (12:30 +0200)]
bpo-25810: Clarify eval() docs, it does not keywords (GH-15173)

5 years agobpo-37409: fix relative import with no parent (#14956)
Ben Lewis [Wed, 11 Sep 2019 10:09:47 +0000 (20:09 +1000)]
bpo-37409: fix relative import with no parent (#14956)

Relative imports use resolve_name to get the absolute target name,
which first seeks the current module's absolute package name from the globals:
If __package__ (and __spec__.parent) are missing then
import uses __name__, truncating the last segment if
the module is a submodule rather than a package __init__.py
(which it guesses from whether __path__ is defined).

The __name__ attempt should fail if there is no parent package (top level modules),
if __name__ is '__main__' (-m entry points), or both (scripts).
That is, if both __name__ has no subcomponents and the module does not seem
to be a package __init__ module then import should fail.

5 years agobpo-37585: Add clarification regarding comparing dict.values() (GH-14954)
Kyle Stanley [Wed, 11 Sep 2019 10:01:41 +0000 (06:01 -0400)]
bpo-37585: Add clarification regarding comparing dict.values() (GH-14954)

5 years agobpo-16438: Doc: confusing text regarding numeric precedence corrected (GH-10521)
Anjali [Wed, 11 Sep 2019 09:58:27 +0000 (04:58 -0500)]
bpo-16438: Doc: confusing text regarding numeric precedence corrected (GH-10521)

5 years agobpo-38081: Fixes ntpath.realpath('NUL') (GH-15899)
Steve Dower [Wed, 11 Sep 2019 09:48:36 +0000 (10:48 +0100)]
bpo-38081: Fixes ntpath.realpath('NUL') (GH-15899)

5 years agobpo-37936: Systematically distinguish rooted vs. unrooted in .gitignore (GH-15823)
Greg Price [Wed, 11 Sep 2019 09:25:26 +0000 (02:25 -0700)]
bpo-37936: Systematically distinguish rooted vs. unrooted in .gitignore (GH-15823)

A root cause of bpo-37936 is that it's easy to write a .gitignore
rule that's intended to apply to a specific file (e.g., the
`pyconfig.h` generated by `./configure`) but actually applies to all
similarly-named files in the tree (e.g., `PC/pyconfig.h`.)

Specifically, any rule with no non-trailing slashes is applied in an
"unrooted" way, to files anywhere in the tree.  This means that if we
write the rules in the most obvious-looking way, then

 * for specific files we want to ignore that happen to be in
   subdirectories (like `Modules/config.c`), the rule will work
   as intended, staying "rooted" to the top of the tree; but

 * when a specific file we want to ignore happens to be at the root of
   the repo (like `platform`), then the obvious rule (`platform`) will
   apply much more broadly than intended: if someone tries to add a
   file or directory named `platform` somewhere else in the tree, it
   will unexpectedly get ignored.

That's surprising behavior that can make the .gitignore file's
behavior feel finicky and unpredictable.

To avoid it, we can simply always give a rule "rooted" behavior when
that's what's intended, by systematically using leading slashes.

Further, to help make the pattern obvious when looking at the file and
minimize any need for thinking about the syntax when adding new rules:
separate the rules into one group for each type, with brief comments
identifying them.

For most of these rules it's clear whether they're meant to be rooted
or unrooted, but in a handful of cases I've only guessed.  In that
case the safer default (the choice that won't hide information) is the
narrower, rooted meaning, with a leading slash.  If for some of these
the unrooted meaning is desired after all, it'll be easy to move them
to the unrooted section at the top.

5 years agobpo-37424: Avoid a hang in subprocess.run timeout output capture (GH-14490)
Gregory P. Smith [Wed, 11 Sep 2019 09:23:05 +0000 (04:23 -0500)]
bpo-37424: Avoid a hang in subprocess.run timeout output capture (GH-14490)

Fixes a possible hang when using a timeout on subprocess.run() while
capturing output. If the child process spawned its own children or otherwise
connected its stdout or stderr handles with another process, we could hang
after the timeout was reached and our child was killed when attempting to read
final output from the pipes.

5 years agoOverhaul datetime documentation (GH-13410)
Brad [Wed, 11 Sep 2019 09:19:05 +0000 (05:19 -0400)]
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/#id4
    - Using '::' to lead into code blocks
        Per https://devguide.python.org/documenting/#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

5 years agobpo-37879: Suppress subtype_dealloc decref when base type is a C heap type (GH-15323)
Eddie Elizondo [Wed, 11 Sep 2019 09:17:13 +0000 (05:17 -0400)]
bpo-37879: Suppress subtype_dealloc decref when base type is a C heap type (GH-15323)

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

5 years agobpo-36373: Fix deprecation warnings (GH-15889)
Andrew Svetlov [Wed, 11 Sep 2019 08:20:24 +0000 (11:20 +0300)]
bpo-36373: Fix deprecation warnings (GH-15889)

https://bugs.python.org/issue36373

5 years agobpo-38034: Fix typo in logging.handlers.rst (GH-15708)
wwuck [Wed, 11 Sep 2019 06:44:37 +0000 (16:44 +1000)]
bpo-38034: Fix typo in logging.handlers.rst (GH-15708)

5 years agobpo-28494: Test existing zipfile working behavior. (GH-15853)
Gregory P. Smith [Tue, 10 Sep 2019 16:14:11 +0000 (17:14 +0100)]
bpo-28494: Test existing zipfile working behavior. (GH-15853)

Add unittests for executables with a zipfile appended to test_zipfile, as zipfile.is_zipfile and zipfile.ZipFile work properly on these today.

5 years agoRemove unneeded assignment in PyBytes_Concat() (GH-15274)
Sergey Fedoseev [Tue, 10 Sep 2019 16:11:10 +0000 (21:11 +0500)]
Remove unneeded assignment in PyBytes_Concat() (GH-15274)

The `wb.len = -1` assignment is unneeded since its introduction in 161d695fb0455ce52530d4f43a9eac4c738f64bb as `PyObject_GetBuffer` always fills it in.

5 years agobpo-37574: Mention helper functions for find_spec documentation (GH-14739)
jdkandersson [Tue, 10 Sep 2019 16:06:22 +0000 (02:06 +1000)]
bpo-37574: Mention helper functions for find_spec documentation (GH-14739)

5 years agobpo-37752: Delete redundant Py_CHARMASK in normalizestring() (GH-15095)
Jordon Xu [Tue, 10 Sep 2019 16:04:08 +0000 (00:04 +0800)]
bpo-37752: Delete redundant Py_CHARMASK in normalizestring() (GH-15095)

5 years agobpo-38089: Move Azure Pipelines to latest VM versions and make macOS tests optional...
Steve Dower [Tue, 10 Sep 2019 15:53:03 +0000 (16:53 +0100)]
bpo-38089: Move Azure Pipelines to latest VM versions and make macOS tests optional (GH-15851)

5 years agobpo-32424: Deprecate xml.etree.ElementTree.Element.copy() in favor of copy.copy(...
Gordon P. Hemsley [Tue, 10 Sep 2019 15:22:01 +0000 (11:22 -0400)]
bpo-32424: Deprecate xml.etree.ElementTree.Element.copy() in favor of copy.copy() (GH-12995)

5 years agobpo-36253: Remove use after free reference in ctypes test suite (GH-12257)
Ben Harper [Tue, 10 Sep 2019 15:20:15 +0000 (11:20 -0400)]
bpo-36253: Remove use after free reference in ctypes test suite (GH-12257)

5 years agobpo-33602: Doc: Remove set and queue references from Data Types (GH-7055)
Andre Delfino [Tue, 10 Sep 2019 15:11:16 +0000 (12:11 -0300)]
bpo-33602: Doc: Remove set and queue references from Data Types (GH-7055)

5 years agoDocs: Small tweaks to c-api/intro#Include_Files (GH-14698)
Kyle Stanley [Tue, 10 Sep 2019 15:09:34 +0000 (11:09 -0400)]
Docs: Small tweaks to c-api/intro#Include_Files (GH-14698)

5 years agoCorrect info about "f.read(size)". (GH13852)
William Andrea [Tue, 10 Sep 2019 14:50:26 +0000 (10:50 -0400)]
Correct info about "f.read(size)". (GH13852)

In text mode, the "size" parameter indicates the number of characters, not bytes.

5 years agoCorrect minor grammatical mistake in open docs (GH-15865)
Andre Delfino [Tue, 10 Sep 2019 14:48:05 +0000 (11:48 -0300)]
Correct minor grammatical mistake in open docs (GH-15865)

5 years agobpo-37504: Fix documentation build with texinfo builder (GH-14606)
Dmitry Shachnev [Tue, 10 Sep 2019 14:40:50 +0000 (17:40 +0300)]
bpo-37504: Fix documentation build with texinfo builder (GH-14606)

In the table model used by docutils, the `cols` attribute of `tgroup`
nodes is mandatory, see [1]. It is used in texinfo builder in [2].

[1]: https://www.oasis-open.org/specs/tm9901.htm#AEN348
[2]: https://github.com/sphinx-doc/sphinx/blob/v2.1.2/sphinx/writers/texinfo.py#L1129

* Doc: Add texinfo support to the Makefile

5 years agobpo-37913: Link to NotImplemented from new docs (GH-15860)
Steve Dower [Tue, 10 Sep 2019 14:25:12 +0000 (15:25 +0100)]
bpo-37913: Link to NotImplemented from new docs (GH-15860)

5 years agobpo-37913: document that __length_hint__ can return NotImplemented (GH-15383)
Jeroen Demeyer [Tue, 10 Sep 2019 14:01:13 +0000 (16:01 +0200)]
bpo-37913: document that __length_hint__ can return NotImplemented (GH-15383)

5 years agobpo-38086: Sync importlib.metadata with importlib_metadata 0.21. (GH-15840)
Jason R. Coombs [Tue, 10 Sep 2019 13:53:31 +0000 (14:53 +0100)]
bpo-38086: Sync importlib.metadata with importlib_metadata 0.21. (GH-15840)

https://gitlab.com/python-devs/importlib_metadata/-/tags/0.21

5 years agobpo-38087: Fix case sensitivity in test_pathlib and test_ntpath (GH-15850)
Steve Dower [Tue, 10 Sep 2019 13:52:48 +0000 (14:52 +0100)]
bpo-38087: Fix case sensitivity in test_pathlib and test_ntpath (GH-15850)

5 years agobpo-38088: Fixes distutils not finding vcruntime140.dll with only v142 toolset instal...
Steve Dower [Tue, 10 Sep 2019 13:52:23 +0000 (14:52 +0100)]
bpo-38088: Fixes distutils not finding vcruntime140.dll with only v142 toolset installed (GH-15849)

5 years agoFix subprocess docstring typo (GH-15812)
Matthias [Tue, 10 Sep 2019 13:51:09 +0000 (15:51 +0200)]
Fix subprocess docstring typo (GH-15812)

5 years agoFix typo in ssl.RAND_bytes documentation (GH-14791)
Zach Thompson [Tue, 10 Sep 2019 13:40:14 +0000 (08:40 -0500)]
Fix typo in ssl.RAND_bytes documentation (GH-14791)

It looks like "cryptographically strong" is the preferred phrase from the surrounding documentation.

Automerge-Triggered-By: @tiran
5 years agobpo-38090: Fix reference leak in ceval.c (GH-15848)
Pablo Galindo [Tue, 10 Sep 2019 13:32:54 +0000 (14:32 +0100)]
bpo-38090: Fix reference leak in ceval.c (GH-15848)

5 years agobpo-36781: Optimize sum() for bools. (#13074)
Serhiy Storchaka [Tue, 10 Sep 2019 13:31:01 +0000 (16:31 +0300)]
bpo-36781: Optimize sum() for bools. (#13074)

* Optimize sum() for bools.

* Fix sum([], False).

* Add a NEWS entry.

5 years ago Note regarding + mode truncation applies to both text and binary mode (#11314)
Andre Delfino [Tue, 10 Sep 2019 13:04:22 +0000 (10:04 -0300)]
 Note regarding + mode truncation applies to both text and binary mode (#11314)

* Improve doc on open's mode +

* Improve wording

* Address comment from Rémi

5 years agobpo-38073: Make pwd module PEP-384 compatible (GH-15790)
Dino Viehland [Tue, 10 Sep 2019 12:59:43 +0000 (13:59 +0100)]
bpo-38073: Make pwd module PEP-384 compatible (GH-15790)

Makes the pwd module PEP-384 compatible

https://bugs.python.org/issue38073

Automerge-Triggered-By: @tiran
5 years agobpo-38066: Hide internal Stream methods (GH-15762)
Andrew Svetlov [Tue, 10 Sep 2019 12:56:14 +0000 (15:56 +0300)]
bpo-38066: Hide internal Stream methods (GH-15762)

feed_eof(), feed_data(), set_exception(), and set_transport() are prefixed with underscore now.

https://bugs.python.org/issue38066

5 years agobpo-21018: added missing documentation about escaping characters for configparser...
Arun Persaud [Tue, 10 Sep 2019 12:51:09 +0000 (05:51 -0700)]
bpo-21018: added missing documentation about escaping characters for configparser (GH-6137)

Document how $ and % can be escaped in configparser.

5 years agocloses bpo-25461: Update os.walk() docstring to match the online docs. (GH-11836)
Bernt Røskar Brenna [Tue, 10 Sep 2019 12:43:58 +0000 (14:43 +0200)]
closes bpo-25461: Update os.walk() docstring to match the online docs. (GH-11836)

5 years agobpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [queue] ...
Emmanuel Arias [Tue, 10 Sep 2019 11:46:12 +0000 (08:46 -0300)]
bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [queue] (GH-13950)

This PR deprecate explicit loop parameters in all public asyncio APIs

This issues is split to be easier to review.

fourth step: queue.py

https://bugs.python.org/issue36373

5 years agobpo-37619: update_one_slot() should not ignore wrapper descriptors for wrong type...
Jeroen Demeyer [Tue, 10 Sep 2019 11:21:57 +0000 (13:21 +0200)]
bpo-37619: update_one_slot() should not ignore wrapper descriptors for wrong type (GH-14836)

5 years agobpo-37499: Test various C calling conventions (GH-15776)
Petr Viktorin [Tue, 10 Sep 2019 11:21:09 +0000 (12:21 +0100)]
bpo-37499: Test various C calling conventions (GH-15776)

Add functions with various calling conventions to `_testcapi`, expose them as module-level functions, bound methods, class methods, and static methods, and test calling them and introspecting them through GDB.

https://bugs.python.org/issue37499

Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
Automerge-Triggered-By: @pganssle
5 years agobpo-37251: Removes __code__ check from _is_async_obj. (GH-15830)
Lisa Roach [Tue, 10 Sep 2019 11:18:40 +0000 (12:18 +0100)]
bpo-37251: Removes __code__ check from _is_async_obj. (GH-15830)

5 years agobpo-38069: Convert _posixsubprocess to PEP-384 (GH-15780)
Dino Viehland [Tue, 10 Sep 2019 11:01:20 +0000 (12:01 +0100)]
bpo-38069: Convert _posixsubprocess to PEP-384 (GH-15780)

Summary:
Eliminate uses of `_Py_IDENTIFIER` from `_posixsubprocess`, replacing them with interned strings.

Also tries to find an existing version of the module, which will allow subinterpreters.

https://bugs.python.org/issue38069

5 years ago bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [locks]...
Emmanuel Arias [Tue, 10 Sep 2019 10:55:07 +0000 (07:55 -0300)]
 bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [locks] (GH-13920)

This PR deprecate explicit loop parameters in all public asyncio APIs

This issues is split to be easier to review.

Third step: locks.py

https://bugs.python.org/issue36373

5 years agobpo-36971: add subsections in C API "Common Object Structures" page (#13446)
Jeroen Demeyer [Tue, 10 Sep 2019 10:41:59 +0000 (12:41 +0200)]
bpo-36971: add subsections in C API "Common Object Structures" page (#13446)

5 years agobpo-38068: Clean up gettimeofday configure logic. (GH-15775)
Benjamin Peterson [Tue, 10 Sep 2019 10:37:59 +0000 (11:37 +0100)]
bpo-38068: Clean up gettimeofday configure logic. (GH-15775)

Assume gettimeofday exists and takes two arguments.

5 years agobpo-37052: Add examples for mocking async iterators and context managers (GH-14660)
Xtreak [Tue, 10 Sep 2019 10:37:17 +0000 (11:37 +0100)]
bpo-37052: Add examples for mocking async iterators and context managers (GH-14660)

Add examples for mocking asynchronous iterators and asynchronous context managers.

https://bugs.python.org/issue37052

5 years agobpo-38071: Make termios PEP-384 compatible (GH-15785)
Dino Viehland [Tue, 10 Sep 2019 10:33:30 +0000 (11:33 +0100)]
bpo-38071: Make termios PEP-384 compatible (GH-15785)

Make the termios module PEP-384 compatible.

5 years agobpo-38072: PEP-384 grpmodule (GH-15788)
Dino Viehland [Tue, 10 Sep 2019 10:30:36 +0000 (11:30 +0100)]
bpo-38072: PEP-384 grpmodule (GH-15788)

Make the grp module PEP-384 compliant.

5 years agoFix calling order of PyEval_InitThreads. (GH-4602)
Kenta Murata [Tue, 10 Sep 2019 10:29:56 +0000 (19:29 +0900)]
Fix calling order of PyEval_InitThreads. (GH-4602)

As described in Doc/c-api/init.rst, PyEval_InitThreads() cannot be called
before Py_Initialize() function.

5 years agoRemove macOS tests from Travis. (GH-15809)
Benjamin Peterson [Tue, 10 Sep 2019 10:28:29 +0000 (11:28 +0100)]
Remove macOS tests from Travis. (GH-15809)

Azure runs macOS, so we don't need Travis to do it.

5 years agoSkip zoneinfo tests on VxWorks (#13535)
hliu0 [Tue, 10 Sep 2019 10:28:11 +0000 (18:28 +0800)]
Skip zoneinfo tests on VxWorks (#13535)

5 years agobpo-38074: Make zlib extension module PEP-384 compatible (GH-15792)
Dino Viehland [Tue, 10 Sep 2019 10:27:03 +0000 (11:27 +0100)]
bpo-38074: Make zlib extension module PEP-384 compatible (GH-15792)

Updated zlibmodule.c to be PEP 384 compliant.

5 years agobpo-38076: Make struct module PEP-384 compatible (#15805)
Dino Viehland [Tue, 10 Sep 2019 10:18:37 +0000 (11:18 +0100)]
bpo-38076: Make struct module PEP-384 compatible (#15805)

* PEP-384 _struct

* More PEP-384 fixes for _struct

Summary: Add a couple of more fixes for `_struct` that were previously missed such as removing `tp_*` accessors and using `PyBytesWriter` instead of calling `PyBytes_FromStringAndSize` with `NULL`. Also added a test to confirm that `iter_unpack` type is still uninstantiable.

* 📜🤖 Added by blurb_it.

5 years agobpo-38083: Minor improvements in asdl_c.py and Python-ast.c. (GH-15824)
Serhiy Storchaka [Tue, 10 Sep 2019 10:02:30 +0000 (13:02 +0300)]
bpo-38083: Minor improvements in asdl_c.py and Python-ast.c. (GH-15824)

* Use the const qualifier for constant C strings.
* Intern field and attribute names.
* Temporary incref a borrowed reference to a list item.

5 years agoFix typo in dict object comment (#15814)
dalgarno [Tue, 10 Sep 2019 09:45:07 +0000 (10:45 +0100)]
Fix typo in dict object comment (#15814)

5 years agobpo-37725: have "make clean" remove PGO task data (#15033)
Neil Schemenauer [Tue, 10 Sep 2019 09:44:20 +0000 (02:44 -0700)]
bpo-37725: have "make clean" remove PGO task data (#15033)

Change "clean" makefile target to also clean the program guided
optimization (PGO) data.  Previously you would have to use "make
clean" and "make profile-removal", or "make clobber".

5 years agobpo-38043: Move unicodedata.normalize tests into test_unicodedata. (GH-15712)
Greg Price [Tue, 10 Sep 2019 09:29:26 +0000 (02:29 -0700)]
bpo-38043: Move unicodedata.normalize tests into test_unicodedata. (GH-15712)

Having these in a separate file from the one that's named after the
module in the usual way makes it very easy to miss them when looking
for tests for these two functions.

(In fact when working recently on is_normalized, I'd been surprised to
see no tests for it here and concluded the function had evaded being
tested at all.  I'd gone as far as to write up some tests myself
before I spotted this other file.)

Mostly this just means moving all the one file's code into the other,
and moving code from the module toplevel to inside the test class to
keep it tidily separate from the rest of the file's code.

There's one substantive change, which reduces by a bit the amount of
code to be moved: we drop the `x > sys.maxunicode` conditional and all
the `RangeError` logic behind it.  Now if that condition ever occurs
it will cause an error at `chr(x)`, and a test failure.  That's the
right result because, since PEP 393 in Python 3.3, there is no longer
such a thing as an "unsupported character".

5 years agoExpand comment explaining update_one_slot (GH-14810)
Jeroen Demeyer [Tue, 10 Sep 2019 09:22:05 +0000 (11:22 +0200)]
Expand comment explaining update_one_slot (GH-14810)

5 years agobpo-25237: Documentation for tkinter modules (GH-1870)
Nikhil [Tue, 10 Sep 2019 08:55:34 +0000 (01:55 -0700)]
bpo-25237: Documentation for tkinter modules (GH-1870)

5 years agoCut tricky `goto` that isn't needed, in _PyBytes_DecodeEscape. (GH-15825)
Greg Price [Tue, 10 Sep 2019 08:51:04 +0000 (01:51 -0700)]
Cut tricky `goto` that isn't needed, in _PyBytes_DecodeEscape. (GH-15825)

This is the sort of `goto` that requires the reader to stare hard at
the code to unpick what it's doing.

On doing so, the answer is... not very much!

* It jumps from the bottom of the loop to almost the top; the effect
  is to bypass the loop condition `s < end` and also the
  `if`-condition `*s != '\\'`, acting as if both are true.

* We've just decremented `s`, after incrementing it in the `switch`
  condition.  So it has the same value as when `s == end` failed.
  Before that was another increment... and before that we had
  `s < end`.  So `s < end` true, then increment, then `s == end`
  false... that means `s < end` is still true.

* Also this means `s` points to the same character as it did for the
  `switch` condition.  And there was a `case '\\'`, which we didn't
  hit -- so `*s != '\\'` is also true.

* That means this has no effect on the behavior!  The most it might do
  is an optimization -- we get to skip those two checks, because (as
  just proven above) we know they're true.

* But gosh, this is the *invalid escape sequence* path.  This does not
  seem like the kind of code path that calls for extreme optimization
  tricks.

So, take the `goto` and the label out.

Perhaps the compiler will notice the exact same facts we showed above,
and generate identical code.  Or perhaps it won't!  That'll be OK.

But then, crucially, if some future edit to this loop causes the
reasoning above to *stop* holding true... the compiler will adjust
this jump accordingly.  One of us fallible humans might not.

5 years agobpo-38018: Fix test for multiprocessing.shared_memory in BSD systems (GH-15821)
Vinay Sharma [Tue, 10 Sep 2019 06:48:24 +0000 (12:18 +0530)]
bpo-38018: Fix test for multiprocessing.shared_memory in BSD systems (GH-15821)

5 years agobpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818)
Terry Jan Reedy [Tue, 10 Sep 2019 03:10:44 +0000 (23:10 -0400)]
bpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818)

This only happened when initializing the subprocess to run a module.
This recent bug only affected 3.7.4 and 3.8.0b2 to 3.8.0b4.

5 years agobpo-34293: Fix PDF documentation paper size (GH-8585)
Jean-François B [Mon, 9 Sep 2019 21:52:03 +0000 (23:52 +0200)]
bpo-34293: Fix PDF documentation paper size (GH-8585)

The "A4" pdfs were previously the wrong size due to a change in the options in Sphinx 1.5.

See also sphinx-doc/sphinx#5235

5 years agobpo-36511: clean up python process before deploy on ARM Windows buildbots (GH-14431)
Paul Monson [Mon, 9 Sep 2019 21:11:17 +0000 (14:11 -0700)]
bpo-36511: clean up python process before deploy on ARM Windows buildbots (GH-14431)

5 years agoCorrect overflow check in PyTuple_New() (GH-14838)
Sergey Fedoseev [Mon, 9 Sep 2019 20:40:58 +0000 (01:40 +0500)]
Correct overflow check in PyTuple_New() (GH-14838)

5 years agobpo-38049: Add command-line interface for the ast module. (GH-15724)
Serhiy Storchaka [Mon, 9 Sep 2019 20:36:13 +0000 (23:36 +0300)]
bpo-38049: Add command-line interface for the ast module. (GH-15724)

5 years agobpo-37383: Updates docs to reflect AsyncMock call_count after await. (#15761)
Lisa Roach [Mon, 9 Sep 2019 16:54:13 +0000 (17:54 +0100)]
bpo-37383: Updates docs to reflect AsyncMock call_count after await. (#15761)

* bpo-351428: Updates documentation to reflect AsyncMock call_count after await.

* Adds skip and fixes warning.

* Removes extra >>>.

* Adds ... in front of await mock().

5 years agobpo-38018: Increase code coverage for multiprocessing.shared_memory (GH-15662)
Vinay Sharma [Mon, 9 Sep 2019 16:48:55 +0000 (22:18 +0530)]
bpo-38018: Increase code coverage for multiprocessing.shared_memory (GH-15662)

5 years agobpo-36502: Update link to UAX #44, the Unicode doc on the UCD. (GH-15301)
Greg Price [Mon, 9 Sep 2019 16:37:13 +0000 (09:37 -0700)]
bpo-36502: Update link to UAX #44, the Unicode doc on the UCD. (GH-15301)

The link we have points to the version from Unicode 6.0.0, dated 2010.
There have been numerous updates to it since then:
  https://www.unicode.org/reports/tr44/#Modifications

Change the link to one that points to the current version. Also, use HTTPS.

5 years agobpo-37995: Add an option to ast.dump() to produce a multiline output. (GH-15631)
Serhiy Storchaka [Mon, 9 Sep 2019 16:33:13 +0000 (19:33 +0300)]
bpo-37995: Add an option to ast.dump() to produce a multiline output. (GH-15631)

5 years agobpo-37840: Fix handling of negative indices in bytearray_getitem() (GH-15250)
Sergey Fedoseev [Mon, 9 Sep 2019 16:28:34 +0000 (21:28 +0500)]
bpo-37840: Fix handling of negative indices in bytearray_getitem() (GH-15250)

5 years agobpo-35941: Fix performance regression in new code (GH-12610)
Christian Heimes [Mon, 9 Sep 2019 16:06:55 +0000 (18:06 +0200)]
bpo-35941: Fix performance regression in new code (GH-12610)

Accumulate certificates in a set instead of doing a costly list contain
operation. A Windows cert store can easily contain over hundred
certificates. The old code would result in way over 5,000 comparison
operations

Signed-off-by: Christian Heimes <christian@python.org>
5 years agobpo-37649: Fix exec_prefix check (GH-14897)
Orivej Desh [Mon, 9 Sep 2019 16:05:21 +0000 (16:05 +0000)]
bpo-37649: Fix exec_prefix check (GH-14897)

5 years agoFix punctuation in `os.execvpe` docstring. (GH-15051)
Hasan Ramezani [Mon, 9 Sep 2019 15:58:21 +0000 (17:58 +0200)]
Fix punctuation in `os.execvpe` docstring. (GH-15051)

5 years agobpo-35803: Document and test dir=PathLike for tempfile (GH-11644)
Anthony Sottile [Mon, 9 Sep 2019 15:54:34 +0000 (08:54 -0700)]
bpo-35803: Document and test dir=PathLike for tempfile (GH-11644)

Co-Authored-By: Ammar Askar <ammar_askar@hotmail.com>
5 years agoClarify that shutil's copy functions can accept path-like values (GH-15141)
Boris Verhovsky [Mon, 9 Sep 2019 15:51:56 +0000 (09:51 -0600)]
Clarify that shutil's copy functions can accept path-like values (GH-15141)

5 years agoFix docs bz.open default mode (GH-15100)
Richard Sanger [Mon, 9 Sep 2019 15:49:47 +0000 (03:49 +1200)]
Fix docs bz.open default mode (GH-15100)

bz2.open()'s default mode is rb, not r

5 years agobpo-36279: Ensure os.wait3() rusage is initialized (GH-15111)
Zackery Spytz [Mon, 9 Sep 2019 15:48:32 +0000 (09:48 -0600)]
bpo-36279: Ensure os.wait3() rusage is initialized (GH-15111)

Co-Authored-By: David Wilson <dw@botanicus.net>
5 years agobpo-38070: visit_decref() calls _PyObject_IsFreed() (GH-15782)
Victor Stinner [Mon, 9 Sep 2019 15:44:59 +0000 (17:44 +0200)]
bpo-38070: visit_decref() calls _PyObject_IsFreed() (GH-15782)

In debug mode, visit_decref() now calls _PyObject_IsFreed() to ensure
that the object is not freed. If it's freed, the program fails with
an assertion error and Python dumps informations about the freed
object.

5 years agobpo-37758: Cut always-constant conditionals on sys.maxunicode. (GH-15302)
Greg Price [Mon, 9 Sep 2019 15:20:40 +0000 (08:20 -0700)]
bpo-37758: Cut always-constant conditionals on sys.maxunicode. (GH-15302)

Since PEP 393 in Python 3.3, this value is always 0x10ffff, the
maximum codepoint in Unicode; there's no longer such a thing as a
UCS-2 build of Python, which couldn't properly represent some
characters.

There are a couple of spots left where we still condition on the value
of this constant.  Take them out.

5 years agobpo-20490: Improve circular import error message (GH-15308)
Anthony Sottile [Mon, 9 Sep 2019 15:17:50 +0000 (08:17 -0700)]
bpo-20490: Improve circular import error message (GH-15308)

5 years agoMinor changes in Doc/faq/library. (#15449)
Antoine [Mon, 9 Sep 2019 15:00:44 +0000 (17:00 +0200)]
Minor changes in Doc/faq/library. (#15449)

* Minor changes.

* Update Doc/faq/library.rst

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
* Apply suggestions from aeros167.

* Update Doc/faq/library.rst

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
* Apply suggestions from aeros167 + re-add a "a" that was accidentally deleted.

5 years agobpo-38006: Avoid closure in weakref.WeakValueDictionary (GH-15641)
Victor Stinner [Mon, 9 Sep 2019 14:55:58 +0000 (16:55 +0200)]
bpo-38006: Avoid closure in weakref.WeakValueDictionary (GH-15641)

weakref.WeakValueDictionary defines a local remove() function used as
callback for weak references. This function was created with a
closure.  Modify the implementation to avoid the closure.

5 years agobpo-37876: Tests for ROT-13 codec (GH-15314)
Zeth [Mon, 9 Sep 2019 14:50:36 +0000 (15:50 +0100)]
bpo-37876: Tests for ROT-13 codec (GH-15314)

The Rot-13 codec is for educational use but does not have unit tests,
dragging down test coverage. This adds a few very simple tests.

5 years agodocs: Add references to AsyncMock in unittest.mock.patch (#13681)
Mario Corchero [Mon, 9 Sep 2019 14:18:06 +0000 (15:18 +0100)]
docs: Add references to AsyncMock in unittest.mock.patch (#13681)

Update the docs as patch can now return an AsyncMock if the patched
object is an async function.

5 years agoMark files as executable that are meant as scripts. (GH-15354)
Greg Price [Mon, 9 Sep 2019 14:16:33 +0000 (07:16 -0700)]
Mark files as executable that are meant as scripts. (GH-15354)

This is the converse of GH-15353 -- in addition to plenty of
scripts in the tree that are marked with the executable bit
(and so can be directly executed), there are a few that have
a leading `#!` which could let them be executed, but it doesn't
do anything because they don't have the executable bit set.

Here's a command which finds such files and marks them.  The
first line finds files in the tree with a `#!` line *anywhere*;
the next-to-last step checks that the *first* line is actually of
that form.  In between we filter out files that already have the
bit set, and some files that are meant as fragments to be
consumed by one or another kind of preprocessor.

    $ git grep -l '^#!' \
      | grep -vxFf <( \
          git ls-files --stage \
          | perl -lane 'print $F[3] if (!/^100644/)' \
        ) \
      | grep -ve '\.in$' -e '^Doc/includes/' \
      | while read f; do
          head -c2 "$f" | grep -qxF '#!' \
          && chmod a+x "$f"; \
        done

5 years agobpo-38059: Using sys.exit() over exit() in inspect.py (GH-15666)
Alan Yee [Mon, 9 Sep 2019 14:15:43 +0000 (07:15 -0700)]
bpo-38059: Using sys.exit() over exit() in inspect.py (GH-15666)

Constants added by the site module like exit() "should not be used in programs"

5 years agobpo-38053 Update documentation for plistlib (GH-15727)
Jon Janzen [Mon, 9 Sep 2019 14:13:43 +0000 (09:13 -0500)]
bpo-38053 Update documentation for plistlib (GH-15727)

* Update documentation for plistlib

-  Update "Mac OS X" to "Apple" since plists are used more widely than just macOS
-  Re-add the UID class documentation (oops, removed in GH-15615)

5 years agoFix typo in the algorithm description (GH-15774)
Pablo Galindo [Mon, 9 Sep 2019 14:08:23 +0000 (15:08 +0100)]
Fix typo in the algorithm description (GH-15774)

5 years agobpo-34596: Fallback to a default reason when @unittest.skip is uncalled (#9082)
Naitree Zhu [Mon, 9 Sep 2019 14:06:48 +0000 (22:06 +0800)]
bpo-34596: Fallback to a default reason when @unittest.skip is uncalled (#9082)

* bpo-34596: Fallback to a default reason when @unittest.skip is uncalled

* Change default reason to empty string

* Fix rst formatting of NEWS entry

5 years agobpo-37662: Documented venv.EnvBuilder.upgrade_dependencies(). (GH-15768)
Vinay Sajip [Mon, 9 Sep 2019 13:50:38 +0000 (14:50 +0100)]
bpo-37662: Documented venv.EnvBuilder.upgrade_dependencies(). (GH-15768)

5 years agobpo-38037: Fix reference counters in signal module (GH-15753)
animalize [Mon, 9 Sep 2019 13:46:26 +0000 (21:46 +0800)]
bpo-38037: Fix reference counters in signal module (GH-15753)

5 years agobpo-32587: Fixes unsafe downcast in PC/winreg.c (GH-15766)
Steve Dower [Mon, 9 Sep 2019 13:24:15 +0000 (06:24 -0700)]
bpo-32587: Fixes unsafe downcast in PC/winreg.c (GH-15766)

5 years agobpo-26185: Fix repr() on empty ZipInfo object (#13441)
Mickaël Schoentgen [Mon, 9 Sep 2019 13:08:54 +0000 (15:08 +0200)]
bpo-26185: Fix repr() on empty ZipInfo object (#13441)

* bpo-26185: Fix repr() on empty ZipInfo object

It was failing on AttributeError due to inexistant
but required attributes file_size and compress_size.
They are now initialized to 0 in ZipInfo.__init__().

* Remove useless hasattr() in ZipInfo._open_to_write()

* Completely remove file_size setting in _open_to_write().

5 years agoFix typo in math.prod example (GH-15614)
Ashwin Vishnu [Mon, 9 Sep 2019 12:42:27 +0000 (14:42 +0200)]
Fix typo in math.prod example (GH-15614)

5 years agobpo-37702: Fix SSL's certificate-store leak on Windows (GH-15632)
neonene [Mon, 9 Sep 2019 12:33:43 +0000 (21:33 +0900)]
bpo-37702: Fix SSL's certificate-store leak on Windows (GH-15632)

ssl_collect_certificates function in _ssl.c has a memory leak.
Calling CertOpenStore() and CertAddStoreToCollection(), a store's refcnt gets incremented by 2.
But CertCloseStore() is called only once and the refcnt leaves 1.

5 years agobpo-37589: Add a few missing dependencies on .h files in the Makefile. (GH-15757)
T. Wouters [Mon, 9 Sep 2019 12:17:18 +0000 (05:17 -0700)]
bpo-37589: Add a few missing dependencies on .h files in the Makefile. (GH-15757)

The missing dependencies prevented incremental builds from working when you touched any
of these files. Based on GH-14758 by @vemakereporter.

5 years agobpo-37283: Ensure command-line and unattend.xml setting override previously detected...
Steve Dower [Mon, 9 Sep 2019 12:15:07 +0000 (05:15 -0700)]
bpo-37283: Ensure command-line and unattend.xml setting override previously detected states in Windows installer (GH-15759)

5 years agobpo-34652 again: Remove lchmod from the default AC_CHECK_FUNCS list. (GH-15758)
Benjamin Peterson [Mon, 9 Sep 2019 12:13:00 +0000 (05:13 -0700)]
bpo-34652 again: Remove lchmod from the default AC_CHECK_FUNCS list. (GH-15758)

5 years agologging.Formatter docs: Add missing `validate` parameter, clarify `style` parameter...
David Röthlisberger [Mon, 9 Sep 2019 11:29:54 +0000 (12:29 +0100)]
logging.Formatter docs: Add missing `validate` parameter, clarify `style` parameter (GH-15222)