]> granicus.if.org Git - python/log
python
5 years agobpo-37942: Improve argument clinic float converter (GH-15470)
Raymond Hettinger [Sun, 25 Aug 2019 02:10:39 +0000 (19:10 -0700)]
bpo-37942: Improve argument clinic float converter (GH-15470)

5 years agobpo-19072: Make @classmethod support chained decorators (GH-8405)
Berker Peksag [Sat, 24 Aug 2019 22:37:25 +0000 (01:37 +0300)]
bpo-19072: Make @classmethod support chained decorators (GH-8405)

5 years agoFix typo and rearrange words in IDLE news item (GH-15471)
Terry Jan Reedy [Sat, 24 Aug 2019 21:32:33 +0000 (17:32 -0400)]
Fix typo and rearrange words in IDLE news item (GH-15471)

Redo of #15402 by GeeTransit and Kyle Stanley.

5 years agoClarify argument types in datetime docs. (GH-15459)
Jürgen Gmach [Sat, 24 Aug 2019 19:48:55 +0000 (21:48 +0200)]
Clarify argument types in datetime docs. (GH-15459)

"Arguments may be integers... " could be misunderstand as they also
could be strings.

New wording makes it clear that arguments have to be integers.

modified:   Doc/library/datetime.rst

Automerge-Triggered-By: @pganssle
5 years agobpo-14112: Allow beginners to explore shallowness in greater depth ;-) (GH-15465)
Raymond Hettinger [Sat, 24 Aug 2019 18:15:44 +0000 (11:15 -0700)]
bpo-14112: Allow beginners to explore shallowness in greater depth ;-) (GH-15465)

5 years agoRevert "(TH-15402)" (#15468)
Terry Jan Reedy [Sat, 24 Aug 2019 18:10:04 +0000 (14:10 -0400)]
Revert "(TH-15402)" (#15468)

This reverts commit a50f0a4c2bd997e4534162ecc1853cb54c7ae902.

5 years agoFix typos in the documentation of Parser/pgen (GH-15416)
Shashi Ranjan [Sat, 24 Aug 2019 18:07:24 +0000 (23:37 +0530)]
Fix typos in the documentation of Parser/pgen (GH-15416)

Co-Authored-By: Antoine <43954001+awecx@users.noreply.github.com>
5 years agobpo-37798: Test both Python and C versions in test_statistics.py (GH-15453)
Dong-hee Na [Sat, 24 Aug 2019 17:51:20 +0000 (02:51 +0900)]
bpo-37798: Test both Python and C versions in test_statistics.py (GH-15453)

5 years agobpo-32118: Simplify docs for sequence comparison (GH-15450)
Raymond Hettinger [Sat, 24 Aug 2019 17:43:55 +0000 (10:43 -0700)]
bpo-32118:  Simplify docs for sequence comparison (GH-15450)

5 years agobpo-37812: Convert CHECK_SMALL_INT macro to a function so the return is explicit...
Greg Price [Sat, 24 Aug 2019 17:19:37 +0000 (10:19 -0700)]
bpo-37812: Convert CHECK_SMALL_INT macro to a function so the return is explicit. (GH-15216)

5 years ago(TH-15402)
GeeTransit [Sat, 24 Aug 2019 17:01:36 +0000 (13:01 -0400)]
(TH-15402)

5 years agobpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170)
shireenrao [Sat, 24 Aug 2019 15:26:41 +0000 (11:26 -0400)]
bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170)

* fix Path._add_implied_dirs to include all implied directories

* fix Path._add_implied_dirs to include all implied directories

* Optimize code by using sets instead of lists

* 📜🤖 Added by blurb_it.

* fix Path._add_implied_dirs to include all implied directories

* Optimize code by using sets instead of lists

* 📜🤖 Added by blurb_it.

* Add tests to zipfile.Path.iterdir() fix

* Update test for zipfile.Path.iterdir()

* remove whitespace from test file

* Rewrite NEWS blurb to describe the user-facing impact and avoid implementation details.

* remove redundant [] within set comprehension

* Update to use unique_everseen to maintain order and other suggestions in review

* remove whitespace and add back add_dirs in tests

* Add new standalone function parents using posixpath to get parents of a directory

* removing whitespace (sorry)

* Remove import pathlib from zipfile.py

* Rewrite _parents as a slice on a generator of the ancestry of a path.

* Remove check for '.' and '/', now that parents no longer returns those.

* Separate calculation of implied dirs from adding those

* Re-use _implied_dirs in tests for generating zipfile with dir entries.

* Replace three fixtures (abcde, abcdef, abde) with one representative example alpharep.

* Simplify implementation of _implied_dirs by collapsing the generation of parent directories for each name.

5 years agobpo-37830: Fix compilation of break and continue in finally. (GH-15320)
Serhiy Storchaka [Sat, 24 Aug 2019 10:11:52 +0000 (13:11 +0300)]
bpo-37830: Fix compilation of break and continue in finally. (GH-15320)

Fix compilation of "break" and "continue" in the
"finally" block when the corresponding "try" block
contains "return" with a non-constant value.

