]> granicus.if.org Git - python/log
python
6 years agobpo-34365: Update date object documentation (GH-8814)
Danish Prakash [Tue, 11 Sep 2018 20:59:23 +0000 (02:29 +0530)]
bpo-34365: Update date object documentation (GH-8814)

Python 3.x does not fall back to comparing object addresses when comparing two `dt` objects.

<!-- issue-number: [bpo-34365](https://www.bugs.python.org/issue34365) -->
https://bugs.python.org/issue34365
<!-- /issue-number -->

6 years agocloses bpo-31608: Fix a crash in methods of a subclass of _collections.deque with...
Oren Milman [Tue, 11 Sep 2018 18:46:55 +0000 (21:46 +0300)]
closes bpo-31608: Fix a crash in methods of a subclass of _collections.deque with a bad __new__(). (GH-3788)

6 years agobpo-34613: document the correct value of limit argument of asyncio.StreamReader ...
Bram [Tue, 11 Sep 2018 18:45:26 +0000 (20:45 +0200)]
bpo-34613: document the correct value of limit argument of asyncio.StreamReader (GH-9121)

The default value of asyncio.StreamReader *limit* is `_DEFAULT_LIMIT` instead of `None`.

<!-- issue-number: [bpo-34613](https://www.bugs.python.org/issue34613) -->
https://bugs.python.org/issue34613
<!-- /issue-number -->

6 years agoUpdate VSTS to Azure DevOps and simplify dependencies (GH-9168)
Steve Dower [Tue, 11 Sep 2018 17:47:46 +0000 (10:47 -0700)]
Update VSTS to Azure DevOps and simplify dependencies (GH-9168)

6 years agobpo-28617 Fixed docs inaccuracies about the types that support membership tests ...
wim glenn [Tue, 11 Sep 2018 17:44:52 +0000 (12:44 -0500)]
bpo-28617 Fixed docs inaccuracies about the types that support membership tests (GH-9086)

<!-- issue-number: [bpo-28617](https://www.bugs.python.org/issue28617) -->
https://bugs.python.org/issue28617
<!-- /issue-number -->

6 years agobpo-29386: Pass -1 to epoll_wait() when timeout is < -1 (GH-9040)
Berker Peksag [Tue, 11 Sep 2018 17:29:48 +0000 (20:29 +0300)]
bpo-29386: Pass -1 to epoll_wait() when timeout is < -1 (GH-9040)

Although the kernel accepts any negative value for timeout, the
documented value to block indefinitely is -1.

This commit also makes the code similar to select.poll.poll().

6 years agobpo-34622: Extract asyncio exceptions into a separate module (GH-9141)
Andrew Svetlov [Tue, 11 Sep 2018 17:13:04 +0000 (10:13 -0700)]
bpo-34622: Extract asyncio exceptions into a separate module (GH-9141)

6 years agobpo-33649: First asyncio docs improvement pass (GH-9142)
Yury Selivanov [Tue, 11 Sep 2018 16:54:40 +0000 (09:54 -0700)]
bpo-33649: First asyncio docs improvement pass (GH-9142)

Rewritten/updated sections:

* Event Loop APIs
* Transports & Protocols
* Streams
* Exceptions
* Policies
* Queues
* Subprocesses
* Platforms

6 years agocloses bpo-29832: Remove "getsockaddrarg" from error messages. (GH-3163)
Oren Milman [Tue, 11 Sep 2018 16:51:29 +0000 (19:51 +0300)]
closes bpo-29832: Remove "getsockaddrarg" from error messages. (GH-3163)

6 years agocloses bpo-32490: Fix filename duplication in subprocess exception message. (GH-9163)
Zackery Spytz [Tue, 11 Sep 2018 15:54:07 +0000 (09:54 -0600)]
closes bpo-32490: Fix filename duplication in subprocess exception message. (GH-9163)

8621bb5d93239316f97281826461b85072ff6db7 sets the filename in directly in the FileNotFoundError, so we may revert the earlier fix 5f780400572508a8179de6a6c13b58b7be417ef5.

6 years agobpo-34405: Update to OpenSSL 1.1.0i for macOS installer builds (GH-9166)
Ned Deily [Tue, 11 Sep 2018 15:52:40 +0000 (08:52 -0700)]
bpo-34405: Update to OpenSSL 1.1.0i for macOS installer builds (GH-9166)

6 years agocloses bpo-33883: Mention type checkers in the FAQ. (GH-7760)
Andrés Delfino [Tue, 11 Sep 2018 05:12:41 +0000 (02:12 -0300)]
closes bpo-33883: Mention type checkers in the FAQ. (GH-7760)

6 years agobpo-33032: Mention the implicit cache in struct.Struct() docs (GH-7700)
Zackery Spytz [Tue, 11 Sep 2018 04:37:33 +0000 (22:37 -0600)]
bpo-33032: Mention the implicit cache in struct.Struct() docs (GH-7700)

Mention the implicit cache in struct.Struct() docs.

Consistent with the re.compile documentation note.

6 years agobpo-34625: Update vendorized expat version to 2.2.6. (GH-9150)
Benjamin Peterson [Tue, 11 Sep 2018 04:04:00 +0000 (21:04 -0700)]
bpo-34625: Update vendorized expat version to 2.2.6. (GH-9150)

6 years agoFix missing line from example shell session (GH-9143)
Raymond Hettinger [Tue, 11 Sep 2018 01:43:08 +0000 (18:43 -0700)]
Fix missing line from example shell session (GH-9143)

6 years agobpo-33487: improve BZ2File Deprecation and documentation. (GH-6785)
Matthias Bussonnier [Tue, 11 Sep 2018 01:15:56 +0000 (03:15 +0200)]
bpo-33487: improve BZ2File Deprecation and documentation. (GH-6785)

Emit warning when None passed explicitly, list Python version since
deprecation in warning message and docs.

6 years agobpo-33460: remove ellipsis that look like continuation prompts (GH-7851)
Lew Kurtz [Tue, 11 Sep 2018 01:13:08 +0000 (18:13 -0700)]
bpo-33460: remove ellipsis that look like continuation prompts (GH-7851)

Remove ellipsis that look like continuation prompts,
has a side benefit of putting rest of error message in proper text color.

6 years agoUse bytes.hex instead of binascii.hexlify in pbkdf2_hmac example (GH-8420)
Ville Skyttä [Tue, 11 Sep 2018 01:07:19 +0000 (04:07 +0300)]
Use bytes.hex instead of binascii.hexlify in pbkdf2_hmac example (GH-8420)

6 years agoLib/test/support: fix typo in docstring (GH-8506)
Daniel Hahler [Tue, 11 Sep 2018 01:04:33 +0000 (03:04 +0200)]
Lib/test/support: fix typo in docstring (GH-8506)

6 years agoRemove obsolete comment about latin-1 in `normalize_encoding` (GH-8739)
Anthony Sottile [Tue, 11 Sep 2018 00:54:37 +0000 (20:54 -0400)]
Remove obsolete comment about latin-1 in `normalize_encoding` (GH-8739)

This docstring has drifted since python2: https://github.com/python/cpython/blob/ca079a3ea30098aff3197c559a0e32d42dda6d84/Lib/encodings/__init__.py#L68

6 years agobpo-32270: Don't close stdin/out/err in pass_fds (GH-6242)
Gregory P. Smith [Tue, 11 Sep 2018 00:46:22 +0000 (17:46 -0700)]
bpo-32270: Don't close stdin/out/err in pass_fds (GH-6242)

When subprocess.Popen() stdin= stdout= or stderr= handles are specified
and appear in pass_fds=, don't close the original fds after dup'ing them.

This implementation and unittest primarily came from @izbyshev (see the PR)

See also https://github.com/izbyshev/cpython/commit/b89b52f28490b69142d5c061604b3a3989cec66c

This also removes the old manual p2cread, c2pwrite, and errwrite closing logic
as inheritable flags and _close_open_fds takes care of that properly today without special treatment.

This code is within child_exec() where it is the only thread so there is no
race condition between the dup and _Py_set_inheritable_async_safe call.

6 years agobpo-8110: Refactor platform detection in subprocess (GH-9053)
Zachary Ware [Mon, 10 Sep 2018 23:16:08 +0000 (16:16 -0700)]
bpo-8110: Refactor platform detection in subprocess (GH-9053)

Check for functionality via imports rather than checking sys.platform
specifically for Windows

6 years agoswitch descriptor howto to return value annotation (GH-7796)
NotAFile [Mon, 10 Sep 2018 21:35:38 +0000 (23:35 +0200)]
switch descriptor howto to return value annotation (GH-7796)

6 years agobpo-20180: itertools.groupby Argument Clinic conversion (GH-4170)
Tal Einat [Mon, 10 Sep 2018 18:33:08 +0000 (21:33 +0300)]
bpo-20180: itertools.groupby Argument Clinic conversion (GH-4170)

6 years agobpo-33217: Raise TypeError for non-Enum lookups in Enums (GH-6651)
Rahul Jha [Mon, 10 Sep 2018 18:21:04 +0000 (23:51 +0530)]
bpo-33217: Raise TypeError for non-Enum lookups in Enums (GH-6651)

* bpo-33217: Raise TypeError for non-Enum lookups in Enums

6 years agobpo-33604: Remove deprecated HMAC default value marked for removal in 3.8 (GH-7063)
Matthias Bussonnier [Mon, 10 Sep 2018 18:10:01 +0000 (20:10 +0200)]
bpo-33604: Remove deprecated HMAC default value marked for removal in 3.8 (GH-7063)

HMAC's digestmod was deprecated marked for removal, this removes it as planned.

6 years agocloses bpo-34525: Fix smtplib's authobject() documentation (GH-8965)
Sebastian Rittau [Mon, 10 Sep 2018 17:29:43 +0000 (19:29 +0200)]
closes bpo-34525: Fix smtplib's authobject() documentation (GH-8965)

6 years agobpo-26502: Implement FrameSummary.__len__() (GH-8632)
Berker Peksag [Mon, 10 Sep 2018 17:02:33 +0000 (20:02 +0300)]
bpo-26502: Implement FrameSummary.__len__() (GH-8632)

6 years agoFix misleading mentions of tp_size in comments (GH-9093)
Peter Eisentraut [Mon, 10 Sep 2018 16:46:08 +0000 (18:46 +0200)]
Fix misleading mentions of tp_size in comments (GH-9093)

Many type object initializations labeled a field "tp_size" in the
comment, but the name of that field is tp_basicsize.

6 years agobpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077)
Benjamin Peterson [Mon, 10 Sep 2018 15:43:10 +0000 (08:43 -0700)]
bpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077)

The recursive frame pruning code always undercounted the number of elided frames
by one. That is, in the "[Previous line repeated N more times]" message, N would
always be one too few. Near the recursive pruning cutoff, one frame could be
silently dropped. That situation is demonstrated in the OP of the bug report.

The fix is to start the identical frame counter at 1.

6 years agobpo-30977: rework code changes according to post-merge code review (GH-9106)
Tal Einat [Mon, 10 Sep 2018 13:11:04 +0000 (16:11 +0300)]
bpo-30977: rework code changes according to post-merge code review (GH-9106)

also mention the change and its consequences in What's New

6 years agoTest dict values iterator pickling with pickle.HIGHEST_PROTOCOL. (GH-9052)
Sergey Fedoseev [Mon, 10 Sep 2018 09:42:09 +0000 (14:42 +0500)]
Test dict values iterator pickling with pickle.HIGHEST_PROTOCOL. (GH-9052)

6 years agoRevert "Fix misindented yaml in logging how to example (GH-8604)" (GH-9081)
Rémy HUBSCHER [Mon, 10 Sep 2018 09:07:15 +0000 (11:07 +0200)]
Revert "Fix misindented yaml in logging how to example (GH-8604)" (GH-9081)

This reverts commit 10b59f1b019cd00c940dd7f4a74c4f667a20f25f.

6 years agoRemove unneeded PyUnicode_READY() in tokenizer.c (GH-9114)
Zackery Spytz [Mon, 10 Sep 2018 06:27:31 +0000 (00:27 -0600)]
Remove unneeded PyUnicode_READY() in tokenizer.c  (GH-9114)

6 years agobpo-34421 avoid unicode error in distutils logging (GH-8799)
Julien Malard [Sat, 8 Sep 2018 20:31:26 +0000 (02:01 +0530)]
bpo-34421 avoid unicode error in distutils logging (GH-8799)

This caused installation errors in some cases on Windows.
Patch by Julien Malard.

6 years agobpo-20104: Change the file_actions parameter of os.posix_spawn(). (GH-6725)
Serhiy Storchaka [Sat, 8 Sep 2018 11:48:18 +0000 (14:48 +0300)]
bpo-20104: Change the file_actions parameter of os.posix_spawn(). (GH-6725)

* Make its default value an empty tuple instead of None.
* Make it a keyword-only parameter.

6 years agobpo-33083: Update "What's new" with math.factorial changes (GH-9109)
Pablo Galindo [Fri, 7 Sep 2018 23:16:17 +0000 (00:16 +0100)]
bpo-33083: Update "What's new" with math.factorial changes (GH-9109)

* Add elimination of non-int-like parameters in math.factorial to "What's new".

6 years agobpo-34246: Make sure test_smtplib always cleans resources when finished (GH-9108)
Pablo Galindo [Fri, 7 Sep 2018 23:15:22 +0000 (00:15 +0100)]
bpo-34246: Make sure test_smtplib always cleans resources when finished (GH-9108)

* Make sure that when some of the tests in test_smtplib fail, the allocated threads
and sockets are not leaked.

* Use support.join_thread() instead of thread.join() to avoid infinite blocks.

6 years agobpo-34246: Use no mutable default args in smtplib (GH-8554)
Pablo Aguiar [Fri, 7 Sep 2018 22:04:48 +0000 (00:04 +0200)]
bpo-34246: Use no mutable default args in smtplib (GH-8554)

Some methods of the SMTP class use mutable default arguments. Specially
`send_message` is affected as it mutates one of the args by appending items
to it, which has side effects on further calls.

6 years agobpo-23855: Add missing NULL checks for malloc() in _msi.c (GH-9038)
Zackery Spytz [Fri, 7 Sep 2018 22:02:56 +0000 (16:02 -0600)]
bpo-23855: Add missing NULL checks for malloc() in _msi.c (GH-9038)

6 years agobpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098)
William Grzybowski [Fri, 7 Sep 2018 17:10:39 +0000 (14:10 -0300)]
bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098)

