]> granicus.if.org Git - python/log
python
6 years agocloses bpo-35139: The `pyexpat` module's macros in `Modules/Setup` now match `setup...
Max Bélanger [Fri, 2 Nov 2018 02:49:46 +0000 (19:49 -0700)]
closes bpo-35139: The `pyexpat` module's macros in `Modules/Setup` now match `setup.py` (GH-10289)

This could cause compile errors on macOS or other platforms.

6 years agoSimplify sys.breakpointhook implementation (#9519)
Anthony Sottile [Thu, 1 Nov 2018 17:25:05 +0000 (10:25 -0700)]
Simplify sys.breakpointhook implementation (#9519)

6 years agobpo-35075: Fix broken url in the pprint documentation (GH-10201)
Pablo Galindo [Thu, 1 Nov 2018 12:29:38 +0000 (08:29 -0400)]
bpo-35075: Fix broken url in the pprint documentation (GH-10201)

https://bugs.python.org/issue35075

6 years agobpo-33578: Add getstate/setstate for CJK codec (GH-6984)
Christopher Thorne [Thu, 1 Nov 2018 10:48:49 +0000 (10:48 +0000)]
bpo-33578: Add getstate/setstate for CJK codec (GH-6984)

This implements getstate and setstate for the cjkcodecs multibyte incremental encoders/decoders, primarily to fix issues with seek/tell.

The encoder getstate/setstate is slightly tricky as the "state" is pending bytes + MultibyteCodec_State but only an integer can be returned. The approach I've taken is to encode this data into a long, similar to how .tell() encodes a "cookie_type" as a long.

https://bugs.python.org/issue33578

6 years agobpo-35128: Fix spacing issues in warning.warn() messages. (GH-10268)
Pablo Aguiar [Thu, 1 Nov 2018 10:33:35 +0000 (11:33 +0100)]
bpo-35128: Fix spacing issues in warning.warn() messages. (GH-10268)

6 years agobpo-35081: And pycore_lifecycle.h and pycore_pathconfig.h (GH-10273)
Victor Stinner [Thu, 1 Nov 2018 02:15:58 +0000 (03:15 +0100)]
bpo-35081: And pycore_lifecycle.h and pycore_pathconfig.h (GH-10273)

* And pycore_lifecycle.h and pycore_pathconfig.h headers to
  Include/internal/
* Move Py_BUILD_CORE specific code from coreconfig.h and
  pylifecycle.h to pycore_pathconfig.h and pycore_lifecycle.h
* Move _Py_wstrlist_XXX() definitions and _PyPathConfig code
  from pycore_state.h to pycore_pathconfig.h
* Move "Init" and "Fini" function definitions from pylifecycle.c to
  pycore_lifecycle.h.

6 years agobpo-35081: Move accu.h to Include/internal/pycore_accu.h (GH-10271)
Victor Stinner [Thu, 1 Nov 2018 01:30:36 +0000 (02:30 +0100)]
bpo-35081: Move accu.h to Include/internal/pycore_accu.h (GH-10271)

The accu.h header is no longer part of the Python C API: it has been
moved to the "internal" headers which are restricted to Python
itself.

Replace #include "accu.h" with #include "pycore_accu.h".

6 years agobpo-35081: Add _PyThreadState_GET() internal macro (GH-10266)
Victor Stinner [Thu, 1 Nov 2018 00:51:40 +0000 (01:51 +0100)]
bpo-35081: Add _PyThreadState_GET() internal macro (GH-10266)

If Py_BUILD_CORE is defined, the PyThreadState_GET() macro access
_PyRuntime which comes from the internal pycore_state.h header.
Public headers must not require internal headers.

Move PyThreadState_GET() and _PyInterpreterState_GET_UNSAFE() from
Include/pystate.h to Include/internal/pycore_state.h, and rename
PyThreadState_GET() to _PyThreadState_GET() there.

The PyThreadState_GET() macro of pystate.h is now redefined when
pycore_state.h is included, to use the fast _PyThreadState_GET().

Changes:

* Add _PyThreadState_GET() macro
* Replace "PyThreadState_GET()->interp" with
  _PyInterpreterState_GET_UNSAFE()
* Replace PyThreadState_GET() with _PyThreadState_GET() in internal C
  files (compiled with Py_BUILD_CORE defined), but keep
  PyThreadState_GET() in the public header files.
* _testcapimodule.c: replace PyThreadState_GET() with
  PyThreadState_Get(); the module is not compiled with Py_BUILD_CORE
  defined.
* pycore_state.h now requires Py_BUILD_CORE to be defined.

6 years agobpo-35081: Add pycore_ prefix to internal header files (GH-10263)
Victor Stinner [Wed, 31 Oct 2018 23:52:28 +0000 (00:52 +0100)]
bpo-35081: Add pycore_ prefix to internal header files (GH-10263)

* Rename Include/internal/ header files:

  * pyatomic.h -> pycore_atomic.h
  * ceval.h -> pycore_ceval.h
  * condvar.h -> pycore_condvar.h
  * context.h -> pycore_context.h
  * pygetopt.h -> pycore_getopt.h
  * gil.h -> pycore_gil.h
  * hamt.h -> pycore_hamt.h
  * hash.h -> pycore_hash.h
  * mem.h -> pycore_mem.h
  * pystate.h -> pycore_state.h
  * warnings.h -> pycore_warnings.h

* PCbuild project, Makefile.pre.in, Modules/Setup: add the
  Include/internal/ directory to the search paths of header files.
* Update includes. For example, replace #include "internal/mem.h"
  with #include "pycore_mem.h".

6 years agobpo-26558: Fix Py_FatalError() with GIL released (GH-10267)
Victor Stinner [Wed, 31 Oct 2018 23:26:41 +0000 (00:26 +0100)]
bpo-26558: Fix Py_FatalError() with GIL released (GH-10267)

Don't call _Py_FatalError_PrintExc() nor flush_std_files() if the
current thread doesn't hold the GIL, or if the current thread
has no Python state thread.

6 years agobpo-35081: Move Py_BUILD_CORE code to internal/mem.h (GH-10249)
Victor Stinner [Wed, 31 Oct 2018 19:19:24 +0000 (20:19 +0100)]
bpo-35081: Move Py_BUILD_CORE code to internal/mem.h (GH-10249)

* Add #include "internal/mem.h" to C files using
  _PyMem_SetDefaultAllocator().
* Include/internal/mem.h now requires Py_BUILD_CORE to be defined.

6 years agobpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH...
Xiang Zhang [Wed, 31 Oct 2018 11:49:16 +0000 (19:49 +0800)]
bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH-10217)

_io.IncrementalNewlineDecoder's initializer possibly assigns out-of-range
value to the bitwise struct field.

6 years agobpo-35110: Fix yet few spaces before dashes. (GH-10255)
Serhiy Storchaka [Wed, 31 Oct 2018 09:14:38 +0000 (11:14 +0200)]
bpo-35110: Fix yet few spaces before dashes. (GH-10255)

6 years agoFix a possible crash in range.__reversed__(). (GH-10252)
Zackery Spytz [Wed, 31 Oct 2018 09:13:16 +0000 (03:13 -0600)]
Fix a possible crash in range.__reversed__(). (GH-10252)

6 years agobpo-33138: Change standard error message for non-pickleable and non-copyable types...
Serhiy Storchaka [Wed, 31 Oct 2018 00:28:07 +0000 (02:28 +0200)]
bpo-33138: Change standard error message for non-pickleable and non-copyable types. (GH-6239)

6 years agobpo-35110: Fix unintentional spaces around hyphens and dashes. (GH-10231)
Serhiy Storchaka [Wed, 31 Oct 2018 00:26:06 +0000 (02:26 +0200)]
bpo-35110: Fix unintentional spaces around hyphens and dashes. (GH-10231)

6 years agobpo-35116, urllib.parse: Document the new max_num_fields parameter (GH-10247)
matthewbelisle-wf [Tue, 30 Oct 2018 20:30:19 +0000 (15:30 -0500)]
bpo-35116, urllib.parse: Document the new max_num_fields parameter (GH-10247)

6 years agobpo-35086: Fix tkinter example "A Simple Hello World Program". (GH-10160)
Daniel Lovell [Tue, 30 Oct 2018 14:56:07 +0000 (07:56 -0700)]
bpo-35086: Fix tkinter example "A Simple Hello World Program". (GH-10160)

The root widget was accessed as a global variable in the Application's method.

6 years agobpo-35081: Move Include/pyatomic.c to Include/internal/ (GH-10239)
Victor Stinner [Tue, 30 Oct 2018 14:14:25 +0000 (15:14 +0100)]
bpo-35081: Move Include/pyatomic.c to Include/internal/ (GH-10239)

Add pyatomic.h to the VS project (it wasn't referenced).

6 years agobpo-35081: Cleanup pystate.c and pystate.h (GH-10240)
Victor Stinner [Tue, 30 Oct 2018 14:13:17 +0000 (15:13 +0100)]
bpo-35081: Cleanup pystate.c and pystate.h (GH-10240)

* Remove _PyThreadState_Current
* Replace GET_TSTATE() with PyThreadState_GET()
* Replace GET_INTERP_STATE() with _PyInterpreterState_GET_UNSAFE()
* Replace direct access to _PyThreadState_Current with
  PyThreadState_GET()
* Replace _PyThreadState_Current with
  _PyRuntime.gilstate.tstate_current
* Rename SET_TSTATE() to _PyThreadState_SET(), name more
  consistent with _PyThreadState_GET()
* Update outdated comments

6 years agobpo-35059: Convert _Py_Dealloc() to static inline function (GH-10223)
Victor Stinner [Tue, 30 Oct 2018 13:48:26 +0000 (14:48 +0100)]
bpo-35059: Convert _Py_Dealloc() to static inline function (GH-10223)

Convert _Py_Dealloc() macro into a static inline function. Moreover,
it is now also defined as a static inline function if Py_TRACE_REFS
is defined.

6 years agobpo-32030: Make _PySys_AddXOptionWithError() private (GH-10236)
Victor Stinner [Tue, 30 Oct 2018 13:31:42 +0000 (14:31 +0100)]
bpo-32030: Make _PySys_AddXOptionWithError() private (GH-10236)

Make _PySys_AddXOptionWithError() and _PySys_AddWarnOptionWithError()
functions private again. They are no longer needed to initialize Python:
_PySys_EndInit() is now responsible to add these options instead.

Moreover, PySys_AddWarnOptionUnicode() now clears the exception on
failure if possible.

6 years agobpo-34523: Fix config_init_fs_encoding() for ASCII (GH-10232)
Victor Stinner [Tue, 30 Oct 2018 11:58:10 +0000 (12:58 +0100)]
bpo-34523: Fix config_init_fs_encoding() for ASCII (GH-10232)

* bpo-34523, bpo-34403: Fix config_init_fs_encoding(): it now uses
  ASCII if _Py_GetForceASCII() is true.
* Fix a regression of commit b2457efc78b74a1d6d1b77d11a939e886b8a4e2c.
* Fix also a memory leak: get_locale_encoding() already allocates
  memory, no need to duplicate the string.

6 years agobpo-31680: Add curses.ncurses_version. (GH-4217)
Serhiy Storchaka [Tue, 30 Oct 2018 11:22:42 +0000 (13:22 +0200)]
bpo-31680: Add curses.ncurses_version. (GH-4217)

Use curses.ncurses_version for conditionally skipping a test.

6 years agobpo-33237: Improve AttributeError message for partially initialized module. (GH-6398)
Serhiy Storchaka [Tue, 30 Oct 2018 11:19:51 +0000 (13:19 +0200)]
bpo-33237: Improve AttributeError message for partially initialized module. (GH-6398)

6 years agobpo-34876: Change the lineno of the AST for decorated function and class. (GH-9731)
Serhiy Storchaka [Tue, 30 Oct 2018 11:16:02 +0000 (13:16 +0200)]
bpo-34876: Change the lineno of the AST for decorated function and class. (GH-9731)

It was overridden by the lineno of the first decorator. Now it is
the lineno of 'def' or 'class'.

6 years agoDoc: fix asyncio loop.close() description (GH-10229)
Andriy Maletsky [Mon, 29 Oct 2018 21:39:21 +0000 (23:39 +0200)]
Doc: fix asyncio loop.close() description (GH-10229)

Needs backport to 3.7. In 3.6 the description is correct.

6 years agobpo-35031: Fix test_start_tls_server_1 on FreeBSD buildbots (GH-10011)
Pablo Galindo [Mon, 29 Oct 2018 20:47:44 +0000 (16:47 -0400)]
bpo-35031: Fix test_start_tls_server_1 on FreeBSD buildbots (GH-10011)

Some FreeBSD buildbots fail to run this test as the eof was not being received by the server if the size is not big enough. This behaviour only appears if the client is using TLS1.3.

6 years agobpo-34765: install-sh is executable (GH-10225)
Victor Stinner [Mon, 29 Oct 2018 20:43:02 +0000 (21:43 +0100)]
bpo-34765: install-sh is executable (GH-10225)

Fix 'install-sh' file permission: add execution bit ("chmod +x"),
"-rw-rw-r--." becomes "-rwxrwxr-x.".

6 years agobpo-34945: Buffer output in test suite only when creating junit file (GH-10204)
Pablo Galindo [Mon, 29 Oct 2018 20:09:41 +0000 (16:09 -0400)]
bpo-34945: Buffer output in test suite only when creating junit file (GH-10204)

After commit d0f49d2f5085ca68e3dc8725f1fb1c9674bfb5ed, the output of the
test suite is always buffered as the test output needs to be included in
the JUnit file in same cases (as when a test fails). This has the
consequence that printing or using debuggers (like pdb) in the test
suite does not result in a good user experience anymore.

This commit modifies the test suite runner so it only captures the test
output when the JUnit file is requested to fix the regression so prints
and debuggers are usable again.

6 years agobpo-35059: Convert Py_XINCREF() to static inline function (GH-10224)
Victor Stinner [Mon, 29 Oct 2018 19:52:41 +0000 (20:52 +0100)]
bpo-35059: Convert Py_XINCREF() to static inline function (GH-10224)

Convert Py_XINCREF() and Py_XDECREF() macros into static inline
functions.

6 years agoInclude memo in the documented signature of copy.deepcopy()
Stephan Hoyer [Mon, 29 Oct 2018 18:30:12 +0000 (11:30 -0700)]
Include memo in the documented signature of copy.deepcopy()

* Include memo in the documented signature of copy.deepcopy()

The memo argument is mentioned lower on the doc page under writing a
`__deepcopy__` method, but is not included in the documented function signature.
This makes it easy to miss, and can lead to incorrect/buggy implementations of
`__deepcopy__` -- which is exatly what just happpend to me!

6 years agobpo-34160: Preserve user specified order of Element attributes in html. (GH-10190)
Serhiy Storchaka [Mon, 29 Oct 2018 17:31:04 +0000 (19:31 +0200)]
bpo-34160: Preserve user specified order of Element attributes in html. (GH-10190)

6 years agobpo-33331: Clean modules in the reversed order in PyImport_Cleanup(). (GH-6565)
Serhiy Storchaka [Mon, 29 Oct 2018 17:30:16 +0000 (19:30 +0200)]
bpo-33331: Clean modules in the reversed order in PyImport_Cleanup(). (GH-6565)

Modules imported last are now cleared first at interpreter shutdown.

A newly imported module is moved to the end of sys.modules, behind
modules on which it depends.

6 years agobpo-35059: Remove Py_STATIC_INLINE() macro (GH-10216)
Victor Stinner [Mon, 29 Oct 2018 13:49:24 +0000 (14:49 +0100)]
bpo-35059: Remove Py_STATIC_INLINE() macro (GH-10216)

"static inline" should be used directly. Forcing the compiler to
inline is not recommended.

6 years agobpo-35059: Convert Py_INCREF() to static inline function (GH-10079)
Victor Stinner [Mon, 29 Oct 2018 12:43:07 +0000 (13:43 +0100)]
bpo-35059: Convert Py_INCREF() to static inline function (GH-10079)

* Convert Py_INCREF() and Py_DECREF() macros into static inline
  functions.
* Remove _Py_CHECK_REFCNT() macro: code moved into Py_DECREF().

6 years agobpo-27741: Better wording for datetime.strptime() (GH-9994)
Gus Goulart [Mon, 29 Oct 2018 11:49:52 +0000 (08:49 -0300)]
bpo-27741: Better wording for datetime.strptime() (GH-9994)

6 years agoFix a possible "double decref" in termios.tcgetattr(). (GH-10194)
Zackery Spytz [Mon, 29 Oct 2018 04:55:20 +0000 (22:55 -0600)]
Fix a possible "double decref" in termios.tcgetattr(). (GH-10194)

6 years agobpo-35097: Add IDLE doc subsection explaining editor windows. (#10206)
Terry Jan Reedy [Mon, 29 Oct 2018 00:42:18 +0000 (20:42 -0400)]
bpo-35097: Add IDLE doc subsection explaining editor windows. (#10206)

Topics include opening, title and status bar, .py* extension, and running.

6 years agobpo-33234: Add exact allocation optimization to lists in What's New (GH-10200)
Pablo Galindo [Sun, 28 Oct 2018 22:03:18 +0000 (22:03 +0000)]
bpo-33234: Add exact allocation optimization to lists in What's New (GH-10200)

In commit 372d705 a new optimization to the list() type was introduced but it was not added
to the optimization section in What's new for Python 3.8.

6 years agobpo-35047, unittest.mock: Better error messages on assert_called_xxx failures (GH...
Petter Strandmark [Sun, 28 Oct 2018 20:37:10 +0000 (21:37 +0100)]
bpo-35047, unittest.mock: Better error messages on assert_called_xxx failures (GH-10090)

unittest.mock now includes mock calls in exception messages if
assert_not_called, assert_called_once, or assert_called_once_with
fails.

6 years agoIssue 35093: Document the IDLE document viewer in the IDLE doc. (#10195)
Terry Jan Reedy [Sun, 28 Oct 2018 20:21:18 +0000 (16:21 -0400)]
Issue 35093: Document the IDLE document viewer in the IDLE doc. (#10195)

Add a paragraph in "Help and preferences", "Help sources" subsection.

6 years agobpo-33234 Improve list() pre-sizing for inputs with known lengths (GH-9846)
Pablo Galindo [Sun, 28 Oct 2018 20:16:26 +0000 (20:16 +0000)]
bpo-33234 Improve list() pre-sizing for inputs with known lengths (GH-9846)

The list() constructor isn't taking full advantage of known input
lengths or length hints. This commit makes the constructor
pre-size and not over-allocate when the input size is known (the
input collection implements __len__). One on the main advantages is
that this provides 12% difference in memory savings due to the difference
between overallocating and allocating exactly the input size.

For efficiency purposes and to avoid a performance regression for small
generators and collections, the size of the input object is calculated using
__len__ and not __length_hint__, as the later is considerably slower.

6 years agoFix yet one error in checking Tcl version. (GH-10189)
Serhiy Storchaka [Sun, 28 Oct 2018 18:58:04 +0000 (20:58 +0200)]
Fix yet one error in checking Tcl version. (GH-10189)

6 years agobpo-34160: Preserve user specified order of Element attributes (GH-10163)
Raymond Hettinger [Sun, 28 Oct 2018 18:18:22 +0000 (11:18 -0700)]
bpo-34160: Preserve user specified order of Element attributes (GH-10163)

6 years agoFix checking for bugfix Tcl version. (GH-10185)
Serhiy Storchaka [Sun, 28 Oct 2018 17:48:36 +0000 (19:48 +0200)]
Fix checking for bugfix Tcl version. (GH-10185)

6 years agobpo-35090: Fix potential division by zero in allocator wrappers (GH-10174)
Alexey Izbyshev [Sun, 28 Oct 2018 16:45:50 +0000 (19:45 +0300)]
bpo-35090: Fix potential division by zero in allocator wrappers (GH-10174)

* Fix potential division by zero in BZ2_Malloc()
* Avoid division by zero in PyLzma_Malloc()
* Avoid division by zero and integer overflow in PyZlib_Malloc()

Reported by Svace static analyzer.

6 years agobpo-1529353: Explain Shell text squeezing in the IDLE doc. (#10169)
Terry Jan Reedy [Sun, 28 Oct 2018 16:44:44 +0000 (12:44 -0400)]
bpo-1529353: Explain Shell text squeezing in the IDLE doc. (#10169)

6 years agobpo-35089: Don't mention typing.io and typing.re (GH-10173)
Sebastian Rittau [Sun, 28 Oct 2018 16:03:29 +0000 (17:03 +0100)]
bpo-35089: Don't mention typing.io and typing.re (GH-10173)

https://bugs.python.org/issue35089

6 years agobpo-34672: fix a compiler warning in timemodule.c (GH-10176)
Xiang Zhang [Sun, 28 Oct 2018 15:58:42 +0000 (23:58 +0800)]
bpo-34672: fix a compiler warning in timemodule.c (GH-10176)

6 years agobpo-35064 prefix smelly symbols that appear with COUNT_ALLOCS with _Py_ (GH-10152)
Pablo Galindo [Sun, 28 Oct 2018 15:02:17 +0000 (15:02 +0000)]
bpo-35064 prefix smelly symbols that appear with COUNT_ALLOCS with _Py_ (GH-10152)

Configuring python with ./configure --with-pydebug CFLAGS="-D COUNT_ALLOCS -O0"
makes "make smelly" fail as some symbols were being exported without the "Py_" or
"_Py" prefixes.

6 years agobpo-32892: Support subclasses of base types in isinstance checks for AST constants...
Serhiy Storchaka [Sun, 28 Oct 2018 11:43:03 +0000 (13:43 +0200)]
bpo-32892: Support subclasses of base types in isinstance checks for AST constants. (GH-9934)

Some projects (e.g. Chameleon) create ast.Str containing an instance
of the str subclass.

6 years agobpo-35054: Add yet more index entries for symbols. (GH-10121)
Serhiy Storchaka [Sun, 28 Oct 2018 11:41:26 +0000 (13:41 +0200)]
bpo-35054: Add yet more index entries for symbols. (GH-10121)

6 years agoFix mistakes on function coroutines related definitions (GH-9871)
Andrés Delfino [Sun, 28 Oct 2018 10:41:57 +0000 (07:41 -0300)]
Fix mistakes on function coroutines related definitions (GH-9871)

Fix a bug I introduced in #9864 by which coroutines are treated as synonymous of function coroutines.

Also, fix the same mistake (coroutines == function coroutines) already present in other parts of the reference.

I'm very sorry for the hassle.

6 years agobpo-35088: Update idlelib.help.copy_string docstring (#10164)
Terry Jan Reedy [Sun, 28 Oct 2018 05:29:00 +0000 (01:29 -0400)]
bpo-35088: Update idlelib.help.copy_string docstring (#10164)

We now use git and backporting instead of hg and forward merging.

6 years agobpo-35087: Update idlelib help files for the current doc build. (GH-10162)
Terry Jan Reedy [Sun, 28 Oct 2018 05:21:36 +0000 (01:21 -0400)]
bpo-35087: Update idlelib help files for the current doc build. (GH-10162)

There is only one trivial change to idle.rst. Nearly all the changes to help.html are the elimination of chapter and section numbers on headers due to changes in the build system. help.py no longer requires header numbering.

6 years agobpo-34751: improved hash function for tuples (GH-9471)
jdemeyer [Sun, 28 Oct 2018 00:06:38 +0000 (02:06 +0200)]
bpo-34751: improved hash function for tuples (GH-9471)

6 years agobpo-35067: Remove _distutils_findvs and use vswhere.exe instead. (GH-10095)
Steve Dower [Sat, 27 Oct 2018 20:48:33 +0000 (16:48 -0400)]
bpo-35067: Remove _distutils_findvs and use vswhere.exe instead. (GH-10095)

6 years agounittest documentation: Spell pytest without the dot (GH-9820)
Andreas Pelme [Sat, 27 Oct 2018 18:09:12 +0000 (20:09 +0200)]
unittest documentation: Spell pytest without the dot (GH-9820)

Referring to ``pytest`` as ``py.test`` is deprecated.

6 years agoFix typo in zipfile documentation. (GH-10151)
nsrip [Sat, 27 Oct 2018 14:42:56 +0000 (10:42 -0400)]
Fix typo in zipfile documentation. (GH-10151)

6 years agobpo-33710: Deprecate l*gettext() and related functions in the gettext module. (GH...
Serhiy Storchaka [Sat, 27 Oct 2018 05:00:41 +0000 (08:00 +0300)]
bpo-33710: Deprecate l*gettext() and related functions in the gettext module. (GH-10139)

They return encoded bytes and are Python 2 artifacts.

6 years ago bpo-35079: Revise difflib.SequenceManager.get_matching_blocks doc (GH-10144)
Terry Jan Reedy [Sat, 27 Oct 2018 03:03:08 +0000 (23:03 -0400)]
 bpo-35079: Revise difflib.SequenceManager.get_matching_blocks doc (GH-10144)

Specify that blocks are non-overlapping. Change '!=' to '<'.

6 years agobpo-35042: Use the :pep: role where a PEP is specified (#10036)
Stéphane Wirtel [Fri, 26 Oct 2018 22:58:26 +0000 (00:58 +0200)]
bpo-35042: Use the :pep: role where a PEP is specified (#10036)

6 years agobpo-35024: Remove redundant and possibly incorrect verbose message after writing...
Quentin Agren [Fri, 26 Oct 2018 18:36:30 +0000 (20:36 +0200)]
bpo-35024: Remove redundant and possibly incorrect verbose message after writing '.pyc' (GH-9998)

Since `SourceFileLoader.set_data()` catches exceptions raised by `_write_atomic()` and logs an informative message consequently, always logging successful outcome in 'SourceLoader.get_code()' seems redundant.

https://bugs.python.org/issue35024

6 years agoFix a typo in asyncio-dev.rst. (GH-10133)
Benjamin Peterson [Fri, 26 Oct 2018 17:14:04 +0000 (10:14 -0700)]
Fix a typo in asyncio-dev.rst. (GH-10133)

"threadsafe"

6 years agobpo-9263: _PyXXX_CheckConsistency() use _PyObject_ASSERT() (GH-10108)
Victor Stinner [Fri, 26 Oct 2018 16:47:15 +0000 (18:47 +0200)]
bpo-9263: _PyXXX_CheckConsistency() use _PyObject_ASSERT() (GH-10108)

Use _PyObject_ASSERT() in:

* _PyDict_CheckConsistency()
* _PyType_CheckConsistency()
* _PyUnicode_CheckConsistency()

_PyObject_ASSERT() dumps the faulty object if the assertion fails
to help debugging.

6 years agobpo-9263: Use _PyObject_ASSERT() in typeobject.c (GH-10111)
Victor Stinner [Fri, 26 Oct 2018 16:39:11 +0000 (18:39 +0200)]
bpo-9263: Use _PyObject_ASSERT() in typeobject.c (GH-10111)

Replace assert() with _PyObject_ASSERT() in Objects/typeobject.c
to dump the faulty object on assertion failure to ease debugging.

6 years agobpo-9263: Use _PyObject_ASSERT() in gcmodule.c (GH-10112)
Victor Stinner [Fri, 26 Oct 2018 16:00:13 +0000 (18:00 +0200)]
bpo-9263: Use _PyObject_ASSERT() in gcmodule.c (GH-10112)

Replace assert() with _PyObject_ASSERT() in Modules/gcmodule.c
to dump the faulty object on assertion failure to ease debugging.

Fix also indentation of a large comment.

Initial patch written by David Malcolm.

Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
6 years agobpo-9263: Use _PyObject_ASSERT() in object.c (GH-10110)
Victor Stinner [Fri, 26 Oct 2018 15:16:37 +0000 (17:16 +0200)]
bpo-9263: Use _PyObject_ASSERT() in object.c (GH-10110)

Replace assert() with _PyObject_ASSERT() in Objects/object.c to dump
the faulty object on assertion failure to ease debugging.

6 years agobpo-35059, libmpdec: Add missing EXTINLINE in mpdecimal.h (GH-10128)
Victor Stinner [Fri, 26 Oct 2018 15:06:57 +0000 (17:06 +0200)]
bpo-35059, libmpdec: Add missing EXTINLINE in mpdecimal.h (GH-10128)

Declare functions with EXTINLINE:

* mpd_del()
* mpd_uint_zero()
* mpd_qresize()
* mpd_qresize_zero()
* mpd_minalloc()

These functions are implemented with "inline" or "ALWAYS_INLINE", but
declared without inline which cause linker error on Visual Studio in
Debug mode when using /Ob1.

6 years agobpo-34789: make xml.sax.make_parser accept iterables of all types (GH-9576)
Andrés Delfino [Fri, 26 Oct 2018 14:56:57 +0000 (11:56 -0300)]
bpo-34789: make xml.sax.make_parser accept iterables of all types (GH-9576)

6 years agobpo-35017, socketserver: don't accept request after shutdown (GH-9952)
Denis Ledoux [Fri, 26 Oct 2018 13:46:17 +0000 (15:46 +0200)]
bpo-35017, socketserver: don't accept request after shutdown (GH-9952)

Prior to this revision, after the shutdown of a `BaseServer`,
the server accepted a last single request
if it was sent between the server socket polling
and the polling timeout.

This can be problematic for instance for a server restart
for which you do not want to interrupt the service,
by not closing the listening socket during the restart.
One request failed because of this behavior.

Note that only one request failed,
following requests were not accepted, as expected.

6 years agoSimplify the warning for http.server. (#10116)
Senthil Kumaran [Fri, 26 Oct 2018 13:43:37 +0000 (06:43 -0700)]
Simplify the warning for http.server. (#10116)

6 years agobpo-35059, PCbuild: Expand inline funcs in Debug (GH-10094)
Victor Stinner [Fri, 26 Oct 2018 13:10:29 +0000 (15:10 +0200)]
bpo-35059, PCbuild: Expand inline funcs in Debug (GH-10094)

Visual Studio solution: Set InlineFunctionExpansion to
OnlyExplicitInline ("/Ob1" option) on all projects (in
pyproject.props) in Debug mode on Win32 and x64 platforms to expand
functions marked as inline.

This change should make Python compiled in Debug mode a little bit
faster on Windows. On Unix, GCC uses -Og optimization level for
./configure --with-pydebug.

6 years agobpo-35059: Convert PyObject_INIT() to function (GH-10077)
Victor Stinner [Fri, 26 Oct 2018 12:35:00 +0000 (14:35 +0200)]
bpo-35059: Convert PyObject_INIT() to function (GH-10077)

* Convert PyObject_INIT() and PyObject_INIT_VAR() macros to static
  inline functions.
* Fix usage of these functions: cast to PyObject* or PyVarObject*.

6 years agobpo-34890: Make iscoroutinefunction, isgeneratorfunction and isasyncgenfunction work...
Pablo Galindo [Fri, 26 Oct 2018 11:19:14 +0000 (12:19 +0100)]
bpo-34890: Make iscoroutinefunction, isgeneratorfunction and isasyncgenfunction work with functools.partial (GH-9903)

inspect.isfunction() processes both inspect.isfunction(func) and
inspect.isfunction(partial(func, arg)) correctly but some other functions in the
inspect module (iscoroutinefunction, isgeneratorfunction and isasyncgenfunction)
lack this functionality. This commits adds a new check in the mentioned functions
in the inspect module so they can work correctly with arbitrarily nested partial
functions.

6 years agobpo-35044, doc: Use the :exc: role for the exceptions (GH-10037)
Stéphane Wirtel [Fri, 26 Oct 2018 10:52:11 +0000 (12:52 +0200)]
bpo-35044, doc: Use the :exc: role for the exceptions (GH-10037)

6 years agobpo-35054: Add more index entries for symbols. (GH-10064)
Serhiy Storchaka [Fri, 26 Oct 2018 06:00:49 +0000 (09:00 +0300)]
bpo-35054: Add more index entries for symbols. (GH-10064)

6 years agobpo-9263: _Py_NegativeRefcount() use _PyObject_AssertFailed() (GH-10109)
Victor Stinner [Fri, 26 Oct 2018 00:12:34 +0000 (02:12 +0200)]
bpo-9263: _Py_NegativeRefcount() use _PyObject_AssertFailed() (GH-10109)

_Py_NegativeRefcount() now uses _PyObject_AssertFailed() to dump the
object to help debugging.

6 years agobpo-35053: Define _PyTraceMalloc_NewReference in object.h (GH-10107)
Victor Stinner [Thu, 25 Oct 2018 22:01:56 +0000 (00:01 +0200)]
bpo-35053: Define _PyTraceMalloc_NewReference in object.h (GH-10107)

_PyTraceMalloc_NewReference() is now called by _Py_NewReference(), so
move its definition to object.h. Moreover, define it even if
Py_LIMITED_API is defined, since _Py_NewReference() is also exposed
even if Py_LIMITED_API is defined.

6 years agobpo-35022: unittest.mock.MagicMock now also supports __fspath__ (GH-9960)
Max Bélanger [Thu, 25 Oct 2018 21:48:58 +0000 (14:48 -0700)]
bpo-35022: unittest.mock.MagicMock now also supports __fspath__ (GH-9960)

The MagicMock class supports many magic methods, but not __fspath__. To ease
testing with modules such as os.path, this function is now supported by default.

6 years agobpo-35038: AttributeError: 'frame' object has no attribute 'f_restricted'. (GH-10098)
Stéphane Wirtel [Thu, 25 Oct 2018 21:13:45 +0000 (23:13 +0200)]
bpo-35038: AttributeError: 'frame' object has no attribute 'f_restricted'. (GH-10098)

https://bugs.python.org/issue35038

6 years agoFix grammar in using/unix build instruction docs (GH-10009)
Stéphane Wirtel [Thu, 25 Oct 2018 15:32:30 +0000 (17:32 +0200)]
Fix grammar in using/unix build instruction docs (GH-10009)

6 years agobpo-9263: Dump Python object on GC assertion failure (GH-10062)
Victor Stinner [Thu, 25 Oct 2018 15:31:10 +0000 (17:31 +0200)]
bpo-9263: Dump Python object on GC assertion failure (GH-10062)

Changes:

* Add _PyObject_AssertFailed() function.
* Add _PyObject_ASSERT() and _PyObject_ASSERT_WITH_MSG() macros.
* gc_decref(): replace assert() with _PyObject_ASSERT_WITH_MSG() to
  dump the faulty object if the assertion fails.

_PyObject_AssertFailed() calls:

* _PyMem_DumpTraceback(): try to log the traceback where the object
  memory has been allocated if tracemalloc is enabled.
* _PyObject_Dump(): log repr(obj).
* Py_FatalError(): log the current Python traceback.

_PyObject_AssertFailed() uses _PyObject_IsFreed() heuristic to check
if the object memory has been freed by a debug hook on Python memory
allocators.

Initial patch written by David Malcolm.

Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
6 years agobpo-35059: Add Py_STATIC_INLINE() macro (GH-10093)
Victor Stinner [Thu, 25 Oct 2018 15:28:11 +0000 (17:28 +0200)]
bpo-35059: Add Py_STATIC_INLINE() macro (GH-10093)

* Add Py_STATIC_INLINE() macro to declare a "static inline" function.
  If the compiler supports it, try to always inline the function even if no
  optimization level was specified.
* Modify pydtrace.h to use Py_STATIC_INLINE() when WITH_DTRACE is
  not defined.
* Add an unit test on Py_DECREF() to make sure that
  _Py_NegativeRefcount() reports the correct filename.

6 years agobpo-31047: Fix ntpath.abspath to trim ending separator (GH-10082)
Tim Graham [Thu, 25 Oct 2018 15:26:38 +0000 (11:26 -0400)]
bpo-31047: Fix ntpath.abspath to trim ending separator (GH-10082)

Regression in b0bf51b32240369ccb736dc32ff82bb96f375402.

6 years agobpo-32321: Add pure Python fallback for functools.reduce (GH-8548)
madman-bob [Thu, 25 Oct 2018 14:02:10 +0000 (15:02 +0100)]
bpo-32321: Add pure Python fallback for functools.reduce (GH-8548)

6 years agobpo-35053: Add Include/tracemalloc.h (GH-10091)
Victor Stinner [Thu, 25 Oct 2018 13:54:13 +0000 (15:54 +0200)]
bpo-35053: Add Include/tracemalloc.h (GH-10091)

* Modify object.h to ensure that pymem.h is included,
  to get _Py_tracemalloc_config variable.
* Move _PyTraceMalloc_XXX() functions to tracemalloc.h,
  they need PyObject type. Break circular dependency between pymem.h
  and object.h.

6 years agobpo-35053: Enhance tracemalloc to trace free lists (GH-10063)
Victor Stinner [Thu, 25 Oct 2018 11:31:16 +0000 (13:31 +0200)]
bpo-35053: Enhance tracemalloc to trace free lists (GH-10063)

tracemalloc now tries to update the traceback when an object is
reused from a "free list" (optimization for faster object creation,
used by the builtin list type for example).

Changes:

* Add _PyTraceMalloc_NewReference() function which tries to update
  the Python traceback of a Python object.
* _Py_NewReference() now calls _PyTraceMalloc_NewReference().
* Add an unit test.

6 years agoimportlib: Fix typo in SourceLoader.path_stats docstring (GH-10052)
Quentin [Thu, 25 Oct 2018 11:04:28 +0000 (13:04 +0200)]
importlib: Fix typo in SourceLoader.path_stats docstring (GH-10052)

6 years agobpo-28015: Support LTO build with clang (GH-9908)
serge-sans-paille [Wed, 24 Oct 2018 23:54:22 +0000 (01:54 +0200)]
bpo-28015: Support LTO build with clang (GH-9908)

.o generated by clang in LTO mode actually are LLVM bitcode files, which
leads to a few errors during configure/build step:

- add lto flags to the BASECFLAGS instead of CFLAGS, as CFLAGS are used
  to build autoconf test case, and some are not compatible with clang LTO
  (they assume binary in the .o, not bitcode)
- force llvm-ar instead of ar, as ar is not aware of .o files generated
  by clang -flto

6 years agoconfigparser doc: Properly label ConfigParser attributes (GH-9930)
Ned Batchelder [Wed, 24 Oct 2018 23:47:01 +0000 (19:47 -0400)]
configparser doc: Properly label ConfigParser attributes (GH-9930)

6 years agoimportlib doc: Fix approximated import_module() code (GH-9945)
orlnub123 [Wed, 24 Oct 2018 23:32:26 +0000 (02:32 +0300)]
importlib doc: Fix approximated import_module() code (GH-9945)

The spec gets stored on modules with the __spec__ attribute, not spec.

6 years agobpo-35027, distutils doc: Correct note on setup.py change in Python 3.7 (GH-10032)
TilmanK [Wed, 24 Oct 2018 22:50:25 +0000 (00:50 +0200)]
bpo-35027, distutils doc: Correct note on setup.py change in Python 3.7 (GH-10032)

6 years agoturtledemo/penrose.py: remove unused clock() calls (GH-10033)
Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) [Wed, 24 Oct 2018 22:43:39 +0000 (04:13 +0530)]
turtledemo/penrose.py: remove unused clock() calls (GH-10033)

Actually time calculations were remove in commit 891a1f8.

6 years agoUse f-strings in asyncio-task code examples (GH-10035)
Mariatta [Wed, 24 Oct 2018 22:37:12 +0000 (15:37 -0700)]
Use f-strings in asyncio-task code examples (GH-10035)

Replace str.format with f-strings in the code examples of asyncio-task documentation.

6 years agobpo-32797: improve documentation of linecache.getline (GH-9540)
jdemeyer [Wed, 24 Oct 2018 12:44:41 +0000 (14:44 +0200)]
bpo-32797: improve documentation of linecache.getline (GH-9540)

6 years agobpo-33899: Mention tokenize behavior change in What's New (GH-10073)
Tal Einat [Wed, 24 Oct 2018 07:20:05 +0000 (10:20 +0300)]
bpo-33899: Mention tokenize behavior change in What's New (GH-10073)

6 years agobpo-30863: Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(). (GH-2599)
Serhiy Storchaka [Tue, 23 Oct 2018 19:58:24 +0000 (22:58 +0300)]
bpo-30863: Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(). (GH-2599)

They no longer cache the wchar_t* representation of string objects.

6 years agobpo-34794: Fix a leak in Tkinter. (GH-10025)
Serhiy Storchaka [Tue, 23 Oct 2018 19:40:54 +0000 (22:40 +0300)]
bpo-34794: Fix a leak in Tkinter. (GH-10025)

Based on the investigation by Xiang Zhang.