5 years agobpo-29535: Remove promize about hash randomization of datetime objects. (GH-15269)
Serhiy Storchaka [Sat, 24 Aug 2019 09:49:27 +0000 (12:49 +0300)]
bpo-29535: Remove promize about hash randomization of datetime objects. (GH-15269)

5 years agobpo-19119: Remove invalid test and rename a misnamed test (GH-15442)
Raymond Hettinger [Sat, 24 Aug 2019 05:31:22 +0000 (22:31 -0700)]
bpo-19119: Remove invalid test and rename a misnamed test (GH-15442)

5 years agoFix link to changelog in 3.9 What's New page (GH-15445)
Ned Deily [Sat, 24 Aug 2019 05:12:05 +0000 (01:12 -0400)]
Fix link to changelog in 3.9 What's New page (GH-15445)

5 years agoFix funny typo in Doc/bugs. (GH-15412)
Antoine [Sat, 24 Aug 2019 04:09:43 +0000 (06:09 +0200)]
Fix funny typo in  Doc/bugs. (GH-15412)

Fix typo in description of link to mozilla bug report writing guidelines.

Though the URL is misleading, we're indeed trying to write bug _reports_, not to add bugs.

Automerge-Triggered-By: @ned-deily
5 years agobpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() (GH-15266)
Dong-hee Na [Fri, 23 Aug 2019 22:20:30 +0000 (07:20 +0900)]
bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() (GH-15266)

5 years agobpo-37549: os.dup() fails for standard streams on Windows 7 (GH-15389)
Zackery Spytz [Fri, 23 Aug 2019 18:38:41 +0000 (12:38 -0600)]
bpo-37549: os.dup() fails for standard streams on Windows 7 (GH-15389)

5 years agobpo-26589: Add http status code 451 (GH-15413)
Raymond Hettinger [Fri, 23 Aug 2019 17:19:15 +0000 (10:19 -0700)]
bpo-26589: Add http status code 451 (GH-15413)

5 years agobpo-36763: PyConfig_Read() handles PySys_AddXOption() (GH-15431)
Victor Stinner [Fri, 23 Aug 2019 17:03:08 +0000 (18:03 +0100)]
bpo-36763: PyConfig_Read() handles PySys_AddXOption() (GH-15431)

PyConfig_Read() is now responsible to handle early calls to
PySys_AddXOption() and PySys_AddWarnOption().

Options added by PySys_AddXOption() are now handled the same way than
PyConfig.xoptions and command line -X options.

For example, PySys_AddXOption(L"faulthandler") enables faulthandler
as expected.

5 years agobpo-36763, doc: Add links in the new C API init doc (GH-15433)
Victor Stinner [Fri, 23 Aug 2019 16:59:12 +0000 (17:59 +0100)]
bpo-36763, doc: Add links in the new C API init doc (GH-15433)

5 years agobpo-36763: Implement PyWideStringList_Insert() of PEP 587 (GH-15423)
Victor Stinner [Fri, 23 Aug 2019 15:57:54 +0000 (16:57 +0100)]
bpo-36763: Implement PyWideStringList_Insert() of PEP 587 (GH-15423)

5 years agoFix _PyTime_MIN/MAX values (GH-15384)
Sergey Fedoseev [Fri, 23 Aug 2019 15:39:09 +0000 (20:39 +0500)]
Fix _PyTime_MIN/MAX values (GH-15384)

_PyTime_t type is defined as int64_t, and so min/max are INT64_MIN/INT64_MAX,
not PY_LLONG_MIN/PY_LLONG_MAX.

5 years agobpo-14465: Add an indent() function to xml.etree.ElementTree to pretty-print XML...
Stefan Behnel [Fri, 23 Aug 2019 14:44:25 +0000 (16:44 +0200)]
bpo-14465: Add an indent() function to xml.etree.ElementTree to pretty-print XML trees (GH-15200)

5 years agotest_gdb: use unittest test discovery (GH-15405)
Victor Stinner [Fri, 23 Aug 2019 10:28:27 +0000 (11:28 +0100)]
test_gdb: use unittest test discovery (GH-15405)

Replace test.support.run_unittest() with unittest.main()
to automatically discover test cases, instead of having
an maintaing manually a list which may be incomplete.

Remove also an unused variable.

5 years agobpo-37531: Fix regrtest _timedout() function on timeout (GH-15419)
Victor Stinner [Fri, 23 Aug 2019 10:27:24 +0000 (11:27 +0100)]
bpo-37531: Fix regrtest _timedout() function on timeout (GH-15419)

Fix code handling TimeoutExpired exception in _timedout().

5 years agobpo-37926: Fix PySys_SetArgvEx(0, NULL, 0) crash (GH-15415)
Victor Stinner [Fri, 23 Aug 2019 10:04:16 +0000 (11:04 +0100)]
bpo-37926: Fix PySys_SetArgvEx(0, NULL, 0) crash (GH-15415)

empty_argv is no longer static in Python 3.8, but it is declared in
a temporary scope, whereas argv keeps a reference to it.
empty_argv memory (allocated on the stack) is reused by
make_sys_argv() code which is inlined when using gcc -O3.