Pass the user/group name as Unicode to the formatting function,
instead of always decoding a bytes string from UTF-8.

6 years agobpo-34605: childs => children (GH-9102)
Victor Stinner [Fri, 7 Sep 2018 16:13:10 +0000 (18:13 +0200)]
bpo-34605: childs => children (GH-9102)

6 years agobpo-34595: Add %T format to PyUnicode_FromFormatV() (GH-9080)
Victor Stinner [Fri, 7 Sep 2018 16:00:58 +0000 (18:00 +0200)]
bpo-34595: Add %T format to PyUnicode_FromFormatV() (GH-9080)

* Add %T format to PyUnicode_FromFormatV(), and so to
  PyUnicode_FromFormat() and PyErr_Format(), to format an object type
  name: equivalent to "%s" with Py_TYPE(obj)->tp_name.
* Replace Py_TYPE(obj)->tp_name with %T format in unicodeobject.c.
* Add unit test on %T format.
* Rename unicode_fromformat_write_cstr() to
  unicode_fromformat_write_utf8(), to make the intent more explicit.

6 years agobpo-20104: Add flag capabilities to posix_spawn (GH-6693)
Pablo Galindo [Fri, 7 Sep 2018 15:44:24 +0000 (16:44 +0100)]
bpo-20104: Add flag capabilities to posix_spawn (GH-6693)

