]> granicus.if.org Git - python/log
python
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)

6 years agobpo-34171: Fix test_trace. (GH-8940)
Serhiy Storchaka [Mon, 27 Aug 2018 10:10:36 +0000 (13:10 +0300)]
bpo-34171: Fix test_trace. (GH-8940)

Remove "trace.cover" left from previous test runs before testing
that it is no longer created.

6 years agobpo-32968: Make modulo and floor division involving Fraction and float consistent...
Elias Zamaria [Mon, 27 Aug 2018 06:59:28 +0000 (23:59 -0700)]
bpo-32968: Make modulo and floor division involving Fraction and float consistent with other operations (#5956)

Make mixed-type `%` and `//` operations involving `Fraction` and `float` objects behave like all other mixed-type arithmetic operations: first the `Fraction` object is converted to a `float`, then the `float` operation is performed as normal. This fixes some surprising corner cases, like `Fraction('1/3') % inf` giving a NaN.

Thanks Elias Zamaria for the patch.

6 years agoFast path for exact floats in math.hypot() and math.dist() (GH-8949)
Raymond Hettinger [Mon, 27 Aug 2018 00:38:31 +0000 (19:38 -0500)]
Fast path for exact floats in math.hypot() and math.dist() (GH-8949)

6 years agoRemove AIX workaround test_subprocess (GH-8939)
Michael Felt [Sun, 26 Aug 2018 17:29:36 +0000 (19:29 +0200)]
Remove AIX workaround test_subprocess (GH-8939)

An old apparent AIX behavior workaround in test_subprocess's
test_undecodable_env is no longer needed.

6 years agobpo-34503: Fix refleak in PyErr_SetObject() (GH-8934)
Alexey Izbyshev [Sun, 26 Aug 2018 16:31:25 +0000 (19:31 +0300)]
bpo-34503: Fix refleak in PyErr_SetObject() (GH-8934)

6 years agocloses bpo-34504: Remove the useless NULL check in PySequence_Check(). (GH-8935)
Alexey Izbyshev [Sat, 25 Aug 2018 23:52:27 +0000 (02:52 +0300)]
closes bpo-34504: Remove the useless NULL check in PySequence_Check(). (GH-8935)

Reported by Svace static analyzer.

6 years agocloses bpo-34501: PyType_FromSpecWithBases: Check spec->name before dereferencing...
Alexey Izbyshev [Sat, 25 Aug 2018 18:53:47 +0000 (21:53 +0300)]
closes bpo-34501: PyType_FromSpecWithBases: Check spec->name before dereferencing it. (GH-8930)

Reported by Svace static analyzer.

6 years agocloses bpo-34502: Remove a note about utf8_mode from sys.exit() docs. (GH-8928)
Alexey Izbyshev [Sat, 25 Aug 2018 18:23:00 +0000 (21:23 +0300)]
closes bpo-34502: Remove a note about utf8_mode from sys.exit() docs. (GH-8928)

6 years agoRemove unneeded PyErr_Clear() in _winapi_SetNamedPipeHandleState_impl() (GH-8281)
Zackery Spytz [Sat, 25 Aug 2018 17:10:14 +0000 (11:10 -0600)]
Remove unneeded PyErr_Clear() in _winapi_SetNamedPipeHandleState_impl() (GH-8281)

6 years agoFix markup in stdtypes documentation (GH-8905)
Andrés Delfino [Sat, 25 Aug 2018 14:08:20 +0000 (11:08 -0300)]
Fix markup in stdtypes documentation (GH-8905)

6 years agobpo-34395: Don't free allocated memory on realloc fail in load_mark() in _pickle...
Sergey Fedoseev [Sat, 25 Aug 2018 10:41:58 +0000 (15:41 +0500)]
bpo-34395: Don't free allocated memory on realloc fail in load_mark() in _pickle.c. (GH-8788)

6 years agoFix upsizing of marks stack in pickle module. (GH-8860)
Sergey Fedoseev [Sat, 25 Aug 2018 07:54:40 +0000 (12:54 +0500)]
Fix upsizing of marks stack in pickle module. (GH-8860)

Previously marks stack was upsized even there was space for additional item.

6 years agobpo-34171: Prevent creating Lib/trace.cover when run the trace module. (GH-8841)
Serhiy Storchaka [Sat, 25 Aug 2018 07:27:55 +0000 (10:27 +0300)]
bpo-34171: Prevent creating Lib/trace.cover when run the trace module. (GH-8841)

6 years agocloses bpo-34493: Objects/genobject.c: Add missing NULL check to compute_cr_origin...
Alexey Izbyshev [Sat, 25 Aug 2018 07:15:23 +0000 (10:15 +0300)]
closes bpo-34493: Objects/genobject.c: Add missing NULL check to compute_cr_origin() (GH-8911)

6 years agoFixed typo with asynccontextmanager code example (GH-8845)
Alexander Vasin [Sat, 25 Aug 2018 02:38:11 +0000 (05:38 +0300)]
Fixed typo with asynccontextmanager code example (GH-8845)

`yield conn`, instead of just `yield`.

6 years agobpo-34426: fix typo (__lltrace__ -> __ltrace__) (GH-8822)
Danish Prakash [Sat, 25 Aug 2018 02:00:25 +0000 (07:30 +0530)]
bpo-34426: fix typo (__lltrace__ -> __ltrace__) (GH-8822)

6 years agobpo-13312: Avoid int underflow in time year. (GH-8912)
Gregory P. Smith [Sat, 25 Aug 2018 01:08:50 +0000 (18:08 -0700)]
bpo-13312: Avoid int underflow in time year. (GH-8912)

Avoids an integer underflow in the time module's year handling code.

6 years agobpo-34492: Python/coreconfig.c: Fix _Py_wstrlist_copy() (GH-8910)
Alexey Izbyshev [Fri, 24 Aug 2018 23:34:56 +0000 (02:34 +0300)]
bpo-34492: Python/coreconfig.c: Fix _Py_wstrlist_copy() (GH-8910)

bpo-34492: Python/coreconfig.c: Add missing NULL check to _Py_wstrlist_copy().

Fix _Py_wstrlist_clear() call on a wrong list.

Reported by Svace static analyzer.

6 years agobpo-34448: Improve output of usable wchar_t check (GH-8846)
Michael Osipov [Fri, 24 Aug 2018 16:17:19 +0000 (18:17 +0200)]
bpo-34448: Improve output of usable wchar_t check (GH-8846)

6 years agocloses bpo-34471: _datetime: Add missing NULL check to tzinfo_from_isoformat_results...
Alexey Izbyshev [Fri, 24 Aug 2018 15:53:16 +0000 (18:53 +0300)]
closes bpo-34471: _datetime: Add missing NULL check to tzinfo_from_isoformat_results. (GH-8869)

Reported by Svace static analyzer.

6 years agobpo-6700: Fix inspect.getsourcelines for module level frames/tracebacks (GH-8864)
Vladimir Matveev [Fri, 24 Aug 2018 14:18:00 +0000 (07:18 -0700)]
bpo-6700: Fix inspect.getsourcelines for module level frames/tracebacks (GH-8864)

6 years agoFix typo in the dataclasses's doc (GH-8896)
Daniel Dương [Fri, 24 Aug 2018 09:19:24 +0000 (16:19 +0700)]
Fix typo in the dataclasses's doc (GH-8896)

6 years agocloses bpo-34468: Objects/rangeobject.c: Fix an always-false condition in range_repr...
Alexey Izbyshev [Fri, 24 Aug 2018 04:39:45 +0000 (07:39 +0300)]
closes bpo-34468: Objects/rangeobject.c: Fix an always-false condition in range_repr() (GH-8880)

Also, propagate the error from PyNumber_AsSsize_t() because we don't care
only about OverflowError which is not reported if the second argument is NULL.

Reported by Svace static analyzer.

6 years agocloses bpo-34474: Python/bltinmodule.c: Add missing NULL check in builtin_sum_impl...
Alexey Izbyshev [Fri, 24 Aug 2018 04:27:52 +0000 (07:27 +0300)]
closes bpo-34474: Python/bltinmodule.c: Add missing NULL check in builtin_sum_impl() (GH-8872)

Reported by Svace static analyzer.

6 years agocloses bpo-34477: Objects/typeobject.c: Add missing NULL check to type_init() (GH...
Alexey Izbyshev [Fri, 24 Aug 2018 04:22:16 +0000 (07:22 +0300)]
closes bpo-34477: Objects/typeobject.c: Add missing NULL check to type_init() (GH-8876)

Reported by Svace static analyzer.

6 years agoFix doc for `add_subparsers` arguments (GH-8884)
Anthony Sottile [Fri, 24 Aug 2018 03:08:54 +0000 (20:08 -0700)]
Fix doc for `add_subparsers` arguments (GH-8884)

There was a missing comma.

6 years agoFix typo in asyncio.BoundedSemaphore docs (GH-8882)
Jelle Zijlstra [Fri, 24 Aug 2018 01:50:00 +0000 (18:50 -0700)]
Fix typo in asyncio.BoundedSemaphore docs (GH-8882)

semapthores -> semaphores

6 years agobpo-34454: fix .fromisoformat() methods crashing on inputs with surrogate code points...
Paul Ganssle [Thu, 23 Aug 2018 15:06:20 +0000 (11:06 -0400)]
bpo-34454: fix .fromisoformat() methods crashing on inputs with surrogate code points (GH-8862)

The current C implementations **crash** if the input includes a surrogate
Unicode code point, which is not possible to encode in UTF-8.

Important notes:

1.  It is possible to pass a non-UTF-8 string as a separator to the
    `.isoformat()` methods.
2.  The pure-Python `datetime.fromisoformat()` implementation accepts
    strings with a surrogate as the separator.

In `datetime.fromisoformat()`, in the special case of non-UTF-8 separators,
this implementation will take a performance hit by making a copy of the
input string and replacing the separator with 'T'.

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
Co-authored-by: Paul Ganssle <paul@ganssle.io>
6 years agoMake it more clear that setUpClass runs before each class, not "class run" (GH-8844)
Ville Skyttä [Thu, 23 Aug 2018 14:49:18 +0000 (17:49 +0300)]
Make it more clear that setUpClass runs before each class, not "class run" (GH-8844)

6 years agobpo-34412: Make signal.strsignal() work on HP-UX (GH-8786)
Michael Osipov [Thu, 23 Aug 2018 13:27:19 +0000 (15:27 +0200)]
bpo-34412: Make signal.strsignal() work on HP-UX (GH-8786)

Introduce a configure check for strsignal(3) which defines HAVE_STRSIGNAL for
signalmodule.c. Add some common signals on HP-UX. This change applies for
Windows and HP-UX.

6 years agobpo-34207: Fix pymain_read_conf() for UTF-8 Mode (GH-8868)
Victor Stinner [Thu, 23 Aug 2018 10:23:46 +0000 (12:23 +0200)]
bpo-34207: Fix pymain_read_conf() for UTF-8 Mode (GH-8868)

bpo-34170, bpo-34207: pymain_read_conf() now sets Py_UTF8Mode to
config->utf8_mode. pymain_read_conf() calls indirectly
Py_DecodeLocale() and Py_EncodeLocale() which depend on Py_UTF8Mode.

6 years agobpo-34436: Fix check that disables overallocation for the last fmt specifier (GH...
Alexey Izbyshev [Thu, 23 Aug 2018 07:50:52 +0000 (10:50 +0300)]
bpo-34436: Fix check that disables overallocation for the last fmt specifier (GH-8826)

Reported by Svace static analyzer.

6 years agoRemove superseded line from argparse.HelpFormatter() (GH-8839)
Grant Jenks [Wed, 22 Aug 2018 20:14:14 +0000 (13:14 -0700)]
Remove superseded line from argparse.HelpFormatter() (GH-8839)

6 years agobpo-34462: Add missing NULL check to _copy_raw_string() (GH-8863)
Alexey Izbyshev [Wed, 22 Aug 2018 18:27:32 +0000 (21:27 +0300)]
bpo-34462: Add missing NULL check to _copy_raw_string() (GH-8863)

Reported by Svace static analyzer.

6 years agobpo-2122: Make mmap.flush() behave same on all platforms (GH-8692)
Berker Peksag [Wed, 22 Aug 2018 18:21:05 +0000 (21:21 +0300)]
bpo-2122: Make mmap.flush() behave same on all platforms (GH-8692)

Previously, its behavior was platform-dependent and there was no error checking
under Windows.

6 years agobpo-34457: Python/ast.c: Add missing NULL check to alias_for_import_name(). (GH-8852)
Alexey Izbyshev [Wed, 22 Aug 2018 04:55:16 +0000 (07:55 +0300)]
bpo-34457: Python/ast.c: Add missing NULL check to alias_for_import_name(). (GH-8852)

Reported by Svace static analyzer.

6 years agobpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)
Alexey Izbyshev [Wed, 22 Aug 2018 04:51:25 +0000 (07:51 +0300)]
bpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)

Reported by Svace static analyzer.

6 years agoFix Doc/whatsnew/3.8.rst (GH-8848)
Berker Peksag [Tue, 21 Aug 2018 14:58:49 +0000 (17:58 +0300)]
Fix Doc/whatsnew/3.8.rst (GH-8848)

The entry about deprecation of __getitem__ methods of
several classes was placed in the wrong section.

6 years agobpo-34400: Fix more undefined behavior in parsetok.c (GH-8833)
Zackery Spytz [Tue, 21 Aug 2018 03:11:40 +0000 (21:11 -0600)]
bpo-34400: Fix more undefined behavior in parsetok.c (GH-8833)

6 years agobpo-34441: Fix ABC.__subclasscheck__ crash on classes with invalid __subclasses__...
Alexey Izbyshev [Mon, 20 Aug 2018 20:04:19 +0000 (23:04 +0300)]
bpo-34441: Fix ABC.__subclasscheck__ crash on classes with invalid __subclasses__ (GH-8835)

The missing NULL check was reported by Svace static analyzer.

6 years agobpo-30411: Use --git-dir instead of -C to make git work under version below 1.8.5...
Xiang Zhang [Mon, 20 Aug 2018 14:36:19 +0000 (22:36 +0800)]
bpo-30411: Use --git-dir instead of -C to make git work under version below 1.8.5. (GH-8744)

6 years agobpo-34435: Add missing NULL check to unicode_encode_ucs1(). (GH-8823)
Alexey Izbyshev [Sun, 19 Aug 2018 18:52:04 +0000 (21:52 +0300)]
bpo-34435: Add missing NULL check to unicode_encode_ucs1(). (GH-8823)

Reported by Svace static analyzer.

6 years agobpo-22057: Clarify eval() documentation (GH-8812)
Berker Peksag [Sun, 19 Aug 2018 10:25:33 +0000 (13:25 +0300)]
bpo-22057: Clarify eval() documentation (GH-8812)

If a globals dictionary without a '__builtins__' key is passed to
eval(), a '__builtins__' key will be inserted to the dictionary:

    >>> eval("print('__builtins__' in globals())", {})
    True

(As a result of this behavior, we can use the builtins
print() and globals() even if we passed a dictionary without a
'__builtins__' key to eval().)

6 years agobpo-34318: Convert deprecation warnings to errors in assertRaises() etc. (GH-8623)
Serhiy Storchaka [Sun, 19 Aug 2018 07:00:11 +0000 (10:00 +0300)]
bpo-34318: Convert deprecation warnings to errors in assertRaises() etc. (GH-8623)

6 years agobpo-22602: Raise an exception in the UTF-7 decoder for ill-formed sequences starting...
Zackery Spytz [Sun, 19 Aug 2018 04:43:38 +0000 (22:43 -0600)]
bpo-22602: Raise an exception in the UTF-7 decoder for ill-formed sequences starting with "+". (GH-8741)

The UTF-7 decoder now raises UnicodeDecodeError for ill-formed
sequences starting with "+" (as specified in RFC 2152).

6 years agobpo-34415: Updated logging.Formatter docstring. (GH-8811)
Vinay Sajip [Sun, 19 Aug 2018 04:14:19 +0000 (05:14 +0100)]
bpo-34415: Updated logging.Formatter docstring. (GH-8811)

6 years agobpo-34432: doc Mention complex and decimal.Decimal on str.format not about locales...
Andrés Delfino [Sat, 18 Aug 2018 17:36:24 +0000 (14:36 -0300)]
bpo-34432: doc Mention complex and decimal.Decimal on str.format not about locales (GH-8808)

6 years agobpo-34381: refer to 'Running & Writing Tests' in README.rst (GH-8797)
Michael Osipov [Fri, 17 Aug 2018 21:43:34 +0000 (23:43 +0200)]
bpo-34381: refer to 'Running & Writing Tests' in README.rst (GH-8797)

6 years agoImprove error message when mock.assert_has_calls fails (GH-8205)
davidair [Fri, 17 Aug 2018 19:09:58 +0000 (15:09 -0400)]
Improve error message when mock.assert_has_calls fails (GH-8205)

This makes the assertion error message more useful, aiding debugging.

Thanks @davidair!

6 years agoWarn not to set SIGPIPE to SIG_DFL (#6773)
Alfred Perlstein [Fri, 17 Aug 2018 13:48:05 +0000 (09:48 -0400)]
Warn not to set SIGPIPE to SIG_DFL (#6773)

6 years agobpo-34419: selectmodule.c does not compile on HP-UX due to bpo-31938 (GH-8796)
Michael Osipov [Fri, 17 Aug 2018 11:43:02 +0000 (13:43 +0200)]
bpo-34419: selectmodule.c does not compile on HP-UX due to bpo-31938 (GH-8796)

Fix compile errors reported by HP aCC by fixing bugs introduced in 6dc57e2a20c
which do not cause trouble on clang or GCC.

Patch by Michael Osipov.

6 years agobpo-34418: Fix HTTPErrorProcessor documentation (GH-8793)
Sebastian Rittau [Fri, 17 Aug 2018 09:47:32 +0000 (11:47 +0200)]
bpo-34418: Fix HTTPErrorProcessor documentation (GH-8793)

The http_response() and https_response() methods of the HTTPErrorProcessor
class have two required parameters, 'request' and 'response'.

6 years agobpo-34391: Fix ftplib test for TLS 1.3 (GH-8787)
Christian Heimes [Thu, 16 Aug 2018 17:43:44 +0000 (19:43 +0200)]
bpo-34391: Fix ftplib test for TLS 1.3 (GH-8787)

Read from data socket to avoid "[SSL] shutdown while in init" exception
during shutdown of the dummy server.

Signed-off-by: Christian Heimes <christian@python.org>
<!-- issue-number: [bpo-34391](https://www.bugs.python.org/issue34391) -->
https://bugs.python.org/issue34391
<!-- /issue-number -->

6 years agobpo-34217: Use lowercase for windows headers (GH-8472)
Erik Janssens [Thu, 16 Aug 2018 06:40:50 +0000 (08:40 +0200)]
bpo-34217: Use lowercase for windows headers (GH-8472)

6 years agobpo-34395: Fix memory leaks caused by incautious usage of PyMem_Resize(). (GH-8756)
Sergey Fedoseev [Thu, 16 Aug 2018 04:27:50 +0000 (09:27 +0500)]
bpo-34395: Fix memory leaks caused by incautious usage of PyMem_Resize(). (GH-8756)

6 years agobpo-34405: Updated to OpenSSL 1.1.0i for Windows builds. (GH-8775)
Steve Dower [Wed, 15 Aug 2018 20:29:24 +0000 (13:29 -0700)]
bpo-34405: Updated to OpenSSL 1.1.0i for Windows builds. (GH-8775)

6 years agobpo-34384: Fix os.readlink() on Windows (GH-8740)
Berker Peksag [Wed, 15 Aug 2018 10:03:41 +0000 (13:03 +0300)]
bpo-34384: Fix os.readlink() on Windows (GH-8740)

os.readlink() now accepts path-like and bytes objects on Windows.
Previously, support for path-like and bytes objects was only
implemented on Unix.

This commit also merges Unix and Windows implementations of
os.readlink() in one function and adds basic unit tests to increase
test coverage of the function.

6 years agocloses bpo-34400: Fix undefined behavior in parsetok(). (GH-4439)
Zackery Spytz [Wed, 15 Aug 2018 06:27:26 +0000 (00:27 -0600)]
closes bpo-34400: Fix undefined behavior in parsetok(). (GH-4439)

Avoid undefined pointer arithmetic with NULL.

6 years agobpo-34399: 2048 bits RSA keys and DH params (#8762)
Christian Heimes [Tue, 14 Aug 2018 10:54:19 +0000 (12:54 +0200)]
bpo-34399: 2048 bits RSA keys and DH params (#8762)

Downstream vendors have started to deprecate weak keys. Update all RSA keys
and DH params to use at least 2048 bits.

Finite field DH param file use RFC 7919 values, generated with

    certtool --get-dh-params --sec-param=high

Signed-off-by: Christian Heimes <christian@python.org>
6 years agoMake regular expressions in test_tasks.py raw strings. (GH-8759)
Benjamin Peterson [Tue, 14 Aug 2018 04:32:30 +0000 (21:32 -0700)]
Make regular expressions in test_tasks.py raw strings. (GH-8759)

Follow up to bpo-34270.

Fixes:
```
Lib/test/test_asyncio/test_tasks.py:330: DeprecationWarning: invalid escape sequence \d
  match1 = re.match("^<Task pending name='Task-(\d+)'", repr(t1))
Lib/test/test_asyncio/test_tasks.py:332: DeprecationWarning: invalid escape sequence \d
  match2 = re.match("^<Task pending name='Task-(\d+)'", repr(t2))
```

6 years agosmtplib documentation fixes (GH-8708)
Ville Skyttä [Mon, 13 Aug 2018 03:39:19 +0000 (06:39 +0300)]
smtplib documentation fixes (GH-8708)

* SMTP.startssl: Fix doc on keyfile and certfile use

* SMTP.startssl: Add missing keyfile and certfile deprecation notice

* SMTP: Doc grammar fixes

6 years agoFix misindented yaml in logging how to example (GH-8604)
Rémy HUBSCHER [Sun, 12 Aug 2018 23:58:26 +0000 (01:58 +0200)]
Fix misindented yaml in logging how to example (GH-8604)

6 years agoMinor code clean-up. Don't alter the input vector. Use variables instead. GH-8748
Raymond Hettinger [Sun, 12 Aug 2018 21:18:56 +0000 (14:18 -0700)]
Minor code clean-up. Don't alter the input vector. Use variables instead. GH-8748

6 years agoAdd more tests and assertions for math.hypot() and math.dist() (GH-8747)
Raymond Hettinger [Sun, 12 Aug 2018 19:15:23 +0000 (12:15 -0700)]
Add more tests and assertions for math.hypot() and math.dist() (GH-8747)

6 years agobpo-34213: Allow dataclasses to work with a field named 'object'. (GH-8452)
Vadim Pushtaev [Sun, 12 Aug 2018 11:46:05 +0000 (14:46 +0300)]
bpo-34213: Allow dataclasses to work with a field named 'object'. (GH-8452)

6 years agoFix the versionadded indentation in exec_module doc (GH-8719)
Andrés Delfino [Sun, 12 Aug 2018 06:50:46 +0000 (03:50 -0300)]
Fix the versionadded indentation in exec_module doc (GH-8719)

6 years agoFactor-out common code. Also, optimize common cases by preallocating space on the...
Raymond Hettinger [Sun, 12 Aug 2018 01:39:05 +0000 (18:39 -0700)]
Factor-out common code. Also, optimize common cases by preallocating space on the stack. GH-8738

Improves speed by 9 to 10ns per call.

6 years agoReplace straight addition with Kahan summation and move max to the end (GH-8727)
Raymond Hettinger [Sat, 11 Aug 2018 18:26:36 +0000 (11:26 -0700)]
Replace straight addition with Kahan summation and move max to the end (GH-8727)

6 years agobpo-34151: Improve performance of some list operations (GH-8332)
Sergey Fedoseev [Sat, 11 Aug 2018 13:12:07 +0000 (18:12 +0500)]
bpo-34151: Improve performance of some list operations (GH-8332)

6 years agobpo-34379: Doc: Move note for json.dump (GH-8730)
Evan Allrich [Sat, 11 Aug 2018 07:34:02 +0000 (02:34 -0500)]
bpo-34379: Doc: Move note for json.dump (GH-8730)

6 years agocloses bpo-34377: Update Valgrind suppressions. (GH-8729)
Paul Price [Sat, 11 Aug 2018 06:41:34 +0000 (02:41 -0400)]
closes bpo-34377: Update Valgrind suppressions. (GH-8729)

Valgrind isn't seeing PyObject_Free/PyObject_Realloc, but using _PyObject_Free/_PyObject_Realloc works.

6 years agobpo-26818: Add a test to make sure the bug is fixed (GH-8664)
Berker Peksag [Sat, 11 Aug 2018 06:15:43 +0000 (09:15 +0300)]
bpo-26818: Add a test to make sure the bug is fixed (GH-8664)

The main cause of this bug was fixed as part of bpo-31908.

6 years agobpo-9372: Deprecate several __getitem__ methods (GH-8609)
Berker Peksag [Sat, 11 Aug 2018 06:05:04 +0000 (09:05 +0300)]
bpo-9372: Deprecate several __getitem__ methods (GH-8609)

The __getitem__ methods of DOMEventStream, FileInput,
and FileWrapper classes ignore their 'index' parameters
and return the next item instead.

6 years agobpo-34333: Fix %-formatting in Path.with_suffix() (GH-8663)
Berker Peksag [Sat, 11 Aug 2018 05:45:06 +0000 (08:45 +0300)]
bpo-34333: Fix %-formatting in Path.with_suffix() (GH-8663)

6 years agobpo-34047: IDLE: fix mousewheel scrolling direction on macOS (GH-8678)
Tal Einat [Fri, 10 Aug 2018 06:02:08 +0000 (09:02 +0300)]
bpo-34047: IDLE: fix mousewheel scrolling direction on macOS (GH-8678)

6 years agocloses bpo-34353: Add sockets to stat.filemode fallback python implementation. (GH...
GPery [Fri, 10 Aug 2018 05:12:08 +0000 (08:12 +0300)]
closes bpo-34353: Add sockets to stat.filemode fallback python implementation. (GH-8703)

6 years agoFixed inconsistency in string handling in the Task C implementation (GH-8717)
Alex Grönholm [Thu, 9 Aug 2018 20:49:49 +0000 (23:49 +0300)]
Fixed inconsistency in string handling in the Task C implementation (GH-8717)

6 years agoDoc: add missing capture_output arg to subprocess.run() signature (#8374)
Andriy Maletsky [Thu, 9 Aug 2018 20:01:54 +0000 (23:01 +0300)]
Doc: add missing capture_output arg to subprocess.run() signature (#8374)

6 years agoImprove grammar of asynchronous iterator glossary entry (GH-8657)
Andrés Delfino [Thu, 9 Aug 2018 15:45:41 +0000 (12:45 -0300)]
Improve grammar of asynchronous iterator glossary entry (GH-8657)

6 years agobpo-34324: Doc README wrong directory name for venv (GH-8650)
Stéphane Wirtel [Thu, 9 Aug 2018 15:05:31 +0000 (17:05 +0200)]
bpo-34324: Doc README wrong directory name for venv (GH-8650)

In the documentation, the `env` directory is specified when we execute
the `make venv` command. But in the code, `make venv` will create the
virtualenv inside the `venv` directory (defined by `VENVDIR`)

6 years agobpo-34270: Make it possible to name asyncio tasks (GH-8547)
Alex Grönholm [Wed, 8 Aug 2018 21:06:47 +0000 (00:06 +0300)]
bpo-34270: Make it possible to name asyncio tasks (GH-8547)

Co-authored-by: Antti Haapala <antti.haapala@anttipatterns.com>
6 years agoAssume the raw environ is always declared. (GH-8707)
Benjamin Peterson [Wed, 8 Aug 2018 04:51:12 +0000 (21:51 -0700)]
Assume the raw environ is always declared. (GH-8707)

posixmodule.c always declares environ, so don't bother catching a NameError in os.py.

6 years agoMake code examples in Functional Programming HOWTO to be PEP 8 compliant. (GH-8646)
Sergey Fedoseev [Tue, 7 Aug 2018 21:38:00 +0000 (02:38 +0500)]
Make code examples in Functional Programming HOWTO to be PEP 8 compliant. (GH-8646)

6 years agobpo-34335: Use async/await syntax in documentation examples (GH-8674)
Mikhail Terekhov [Tue, 7 Aug 2018 20:29:06 +0000 (16:29 -0400)]
bpo-34335: Use async/await syntax in documentation examples (GH-8674)

6 years agoVSTS: Skip build steps when only docs have changed (GH-8546)
Steve Dower [Tue, 7 Aug 2018 14:45:27 +0000 (15:45 +0100)]
VSTS: Skip build steps when only docs have changed (GH-8546)