Define empty_argv in PySys_SetArgvEx() body, to ensure
that it remains valid for the whole lifetime of
the PySys_SetArgvEx() call.

5 years agoCorrect minor grammar mistake (GH-15404)
Andre Delfino [Fri, 23 Aug 2019 09:58:27 +0000 (06:58 -0300)]
Correct minor grammar mistake (GH-15404)

5 years agobpo-30826: Improve control flow examples (GH-15407)
Raymond Hettinger [Fri, 23 Aug 2019 06:44:19 +0000 (23:44 -0700)]
bpo-30826: Improve control flow examples (GH-15407)

5 years agobpo-12634: Clarify an awkward section of the tutorial (GH-15406)
Raymond Hettinger [Fri, 23 Aug 2019 06:27:04 +0000 (23:27 -0700)]
bpo-12634: Clarify an awkward section of the tutorial (GH-15406)

5 years agobpo-30550: Clarify JSON ordering guarantees (GH-15397)
Raymond Hettinger [Thu, 22 Aug 2019 22:14:42 +0000 (15:14 -0700)]
bpo-30550: Clarify JSON ordering guarantees (GH-15397)

5 years agobpo-37915: Fix comparison between tzinfo objects and timezone objects (GH-15390)
Pablo Galindo [Thu, 22 Aug 2019 19:24:25 +0000 (20:24 +0100)]
bpo-37915: Fix comparison between tzinfo objects and timezone objects (GH-15390)

https://bugs.python.org/issue37915

Automerge-Triggered-By: @pablogsal
5 years agobpo-28556: Add a regression test to typing (GH-15396)
Ivan Levkivskyi [Thu, 22 Aug 2019 17:48:01 +0000 (18:48 +0100)]
bpo-28556: Add a regression test to typing (GH-15396)

This adds a regression test for the issue found in the Python 2 backport, see https://github.com/python/typing/issues/656

https://bugs.python.org/issue28556

5 years agobpo-32554: Deprecate hashing arbitrary types in random.seed() (GH-15382)
Raymond Hettinger [Thu, 22 Aug 2019 16:19:36 +0000 (09:19 -0700)]
bpo-32554: Deprecate hashing arbitrary types in random.seed() (GH-15382)

5 years agobpo-14050: Note that not all data can be sorted (GH-15381)
Raymond Hettinger [Thu, 22 Aug 2019 16:11:35 +0000 (09:11 -0700)]
bpo-14050: Note that not all data can be sorted (GH-15381)

5 years agobpo-27961: Remove leftovers from the times when long long wasn't required (GH-15388)
Sergey Fedoseev [Thu, 22 Aug 2019 15:28:28 +0000 (20:28 +0500)]
bpo-27961: Remove leftovers from the times when long long wasn't required (GH-15388)

5 years agoAdd missing space to warning message (GH-14915)
Florian Bruhin [Thu, 22 Aug 2019 06:06:51 +0000 (08:06 +0200)]
Add missing space to warning message (GH-14915)

This typo was introduced in GH-13409 when changing the message text.

5 years agoRefactor Parser/pgen and add documentation and explanations (GH-15373)
Pablo Galindo [Thu, 22 Aug 2019 01:38:39 +0000 (02:38 +0100)]
Refactor Parser/pgen and add documentation and explanations (GH-15373)

* Refactor Parser/pgen and add documentation and explanations

To improve the readability and maintainability of the parser
generator perform the following transformations:

    * Separate the metagrammar parser in its own class to simplify
      the parser generator logic.

    * Create separate classes for DFAs and NFAs and move methods that
      act exclusively on them from the parser generator to these
      classes.

    * Add docstrings and comment documenting the process to go from
      the grammar file into NFAs and then DFAs. Detail some of the
      algorithms and give some background explanations of some concepts
      that will helps readers not familiar with the parser generation
      process.

    * Select more descriptive names for some variables and variables.

    * PEP8 formatting and quote-style homogenization.

The output of the parser generator remains the same (Include/graminit.h
and Python/graminit.c remain untouched by running the new parser generator).

5 years agobpo-37834: Fix test on Windows 7 (GH-15377)
Steve Dower [Thu, 22 Aug 2019 00:42:56 +0000 (17:42 -0700)]
bpo-37834: Fix test on Windows 7 (GH-15377)

5 years agobpo-9949: Call normpath() in realpath() and avoid unnecessary prefixes (GH-15369)
Steve Dower [Wed, 21 Aug 2019 23:45:02 +0000 (16:45 -0700)]
bpo-9949: Call normpath() in realpath() and avoid unnecessary prefixes (GH-15369)

5 years agobpo-36311: Fixes decoding multibyte characters around chunk boundaries and improves...
Steve Dower [Wed, 21 Aug 2019 23:22:33 +0000 (16:22 -0700)]
bpo-36311: Fixes decoding multibyte characters around chunk boundaries and improves decoding performance (GH-15083)