Implement the "attributes objects" parameter of `os.posix_spawn` to complete the implementation and fully cover the underlying API.

6 years agobpo-34605: Avoid master/slave terms (GH-9101)
Victor Stinner [Fri, 7 Sep 2018 15:30:33 +0000 (17:30 +0200)]
bpo-34605: Avoid master/slave terms (GH-9101)

* Replace "master process" with "parent process"
* Replace "master option mappings" with "main option mappings"
* Replace "master pattern object" with "main pattern object"
* ssl: replace "master" with "server"
* And some other similar changes

6 years agobpo-34605, libregrtest: Rename --slaveargs to --worker-args (GH-9099)
Victor Stinner [Fri, 7 Sep 2018 15:20:42 +0000 (17:20 +0200)]
bpo-34605, libregrtest: Rename --slaveargs to --worker-args (GH-9099)

Rename also run_tests_slave() to run_tests_worker().

6 years agobpo-33625: Release GIL for grp.getgr{nam,gid} and pwd.getpw{nam,uid} (GH-7081)
William Grzybowski [Fri, 7 Sep 2018 12:06:15 +0000 (09:06 -0300)]
bpo-33625: Release GIL for grp.getgr{nam,gid} and pwd.getpw{nam,uid} (GH-7081)

Release GIL on grp.getgrnam(), grp.getgrgid(), pwd.getpwnam() and
pwd.getpwuid() if reentrant variants of these functions are available.

Patch by William Grzybowski.

6 years agoDoc: Missing 'f' in an f-string. (GH-9074)
Julien Palard [Fri, 7 Sep 2018 09:31:47 +0000 (11:31 +0200)]
Doc: Missing 'f' in an f-string. (GH-9074)

6 years ago_sre.c: Removed unused SRE_IS_ALNUM macro (GH-9090)
Sergey Fedoseev [Fri, 7 Sep 2018 08:56:09 +0000 (13:56 +0500)]
_sre.c: Removed unused SRE_IS_ALNUM macro (GH-9090)

6 years agobpo-25750: fix refcounts in type_getattro() (GH-6118)
jdemeyer [Fri, 7 Sep 2018 07:37:00 +0000 (09:37 +0200)]
bpo-25750: fix refcounts in type_getattro() (GH-6118)

When calling tp_descr_get(self, obj, type), make sure that
we own a strong reference to "self".

6 years agocloses bpo-34599: Improve performance of _Py_bytes_capitalize(). (GH-9083)
Sergey Fedoseev [Fri, 7 Sep 2018 04:54:49 +0000 (09:54 +0500)]
closes bpo-34599: Improve performance of _Py_bytes_capitalize(). (GH-9083)

6 years agocloses bpo-34594: Don't hardcode errno values in the tests. (GH-9076)
Zackery Spytz [Thu, 6 Sep 2018 18:43:30 +0000 (12:43 -0600)]
closes bpo-34594: Don't hardcode errno values in the tests. (GH-9076)

6 years agobpo-30977: make uuid.UUID use __slots__ (GH-9078)
Tal Einat [Thu, 6 Sep 2018 11:34:25 +0000 (14:34 +0300)]
bpo-30977: make uuid.UUID use __slots__ (GH-9078)