5 years agobpo-37482: Fix email address name with encoded words and special chars (GH-14561)
bsiem [Wed, 21 Aug 2019 23:00:39 +0000 (01:00 +0200)]
bpo-37482: Fix email address name with encoded words and special chars (GH-14561)

Special characters in email address header display names are normally
put within double quotes. However, encoded words (=?charset?x?...?=) are
not allowed withing double quotes. When the header contains a word with
special characters and another word that must be encoded, the first one
must also be encoded.

In the next example, the display name in the From header is quoted and
therefore the comma is allowed; in the To header, the comma is not
within quotes and not encoded, which is not allowed and therefore
rejected by some mail servers.

From: "Foo Bar, France" <foo@example.com>
To: Foo Bar, =?utf-8?q?Espa=C3=B1a?= <foo@example.com>

https://bugs.python.org/issue37482

5 years agobpo-37663: have venv activation scripts all consistently use __VENV_PROMPT__ for...
Brett Cannon [Wed, 21 Aug 2019 22:58:01 +0000 (15:58 -0700)]
bpo-37663: have venv activation scripts all consistently use __VENV_PROMPT__ for prompt customization (GH-14941)

The activation scripts generated by venv were inconsistent in how they changed the shell's prompt. Some used `__VENV_PROMPT__` exclusively, some used `__VENV_PROMPT__` if it was set even though by default `__VENV_PROMPT__` is always set and the fallback matched the default, and one ignored `__VENV_PROMPT__` and used `__VENV_NAME__` instead (and even used a differing format to the default prompt). This change now has all activation scripts use `__VENV_PROMPT__` only and relies on the fact that venv sets that value by default.

The color of the customization is also now set in fish to the blue from the Python logo for as hex color support is built into that shell (much like PowerShell where the built-in green color is used).

5 years agobpo-37834: Normalise handling of reparse points on Windows (GH-15231)
Steve Dower [Wed, 21 Aug 2019 22:27:33 +0000 (15:27 -0700)]
bpo-37834: Normalise handling of reparse points on Windows (GH-15231)

bpo-37834: Normalise handling of reparse points on Windows
* ntpath.realpath() and nt.stat() will traverse all supported reparse points (previously was mixed)
* nt.lstat() will let the OS traverse reparse points that are not name surrogates (previously would not traverse any reparse point)
* nt.[l]stat() will only set S_IFLNK for symlinks (previous behaviour)
* nt.readlink() will read destinations for symlinks and junction points only

bpo-1311: os.path.exists('nul') now returns True on Windows
* nt.stat('nul').st_mode is now S_IFCHR (previously was an error)

5 years agoRevert mode change that loses information in directory listings on Linux. (#15366)
Stefan Krah [Wed, 21 Aug 2019 21:00:04 +0000 (23:00 +0200)]
Revert mode change that loses information in directory listings on Linux. (#15366)

5 years agobpo-9949: Enable symlink traversal for ntpath.realpath (GH-15287)
Steve Dower [Wed, 21 Aug 2019 20:43:06 +0000 (13:43 -0700)]
bpo-9949: Enable symlink traversal for ntpath.realpath (GH-15287)

5 years agoFix difflib `?` hint in diff output when dealing with tabs (#15201)
Anthony Sottile [Wed, 21 Aug 2019 18:59:26 +0000 (11:59 -0700)]
Fix difflib `?` hint in diff output when dealing with tabs (#15201)

5 years agoUpdate asyncio.ensure_future() documentation (GH-15347)
Roger Iyengar [Wed, 21 Aug 2019 15:59:11 +0000 (11:59 -0400)]
Update asyncio.ensure_future() documentation (GH-15347)

Added back mention that ensure_future actually scheduled obj. This documentation just mentions what ensure_future returns, so I did not realize that ensure_future also schedules obj.

5 years agobpo-37751: Fix codecs.lookup() normalization (GH-15092)
Jordon Xu [Wed, 21 Aug 2019 13:26:20 +0000 (21:26 +0800)]
bpo-37751: Fix codecs.lookup() normalization (GH-15092)

Fix codecs.lookup() to normalize the encoding name the same way
than encodings.normalize_encoding(), except that codecs.lookup()
also converts the name to lower case.

5 years agobpo-37860: Add netlify deploy preview for docs (GH-15288)
Ashwin Ramaswami [Wed, 21 Aug 2019 13:08:47 +0000 (06:08 -0700)]
bpo-37860: Add netlify deploy preview for docs (GH-15288)

* add netlify deploy preview

* fix publish path

* install python3 venv

* add sudo

* try without venv

* install right dependencies

* use python3, not python

* use pip3

* python3.7

* use requirements.txt

* move requirements.txt to Doc

* use python 3.7 in runtime.txt

* move runtime.txt

* Update requirements.txt

5 years agobpo-37851: faulthandler allocates its stack on demand (GH-15358)
Victor Stinner [Wed, 21 Aug 2019 12:40:42 +0000 (13:40 +0100)]
bpo-37851: faulthandler allocates its stack on demand (GH-15358)

The faulthandler module no longer allocates its alternative stack at
Python startup. Now the stack is only allocated at the first
faulthandler usage.

faulthandler no longer ignores memory allocation failure when
allocating the stack. sigaltstack() failure now raises an OSError
exception, rather than being ignored.

The alternative stack is no longer used if sigaction() is
not available. In practice, sigaltstack() should only be available
when sigaction() is avaialble, so this change should have no effect
in practice.

faulthandler.dump_traceback_later() internal locks are now only
allocated at the first dump_traceback_later() call, rather than
always being allocated at Python startup.

5 years agobpo-37823: Fix open() link in telnetlib doc (GH-15281)
Michael Anckaert [Wed, 21 Aug 2019 11:13:34 +0000 (13:13 +0200)]
bpo-37823: Fix open() link in telnetlib doc (GH-15281)

Fixed wrong link to Telnet.open() method in telnetlib documentation.

5 years agobpo-37531: Enhance regrtest multiprocess timeout (GH-15345)
Victor Stinner [Wed, 21 Aug 2019 09:59:20 +0000 (10:59 +0100)]
bpo-37531: Enhance regrtest multiprocess timeout (GH-15345)

* Write a message when killing a worker process
* Put a timeout on the second popen.communicate() call
  (after killing the process)
* Put a timeout on popen.wait() call
* Catch popen.kill() and popen.wait() exceptions

5 years agoUnmark files as executable that can't actually be executed. (GH-15353)
Greg Price [Wed, 21 Aug 2019 04:53:59 +0000 (21:53 -0700)]
Unmark files as executable that can't actually be executed. (GH-15353)

There are plenty of legitimate scripts in the tree that begin with a
`#!`, but also a few that seem to be marked executable by mistake.

Found them with this command -- it gets executable files known to Git,
filters to the ones that don't start with a `#!`, and then unmarks
them as executable:

    $ git ls-files --stage \
      | perl -lane 'print $F[3] if (!/^100644/)' \
      | while read f; do
          head -c2 "$f" | grep -qxF '#!' \
          || chmod a-x "$f"; \
        done

Looking at the list by hand confirms that we didn't sweep up any
files that should have the executable bit after all.  In particular

 * The `.psd` files are images from Photoshop.

 * The `.bat` files sure look like things that can be run.
   But we have lots of other `.bat` files, and they don't have
   this bit set, so it must not be needed for them.

Automerge-Triggered-By: @benjaminp
5 years agobpo-35518: Skip test that relies on a deceased network service. (GH-15349)
Greg Price [Wed, 21 Aug 2019 03:50:51 +0000 (20:50 -0700)]
bpo-35518: Skip test that relies on a deceased network service. (GH-15349)

If this service had thoroughly vanished, we could just ignore the
test until someone gets around to either recreating such a service
or redesigning the test to somehow work locally.  The
`support.transient_internet` mechanism catches the failure to
resolve the domain name, and skips the test.

But in fact the domain snakebite.net does still exist, as do its
nameservers -- and they can be quite slow to reply.  As a result
this test can easily take 20-30s before it gets auto-skipped.

So, skip the test explicitly up front.

5 years agoabstract.c should not be executable. (GH-15348)
Benjamin Peterson [Wed, 21 Aug 2019 02:19:43 +0000 (19:19 -0700)]
abstract.c should not be executable. (GH-15348)

5 years agoRemove a dead comment from ossaudiodev.c (#15346)
Brett Cannon [Tue, 20 Aug 2019 19:20:47 +0000 (12:20 -0700)]
Remove a dead comment from ossaudiodev.c (#15346)

5 years agobpo-32793: Fix a duplicate debug message in smtplib (GH-15341)
Zackery Spytz [Tue, 20 Aug 2019 17:52:25 +0000 (11:52 -0600)]
bpo-32793: Fix a duplicate debug message in smtplib (GH-15341)

_get_socket() already prints a debug message for the host and port.

https://bugs.python.org/issue32793

Automerge-Triggered-By: @maxking
5 years agobpo-15913: Implement PyBuffer_SizeFromFormat() (GH-13873)
Joannah Nanjekye [Tue, 20 Aug 2019 14:46:36 +0000 (11:46 -0300)]
bpo-15913: Implement PyBuffer_SizeFromFormat() (GH-13873)

Implement PyBuffer_SizeFromFormat() function (previously
documented but not implemented): call struct.calcsize().

5 years agobpo-37732: Fix GCC warning in _PyObject_Malloc() (GH-15333)
Victor Stinner [Tue, 20 Aug 2019 11:28:02 +0000 (12:28 +0100)]
bpo-37732: Fix GCC warning in _PyObject_Malloc() (GH-15333)

pymalloc_alloc() now returns directly the pointer, return NULL on
memory allocation error.

allocate_from_new_pool() already uses NULL as marker for "allocation
failed".

5 years agobpo-37868: Improve is_dataclass for instances. (GH-15325)
Eric V. Smith [Tue, 20 Aug 2019 05:40:28 +0000 (01:40 -0400)]
bpo-37868: Improve is_dataclass for instances. (GH-15325)

5 years agoMinor documentation fixes on library/enum (GH-15234)
Antoine [Tue, 20 Aug 2019 01:41:31 +0000 (03:41 +0200)]
Minor documentation fixes on library/enum (GH-15234)

* Minor documentation fixes on library/enum

5 years agoDelete stale comment in Python/getopt.c. (GH-14719)
Hansraj Das [Tue, 20 Aug 2019 01:35:13 +0000 (07:05 +0530)]
Delete stale comment in Python/getopt.c. (GH-14719)

5 years agoRevert "bpo-37788: Fix a reference leak if a thread is not joined (GH-15228)" (GH...
Victor Stinner [Mon, 19 Aug 2019 23:47:07 +0000 (00:47 +0100)]
Revert "bpo-37788: Fix a reference leak if a thread is not joined (GH-15228)" (GH-15338)

This reverts commit d3dcc92778807ae8f7ebe85178f36a29711cd478.

5 years agobpo-37788: Fix a reference leak if a thread is not joined (GH-15228)
Victor Stinner [Mon, 19 Aug 2019 22:37:17 +0000 (23:37 +0100)]
bpo-37788: Fix a reference leak if a thread is not joined (GH-15228)

Add threading.Thread.__del__() method to ensure that the thread state
lock is removed from the _shutdown_locks list when a thread
completes.

5 years agoRemove 'unstable' warning for Windows Store package in docs (GH-15334)
Steve Dower [Mon, 19 Aug 2019 17:07:25 +0000 (10:07 -0700)]
Remove 'unstable' warning for Windows Store package in docs (GH-15334)

5 years agobpo-36266: Add module name in ImportError when DLL not found on Windows (GH-15180)
shireenrao [Sat, 17 Aug 2019 20:50:39 +0000 (16:50 -0400)]
bpo-36266: Add module name in ImportError when DLL not found on Windows (GH-15180)

5 years agoInsert a missing close parenthesis (GH-15316)
cocoatomo [Sat, 17 Aug 2019 20:40:23 +0000 (05:40 +0900)]
Insert a missing close parenthesis (GH-15316)

5 years agofix link to time function from time_ns doc (GH-15285)
Éric Araujo [Sat, 17 Aug 2019 20:34:08 +0000 (16:34 -0400)]
fix link to time function from time_ns doc (GH-15285)

Because mod, func, class, etc all share one namespace, :func:time creates a link to the time module doc page rather than the time.time function.

5 years agoAdd a minor `Fraction.__hash__()` optimization (GH-15313)
Tim Peters [Sat, 17 Aug 2019 02:09:16 +0000 (21:09 -0500)]
Add a minor `Fraction.__hash__()` optimization (GH-15313)

* Add a minor `Fraction.__hash__` optimization that got lost in the shuffle.

Document the optimizations.

5 years agobpo-37540: vectorcall: keyword names must be strings (GH-14682)
Jeroen Demeyer [Fri, 16 Aug 2019 10:41:27 +0000 (12:41 +0200)]
bpo-37540: vectorcall: keyword names must be strings (GH-14682)

The fact that keyword names are strings is now part of the vectorcall and `METH_FASTCALL` protocols. The biggest concrete change is that `_PyStack_UnpackDict` now checks that and raises `TypeError` if not.

CC @markshannon @vstinner

https://bugs.python.org/issue37540

5 years agobpo-37863: Optimize Fraction.__hash__() (#15298)
Raymond Hettinger [Fri, 16 Aug 2019 03:58:26 +0000 (20:58 -0700)]
bpo-37863: Optimize Fraction.__hash__() (#15298)

5 years agoIndent code inside if block. (GH-15284)
Hansraj Das [Thu, 15 Aug 2019 16:19:07 +0000 (21:49 +0530)]
Indent code inside if block. (GH-15284)

Without indendation, seems like strcpy line is parallel to `if` condition.

5 years agobpo-37207: enable vectorcall for type.__call__ (GH-14588)
Jeroen Demeyer [Thu, 15 Aug 2019 15:49:46 +0000 (17:49 +0200)]
bpo-37207: enable vectorcall for type.__call__ (GH-14588)

Base PR for other PRs that want to play with `type.__call__` such as #13930 and #14589.

The author is really @markshannon I just made the PR.

https://bugs.python.org/issue37207

Automerge-Triggered-By: @encukou
5 years agoReplace usage of the obscure PEM_read_bio_X509_AUX with the more standard PEM_read_bi...
Alex Gaynor [Thu, 15 Aug 2019 12:31:28 +0000 (08:31 -0400)]
Replace usage of the obscure PEM_read_bio_X509_AUX with the more standard PEM_read_bio_X509 (GH-15303)

X509_AUX is an odd, note widely used, OpenSSL extension to the X509 file format. This function doesn't actually use any of the extra metadata that it parses, so just use the standard API.

Automerge-Triggered-By: @tiran
5 years agobpo-37760: Avoid cluttering work tree with downloaded Unicode files. (GH-15128)
Greg Price [Thu, 15 Aug 2019 01:18:53 +0000 (18:18 -0700)]
bpo-37760: Avoid cluttering work tree with downloaded Unicode files. (GH-15128)

5 years agobpo-37775: Update compileall doc for invalidation_mode parameter (GH-15148)
Hai Shi [Wed, 14 Aug 2019 22:03:11 +0000 (17:03 -0500)]
bpo-37775: Update compileall doc for invalidation_mode parameter (GH-15148)

5 years agobpo-21131: Fix faulthandler.register(chain=True) stack (GH-15276)
Victor Stinner [Wed, 14 Aug 2019 21:35:27 +0000 (23:35 +0200)]
bpo-21131: Fix faulthandler.register(chain=True) stack (GH-15276)

faulthandler now allocates a dedicated stack of SIGSTKSZ*2 bytes,
instead of just SIGSTKSZ bytes. Calling the previous signal handler
in faulthandler signal handler uses more than SIGSTKSZ bytes of stack
memory on some platforms.

5 years agobpo-37811: FreeBSD, OSX: fix poll(2) usage in sockets module (GH-15202)
Artem Khramov [Wed, 14 Aug 2019 21:21:48 +0000 (03:21 +0600)]
bpo-37811: FreeBSD, OSX: fix poll(2) usage in sockets module (GH-15202)

FreeBSD implementation of poll(2) restricts the timeout argument to be
either zero, or positive, or equal to INFTIM (-1).

Unless otherwise overridden, socket timeout defaults to -1. This value
is then converted to milliseconds (-1000) and used as argument to the
poll syscall. poll returns EINVAL (22), and the connection fails.

This bug was discovered during the EINTR handling testing, and the
reproduction code can be found in
https://bugs.python.org/issue23618 (see connect_eintr.py,
attached). On GNU/Linux, the example runs as expected.

This change is trivial:
If the supplied timeout value is negative, truncate it to -1.

5 years agobpo-37826: Document exception chaining in Python tutorial for errors. (GH-15243)
Abhilash Raj [Wed, 14 Aug 2019 21:11:32 +0000 (14:11 -0700)]
bpo-37826: Document exception chaining in Python tutorial for errors. (GH-15243)

https://bugs.python.org/issue37826

5 years agobpo-37849: IDLE: fix completion window positioning above line (GH-15267)
Tal Einat [Wed, 14 Aug 2019 17:06:06 +0000 (20:06 +0300)]
bpo-37849: IDLE: fix completion window positioning above line (GH-15267)

5 years agobpo-36030: Improve performance of some tuple operations (GH-12052)
Sergey Fedoseev [Wed, 14 Aug 2019 14:10:33 +0000 (19:10 +0500)]
bpo-36030: Improve performance of some tuple operations (GH-12052)

5 years agobpo-37531: Fix regrtest timeout for subprocesses (GH-15072)
Victor Stinner [Wed, 14 Aug 2019 12:18:51 +0000 (14:18 +0200)]
bpo-37531: Fix regrtest timeout for subprocesses (GH-15072)

Co-Authored-By: Joannah Nanjekye <joannah.nanjekye@ibm.com>
5 years agobpo-36502: Correct documentation of str.isspace() (GH-15019)
Greg Price [Wed, 14 Aug 2019 11:05:19 +0000 (04:05 -0700)]
bpo-36502: Correct documentation of str.isspace() (GH-15019)

The documented definition was much broader than the real one:
there are tons of characters with general category "Other",
and we don't (and shouldn't) treat most of them as whitespace.

Rewrite the definition to agree with the comment on
_PyUnicode_IsWhitespace, and with the logic in makeunicodedata.py,
which is what generates that function and so ultimately governs.

Add suitable breadcrumbs so that a reader who wants to pin down
exactly what this definition means (what's a "bidirectional class"
of "B"?) can do so.  The `unicodedata` module documentation is an
appropriate central place for our references to Unicode's own copious
documentation, so point there.

Also add to the isspace() test a thorough check that the
implementation agrees with the intended definition.

5 years agobpo-37738: Fix curses addch(str, color_pair) (GH-15071)
Victor Stinner [Wed, 14 Aug 2019 10:31:43 +0000 (12:31 +0200)]
bpo-37738: Fix curses addch(str, color_pair) (GH-15071)

Fix the implementation of curses addch(str, color_pair): pass the
color pair to setcchar(), instead of always passing 0 as the color
pair.

5 years agobpo-37681: no_sanitize_thread support from GCC 5.1 (GH-15096)
Hai Shi [Wed, 14 Aug 2019 09:50:19 +0000 (04:50 -0500)]
bpo-37681: no_sanitize_thread support from GCC 5.1 (GH-15096)

Fix the following warning with GCC 4.8.5:
Objects/obmalloc.c: warning: ‘no_sanitize_thread’ attribute directive ignored

5 years agobpo-37337: Fix a GCC 9 warning in Objects/descrobject.c (GH-14814)
Zackery Spytz [Wed, 14 Aug 2019 05:51:06 +0000 (23:51 -0600)]
bpo-37337: Fix a GCC 9 warning in Objects/descrobject.c (GH-14814)

Commit b1263d5a60d3f7ab02dd28409fff59b3815a3f67 causes GCC 9.1.0 to
give a warning in Objects/descrobject.c.

5 years agobpo-37760: Factor out standard range-expanding logic in makeunicodedata. (GH-15248)
Greg Price [Wed, 14 Aug 2019 02:28:38 +0000 (19:28 -0700)]
bpo-37760: Factor out standard range-expanding logic in makeunicodedata. (GH-15248)

Much like the lower-level logic in commit ef2af1ad4, we had
4 copies of this logic, written in a couple of different ways.
They're all implementing the same standard, so write it just once.

5 years agobpo-37256: Wording in Request class docs (#14792)
Ngalim Siregar [Wed, 14 Aug 2019 01:10:58 +0000 (08:10 +0700)]
bpo-37256: Wording in Request class docs (#14792)

* bpo-37256: Wording in Request class docs

* 📜🤖 Added by blurb_it.

* Update Misc/NEWS.d/next/Documentation/2019-07-16-14-48-12.bpo-37256.qJTrBb.rst

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
5 years agobpo-25172: Add test for crypt ImportError on Windows (GH-15252)
shireenrao [Tue, 13 Aug 2019 21:27:34 +0000 (17:27 -0400)]
bpo-25172: Add test for crypt ImportError on Windows (GH-15252)

5 years agobpo-37689: add Path.is_relative_to() method (GH-14982)
Hai Shi [Tue, 13 Aug 2019 19:54:02 +0000 (14:54 -0500)]
bpo-37689: add Path.is_relative_to() method (GH-14982)

5 years agobpo-37814: Document the empty tuple type annotation syntax (GH-15208)
Josh Holland [Tue, 13 Aug 2019 19:05:09 +0000 (20:05 +0100)]
bpo-37814: Document the empty tuple type annotation syntax (GH-15208)

https://bugs.python.org/issue37814:

> The empty tuple syntax in type annotations, `Tuple[()]`, is not obvious from the examples given in the documentation (I naively expected `Tuple[]` to work); it has been documented in PEP 484 and in mypy, but not in the documentation for the typing module.

https://bugs.python.org/issue37814

5 years agobpo-37583: Add err 113 to support.get_socket_conn_refused_errs() (GH-14729)
Hai Shi [Tue, 13 Aug 2019 17:37:59 +0000 (12:37 -0500)]
bpo-37583: Add err 113 to support.get_socket_conn_refused_errs() (GH-14729)

Add error number 113 EHOSTUNREACH to get_socket_conn_refused_errs()
of test.support.

5 years agobpo-37841: Remove python_uwp dependency on msvcp140.dll (GH-15253)
Steve Dower [Tue, 13 Aug 2019 17:34:07 +0000 (10:34 -0700)]
bpo-37841: Remove python_uwp dependency on msvcp140.dll (GH-15253)

5 years agobpo-37760: Constant-fold some old options in makeunicodedata. (GH-15129)
Greg Price [Tue, 13 Aug 2019 05:59:30 +0000 (22:59 -0700)]
bpo-37760: Constant-fold some old options in makeunicodedata. (GH-15129)

The `expand` option was introduced in 2000 in commit fad27aee1.
It appears to have been always set since it was committed, and
what it does is tell the code to do something essential.  So,
just always do that, and cut the option.

Also cut the `linebreakprops` option, which isn't consulted anymore.

5 years agobpo-37758: Clean out vestigial script-bits from test_unicodedata. (GH-15126)
Greg Price [Tue, 13 Aug 2019 05:58:01 +0000 (22:58 -0700)]
bpo-37758: Clean out vestigial script-bits from test_unicodedata. (GH-15126)

This file started life as a script, before conversion to a
`unittest` test file.  Clear out some legacies of that conversion
that are a bit confusing about how it works.

Most notably, it's unlikely there's still a good reason to try
to recover from `unicodedata` failing to import -- as there was
when that logic was first added, when the module was very new.
So take that out entirely.  Keep `self.db` working, though, to
avoid a noisy diff.

5 years agobpo-37760: Mark all generated Unicode data headers as generated. (GH-15171)
Greg Price [Tue, 13 Aug 2019 05:23:41 +0000 (22:23 -0700)]
bpo-37760: Mark all generated Unicode data headers as generated. (GH-15171)

This causes them to be collapsed by default in diffs shown on GitHub.

https://bugs.python.org/issue37760

Automerge-Triggered-By: @benjaminp
5 years agobpo-37760: Factor out the basic UCD parsing logic of makeunicodedata. (GH-15130)
Greg Price [Tue, 13 Aug 2019 05:20:56 +0000 (22:20 -0700)]
bpo-37760: Factor out the basic UCD parsing logic of makeunicodedata. (GH-15130)

There were 10 copies of this, and almost as many distinct versions of
exactly how it was written.  They're all implementing the same
standard.  Pull them out to the top, so the more interesting logic
that remains becomes easier to read.

5 years agobpo-37759: Second round of edits to Whatsnew 3.8 (GH-15204)
Raymond Hettinger [Mon, 12 Aug 2019 22:55:18 +0000 (15:55 -0700)]
bpo-37759: Second round of edits to Whatsnew 3.8 (GH-15204)