Co-Authored-By: Wouter Bolsterlee.
6 years agocloses bpo-34581 : Conditionalize use of __pragma in Modules/socketmodule.c. (GH...
Erik Janssens [Wed, 5 Sep 2018 06:29:42 +0000 (08:29 +0200)]
closes bpo-34581 : Conditionalize use of __pragma in Modules/socketmodule.c. (GH-9067)

6 years agobpo-34565: Change a PC/launcher.c comment to accurately describe valid major versions...
Brendan Gerrity [Tue, 4 Sep 2018 16:35:46 +0000 (09:35 -0700)]
bpo-34565: Change a PC/launcher.c comment to accurately describe valid major versions. (GH-9037)

6 years agobpo-34563: Fix for invalid assert on big output of multiprocessing.Process (GH-9027)
Alexander Buchkovsky [Tue, 4 Sep 2018 16:10:28 +0000 (19:10 +0300)]
bpo-34563: Fix for invalid assert on big output of multiprocessing.Process (GH-9027)

Fix for invalid assert on big output of multiprocessing.Process.

6 years agobpo-26544: Add test for platform._comparable_version(). (GH-8973)
Serhiy Storchaka [Tue, 4 Sep 2018 12:04:25 +0000 (15:04 +0300)]
bpo-26544: Add test for platform._comparable_version(). (GH-8973)

6 years agobpo-34530: Fix distutils find_executable() (GH-9049)
Victor Stinner [Tue, 4 Sep 2018 09:01:09 +0000 (11:01 +0200)]
bpo-34530: Fix distutils find_executable() (GH-9049)

distutils.spawn.find_executable() now falls back on os.defpath if the
PATH environment variable is not set.

6 years agobpo-33613, test_semaphore_tracker_sigint: fix race condition (#7850)
Pablo Galindo [Tue, 4 Sep 2018 08:53:54 +0000 (09:53 +0100)]
bpo-33613, test_semaphore_tracker_sigint: fix race condition (#7850)

Fail `test_semaphore_tracker_sigint` if no warnings are expected and one is received.

Fix race condition when the child receives SIGINT before it can register signal handlers for it.

The race condition occurs when the parent calls
`_semaphore_tracker.ensure_running()` (which in turn spawns the
semaphore_tracker using `_posixsubprocess.fork_exec`), the child
registers the signal handlers and the parent tries to kill the child.
What seem to happen is that in some slow systems, the parent sends the
signal to kill the child before the child protects against the signal.

6 years agobpo-33083 - Make math.factorial reject arguments that are not int-like (GH-6149)
Pablo Galindo [Mon, 3 Sep 2018 21:20:06 +0000 (22:20 +0100)]
bpo-33083 - Make math.factorial reject arguments that are not int-like (GH-6149)

math.factorial() was accepting non-integral Decimal instances. This is inconsistent with the actual behaviour for floats, which are not accepted.

6 years agobpo-26901: Fix the Argument Clinic test suite (GH-8879)
Victor Stinner [Mon, 3 Sep 2018 21:17:20 +0000 (23:17 +0200)]
bpo-26901: Fix the Argument Clinic test suite (GH-8879)

* Fix Tools/clinic/clinic_test.py: add missing
  FakeClinic.destination_buffers attribute and pass a file argument
  to Clinic().
* Rename Tools/clinic/clinic_test.py to Lib/test/test_clinic.py:
  add temporary Tools/clinic/ to sys.path to import the clinic
  module.

Co-Authored-By: Pablo Galindo <pablogsal@gmail.com>
6 years agobpo-34544: pymain_read_conf() don't change LC_ALL (GH-9045)
Victor Stinner [Mon, 3 Sep 2018 15:32:31 +0000 (17:32 +0200)]
bpo-34544: pymain_read_conf() don't change LC_ALL (GH-9045)

bpo-34485, bpo-34544: Again, pymain_read_conf() leaves LC_ALL locale
unchanged: only modify LC_CTYPE.

6 years agobpo-34567: pythoninfo gets coreconfig (GH-9043)
Victor Stinner [Mon, 3 Sep 2018 15:06:39 +0000 (17:06 +0200)]
bpo-34567: pythoninfo gets coreconfig (GH-9043)

* Add _testcapi.get_coreconfig() to get the _PyCoreConfig of the
  interpreter
* test.pythoninfo now gets the core configuration using
  _testcapi.get_coreconfig()

6 years ago_Py_CoerceLegacyLocale() restores LC_CTYPE on fail (GH-9044)
Victor Stinner [Mon, 3 Sep 2018 15:05:18 +0000 (17:05 +0200)]
_Py_CoerceLegacyLocale() restores LC_CTYPE on fail (GH-9044)

bpo-34544: If _Py_CoerceLegacyLocale() fails to coerce the C locale,
restore the LC_CTYPE locale to the its previous value.

6 years agobpo-34544: Fix setlocale() in pymain_read_conf() (GH-9041)
Victor Stinner [Mon, 3 Sep 2018 12:38:21 +0000 (14:38 +0200)]
bpo-34544: Fix setlocale() in pymain_read_conf() (GH-9041)

bpo-34485, bpo-34544: On some FreeBSD, nl_langinfo(CODESET) fails if
LC_ALL or LC_CTYPE is set to an invalid locale name. Replace
_Py_SetLocaleFromEnv(LC_CTYPE) with _Py_SetLocaleFromEnv(LC_ALL) to
initialize properly locales.

Partially revert commit 177d921c8c03d30daa32994362023f777624b10d.

6 years agoMinor improvement to code clarity (GH-9036)
Raymond Hettinger [Sun, 2 Sep 2018 20:34:21 +0000 (13:34 -0700)]
Minor improvement to code clarity (GH-9036)

Make it clear that the n==0 case is included. Otherwise, you have to know that max==0.0 whenever n==0.

6 years agoFix struct sequence glossary entry grammar (GH-9030)
Zachary Ware [Sun, 2 Sep 2018 01:59:27 +0000 (20:59 -0500)]
Fix struct sequence glossary entry grammar (GH-9030)

... by removing a superfluous "either".

Reported by Никита Люшненко on docs@.

6 years agocloses bpo-34555: Fix incorrectly nested test for HAVE_LINUX_VM_SOCKETS_H (GH-9016)
Thomas Herzog [Sat, 1 Sep 2018 22:13:57 +0000 (00:13 +0200)]
closes bpo-34555: Fix incorrectly nested test for HAVE_LINUX_VM_SOCKETS_H (GH-9016)

6 years agoFix typo in typing.py module docstring (#9014)
Tim McNamara [Sat, 1 Sep 2018 08:56:58 +0000 (20:56 +1200)]
Fix typo in typing.py module docstring (#9014)

"explicitelly" → "explicitly"

6 years agobpo-34558: Add missing parentheses in _aix.py (GH-9017)
Michael Felt [Sat, 1 Sep 2018 02:31:07 +0000 (04:31 +0200)]
bpo-34558: Add missing parentheses in _aix.py (GH-9017)

p.wait()

6 years agobpo-34007: Skip traceback tests if the Program Counter is not available. (GH-9018)
Pablo Galindo [Fri, 31 Aug 2018 22:04:47 +0000 (23:04 +0100)]
bpo-34007: Skip traceback tests if the Program Counter is not available. (GH-9018)

Sometimes some versions of the shared libraries that are part of the
traceback are compiled in optimised mode and the Program Counter (PC)
is not present, not allowing gdb to walk the frames back. When this
happens, the Python bindings of gdb raise an exception, making the
test impossible to succeed.

6 years agobpo-34408: Prevent a null pointer dereference and resource leakage in `PyInterpreterS...
Pablo Galindo [Fri, 31 Aug 2018 21:49:29 +0000 (22:49 +0100)]
bpo-34408: Prevent a null pointer dereference and resource leakage in `PyInterpreterState_New()` (GH-8767)

* A pointer in `PyInterpreterState_New()` could have been `NULL` when being dereferenced.

* Memory was leaked in `PyInterpreterState_New()` when taking some error-handling code path.

6 years agoSimplify vector_norm() by eliminating special cases in the main loop (GH-9006)
Raymond Hettinger [Fri, 31 Aug 2018 18:22:13 +0000 (11:22 -0700)]
Simplify vector_norm() by eliminating special cases in the main loop (GH-9006)

The *max* value is no longer treated as a special case in the main loop.  Besides making the main loop simpler and branchless, this also lets us relax the input restriction of *vec* to contain only non-negative values.

6 years agobpo-34062: Add missing launcher argument and make behavior consistent between short...
Brendan Gerrity [Fri, 31 Aug 2018 15:15:42 +0000 (08:15 -0700)]
bpo-34062: Add missing launcher argument and make behavior consistent between short and long arguments (GH-8827)

Added previously missing "--list" argument.
Made "--list" and "--list-paths" behavior consistent with the corresponding "-0" and "-0p" arguments.

6 years agoAdd VSTS status badge to readme (GH-8958)
Steve Dower [Fri, 31 Aug 2018 15:11:35 +0000 (08:11 -0700)]
Add VSTS status badge to readme (GH-8958)

6 years agobpo-34097: Polish API design (GH-8725)
Marcel Plch [Fri, 31 Aug 2018 14:43:31 +0000 (16:43 +0200)]
bpo-34097: Polish API design (GH-8725)

Move strict_timestamps to constructor.

6 years agobpo-34427: Fix infinite loop when calling MutableSequence.extend() on self (GH-8813)
Naris R [Thu, 30 Aug 2018 16:56:14 +0000 (02:56 +1000)]
bpo-34427: Fix infinite loop when calling MutableSequence.extend() on self (GH-8813)

6 years agobpo-34542: Update test certs and keys (GH-8997)
Christian Heimes [Thu, 30 Aug 2018 05:25:49 +0000 (07:25 +0200)]
bpo-34542: Update test certs and keys (GH-8997)

Update all test certs and keys to use future proof crypto settings:

* 3072 bit RSA keys
* SHA-256 signature

Signed-off-by: Christian Heimes <christian@python.org>
6 years agoFix TestPosixSpawn.test_close_file() (GH-8992)
Victor Stinner [Wed, 29 Aug 2018 23:21:11 +0000 (01:21 +0200)]
Fix TestPosixSpawn.test_close_file() (GH-8992)

Modify TestPosixSpawn to run Python using -I and -S options.

Disable site module to avoid side effects. For example, on Fedora 28,
if the HOME environment variable is not set, site._getuserbase()
calls pwd.getpwuid() which opens /var/lib/sss/mc/passwd, but then
leaves the file open which makes test_close_file() to fail.

6 years agobpo-34523: Use _PyCoreConfig instead of globals (GH-9005)
Victor Stinner [Wed, 29 Aug 2018 22:50:45 +0000 (00:50 +0200)]
bpo-34523: Use _PyCoreConfig instead of globals (GH-9005)

Use the core configuration of the interpreter, rather
than using global configuration variables. For example, replace
Py_QuietFlag with core_config->quiet.

6 years agobpo-34523: Py_FileSystemDefaultEncoding NULL by default (GH-9003)
Victor Stinner [Wed, 29 Aug 2018 21:26:55 +0000 (23:26 +0200)]
bpo-34523: Py_FileSystemDefaultEncoding NULL by default (GH-9003)

* Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors
  default value is now NULL: initfsencoding() set them
  during Python initialization.
* Document how Python chooses the filesystem encoding and error
  handler.
* Add an assertion to _PyCoreConfig_Read().

6 years agobpo-34485: Emit C locale coercion warning later (GH-9002)
Victor Stinner [Wed, 29 Aug 2018 20:56:06 +0000 (22:56 +0200)]
bpo-34485: Emit C locale coercion warning later (GH-9002)

PYTHONCOERCELOCALE=warn warning is now emitted later and written into
sys.stderr, rather than being written into the C stderr stream.

6 years agobpo-34523: Support surrogatepass in locale codecs (GH-8995)
Victor Stinner [Wed, 29 Aug 2018 20:21:32 +0000 (22:21 +0200)]
bpo-34523: Support surrogatepass in locale codecs (GH-8995)

Add support for the "surrogatepass" error handler in
PyUnicode_DecodeFSDefault() and PyUnicode_EncodeFSDefault()
for the UTF-8 encoding.

Changes:

* _Py_DecodeUTF8Ex() and _Py_EncodeUTF8Ex() now support the
  surrogatepass error handler (_Py_ERROR_SURROGATEPASS).
* _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() now use
  the _Py_error_handler enum instead of "int surrogateescape" to pass
  the error handler. These functions now return -3 if the error
  handler is unknown.
* Add unit tests on _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx()
  in test_codecs.
* Rename get_error_handler() to _Py_GetErrorHandler() and expose it
  as a private function.
* _freeze_importlib doesn't need config.filesystem_errors="strict"
  workaround anymore.

6 years agobpo-34523: Py_DecodeLocale() use UTF-8 on Windows (GH-8998)
Victor Stinner [Wed, 29 Aug 2018 17:32:47 +0000 (19:32 +0200)]
bpo-34523: Py_DecodeLocale() use UTF-8 on Windows (GH-8998)

Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding on
Windows if Py_LegacyWindowsFSEncodingFlag is zero.

pymain_read_conf() now sets Py_LegacyWindowsFSEncodingFlag in its
loop, but restore its value at exit.

6 years agobpo-34523: Fix config_init_fs_encoding() (GH-8991)
Victor Stinner [Wed, 29 Aug 2018 11:45:34 +0000 (13:45 +0200)]
bpo-34523: Fix config_init_fs_encoding() (GH-8991)

Call config_init_fs_encoding() if filesystem_errors is not NULL but
filesystem_encoding is NULL.

6 years agobpo-34523: Add _PyCoreConfig.filesystem_encoding (GH-8963)
Victor Stinner [Wed, 29 Aug 2018 11:25:36 +0000 (13:25 +0200)]
bpo-34523: Add _PyCoreConfig.filesystem_encoding (GH-8963)

_PyCoreConfig_Read() is now responsible to choose the filesystem
encoding and error handler. Using Py_Main(), the encoding is now
chosen even before calling Py_Initialize().

_PyCoreConfig.filesystem_encoding is now the reference, instead of
Py_FileSystemDefaultEncoding, for the Python filesystem encoding.

Changes:

* Add filesystem_encoding and filesystem_errors to _PyCoreConfig
* _PyCoreConfig_Read() now reads the locale encoding for the file
  system encoding.
* PyUnicode_EncodeFSDefault() and PyUnicode_DecodeFSDefaultAndSize()
  now use the interpreter configuration rather than
  Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors
  global configuration variables.
* Add _Py_SetFileSystemEncoding() and _Py_ClearFileSystemEncoding()
  private functions to only modify Py_FileSystemDefaultEncoding and
  Py_FileSystemDefaultEncodeErrors in coreconfig.c.
* _Py_CoerceLegacyLocale() now takes an int rather than
  _PyCoreConfig for the warning.

6 years agobpo-34485: Add _PyCoreConfig.stdio_encoding (GH-8881)
Victor Stinner [Wed, 29 Aug 2018 09:47:29 +0000 (11:47 +0200)]
bpo-34485: Add _PyCoreConfig.stdio_encoding (GH-8881)

* Add stdio_encoding and stdio_errors fields to _PyCoreConfig.
* Add unit tests on stdio_encoding and stdio_errors.

6 years agobpo-34485, Windows: LC_CTYPE set to user preference (GH-8988)
Victor Stinner [Wed, 29 Aug 2018 09:25:15 +0000 (11:25 +0200)]
bpo-34485, Windows: LC_CTYPE set to user preference (GH-8988)

On Windows, the LC_CTYPE is now set to the user preferred locale at
startup: _Py_SetLocaleFromEnv(LC_CTYPE) is now called during the
Python initialization. Previously, the LC_CTYPE locale was "C" at
startup, but changed when calling setlocale(LC_CTYPE, "") or
setlocale(LC_ALL, "").

pymain_read_conf() now also calls _Py_SetLocaleFromEnv(LC_CTYPE) to
behave as _Py_InitializeCore(). Moreover, it doesn't save/restore the
LC_ALL anymore.

On Windows, standard streams like sys.stdout now always use
surrogateescape error handler by default (ignore the locale).

6 years agobpo-34485: stdout uses surrogateescape on POSIX locale (GH-8986)
Victor Stinner [Wed, 29 Aug 2018 07:58:12 +0000 (09:58 +0200)]
bpo-34485: stdout uses surrogateescape on POSIX locale (GH-8986)

Standard streams like sys.stdout now use the "surrogateescape" error
handler, instead of "strict", on the POSIX locale (when the C locale is not
coerced and the UTF-8 Mode is disabled).

Add tests on sys.stdout.errors with LC_ALL=POSIX.

6 years agoImprove commutativity of math.hypot() and math.dist() (GH-8984)
Raymond Hettinger [Wed, 29 Aug 2018 05:47:24 +0000 (22:47 -0700)]
Improve commutativity of math.hypot() and math.dist() (GH-8984)

6 years agobpo-34485: Add _Py_ClearStandardStreamEncoding() (GH-8982)
Victor Stinner [Tue, 28 Aug 2018 23:29:06 +0000 (01:29 +0200)]
bpo-34485: Add _Py_ClearStandardStreamEncoding() (GH-8982)

* Move Py_SetStandardStreamEncoding() from pylifecycle.c
  to coreconfig.c
* Add _Py_ClearStandardStreamEncoding() private function.
* pymain_free() now calls _Py_ClearStandardStreamEncoding().
* Add assertions add the end of _PyCoreConfig_Read()
* _PyCoreConfig_Copy(): rename COPY_STR_ATTR() macro
  to COPY_WSTR_ATTR().
* Fix get_stdio_errors() indentation.

6 years agobpo-34485: Fix _Py_InitializeCore() for C locale coercion (GH-8979)
Victor Stinner [Tue, 28 Aug 2018 22:16:53 +0000 (00:16 +0200)]
bpo-34485: Fix _Py_InitializeCore() for C locale coercion (GH-8979)

* _Py_InitializeCore() now sets the LC_CTYPE locale to the user
  preferred locale before checking if the C locale should be coerced
  or not in _PyCoreConfig_Read().
* Fix pymain_read_conf(): remember if the C locale has been coerced
  when the configuration should be read again if the encoding has
  changed.

6 years agobpo-34485: Enhance init_sys_streams() (GH-8978)
Victor Stinner [Tue, 28 Aug 2018 21:26:33 +0000 (23:26 +0200)]
bpo-34485: Enhance init_sys_streams() (GH-8978)

Python now gets the locale encoding with C code to initialize the encoding
of standard streams like sys.stdout. Moreover, the encoding is now
initialized to the Python codec name to get a normalized encoding name and
to ensure that the codec is loaded. The change avoids importing
_bootlocale and _locale modules at startup by default.

When the PYTHONIOENCODING environment variable only contains an encoding,
the error handler is now is now set explicitly to "strict".

Rename also get_default_standard_stream_error_handler() to
get_stdio_errors().

Reduce the buffer to format the "cpXXX" string (Windows locale encoding).

6 years agobpo-34403: On HP-UX, force ASCII for C locale (GH-8969)
Victor Stinner [Tue, 28 Aug 2018 15:27:36 +0000 (17:27 +0200)]
bpo-34403: On HP-UX, force ASCII for C locale (GH-8969)

On HP-UX with C or POSIX locale, sys.getfilesystemencoding() now returns
"ascii" instead of "roman8" (when the UTF-8 Mode is disabled and the C locale
is not coerced).

nl_langinfo(CODESET) announces "roman8" whereas it uses the Latin1
encoding in practice.

6 years agobpo-34527: POSIX locale enables the UTF-8 Mode (GH-8972)
Victor Stinner [Tue, 28 Aug 2018 10:35:44 +0000 (12:35 +0200)]
bpo-34527: POSIX locale enables the UTF-8 Mode (GH-8972)

* The UTF-8 Mode is now also enabled by the "POSIX" locale, not only
  by the "C" locale.
* On FreeBSD, Py_DecodeLocale() and Py_EncodeLocale() now also forces
  the ASCII encoding if the LC_CTYPE locale is "POSIX", not only if
  the LC_CTYPE locale is "C".
* test_utf8_mode.test_cmd_line() checks also that the command line
  arguments are decoded from UTF-8 when the the UTF-8 Mode is enabled
  with POSIX locale or C locale.

6 years agobpo-21145: Add cached_property decorator in functools (#6982)
Carl Meyer [Tue, 28 Aug 2018 07:11:56 +0000 (01:11 -0600)]
bpo-21145: Add cached_property decorator in functools (#6982)

Robust caching of calculated properties is
harder than it looks at first glance, so add
a solid, well-tested implementation to the
standard library.

6 years agobpo-33635: Handling Bad file descriptor in Path.is_file and related. (GH-8542)
Przemysław Spodymek [Mon, 27 Aug 2018 21:33:45 +0000 (23:33 +0200)]
bpo-33635: Handling Bad file descriptor in Path.is_file and related. (GH-8542)

6 years agobpo-34347: Fix test_utf8_mode.test_cmd_line for AIX (GH-8923)
Michael Felt [Mon, 27 Aug 2018 13:40:17 +0000 (15:40 +0200)]
bpo-34347: Fix test_utf8_mode.test_cmd_line for AIX (GH-8923)

AIX uses ISO-8859-1 encoding for the C locale.

6 years agobpo-34434: Update doc for bool(), float() and int() arguments (GH-8834)
Louis Sautier [Mon, 27 Aug 2018 10:45:26 +0000 (12:45 +0200)]
bpo-34434: Update doc for bool(), float() and int() arguments (GH-8834)

6 years agobpo-26544: Get rid of dependence from distutils in platform. (GH-8356)
Serhiy Storchaka [Mon, 27 Aug 2018 10:29:51 +0000 (13:29 +0300)]
bpo-26544: Get rid of dependence from distutils in platform. (GH-8356)