]> granicus.if.org Git - python/log
python
5 years agobpo-36146: Refactor setup.py: Add PyBuildExt.srcdir (GH-12124)
Victor Stinner [Fri, 1 Mar 2019 14:59:39 +0000 (15:59 +0100)]
bpo-36146: Refactor setup.py: Add PyBuildExt.srcdir (GH-12124)

* Add PyBuildExt.srcdir atribute in setup.py: the source directory is
  now always absolute.
* Add PyBuildExt.inc_dirs and PyBuildExt.lib_dirs attributes:
  replace 'inc_dirs' and 'lib_dirs' local variables of
  detect_modules().
* Replace "from distutils.errors import *"
  with "from distutils.errors import CCompilerError, DistutilsError"
  to be able to use static analyzers like pyflakes
* Reorder imports.

5 years agobpo-36146: Refactor setup.py: PyBuildExt.add() method (GH-12097)
Victor Stinner [Fri, 1 Mar 2019 14:31:45 +0000 (15:31 +0100)]
bpo-36146: Refactor setup.py: PyBuildExt.add() method (GH-12097)

* Add PyBuildExt.add() which adds the extension directly to
  self.extensions, rather than using a temporary 'exts' local
  variable in detect_modules() and then add 'exts' to self.extensions
* Convert 'missing' local variable from detect_modules()
  into PyBuildExt.missing attribute
* _detect_openssl(), _decimal_ext() and _detect_nis() now call
  directly self.add(), rather than returning an extension
  (or None if not found).
* Rename _decimal_ext() to _detect_decimal() for consistency with
  other methods.

5 years agobpo-36146: Fix inc_dirs in setup.py on macOS (GH-12098)
Victor Stinner [Fri, 1 Mar 2019 12:53:46 +0000 (13:53 +0100)]
bpo-36146: Fix inc_dirs in setup.py on macOS (GH-12098)

Fix setup.py on macOS: only add /usr/include/ffi to include
directories of _ctypes, not for all extensions.

5 years agobpo-36142: Remove _PyMain structure (GH-12120)
Victor Stinner [Fri, 1 Mar 2019 12:10:14 +0000 (13:10 +0100)]
bpo-36142: Remove _PyMain structure (GH-12120)

* Move fields from _PyMain to _PyCoreConfig:

  * skip_first_line
  * run_command
  * run_module
  * run_filename

* Replace _PyMain.stdin_is_interactive with a new
  stdin_is_interactive(config) function
* Rename _PyMain to _PyArgv. Add "const _PyArgv *args" field
  to _PyCmdline.

5 years agobpo-36142: Rework error reporting in pymain_main() (GH-12113)
Victor Stinner [Fri, 1 Mar 2019 11:14:41 +0000 (12:14 +0100)]
bpo-36142: Rework error reporting in pymain_main() (GH-12113)

Add a new _Py_INIT_EXIT() macro to be able to exit Python with an
exitcode using _PyInitError API. Rewrite function calls by
pymain_main() to use _PyInitError.

Changes:

* Remove _PyMain.err and _PyMain.status field
* Add _Py_INIT_EXIT() macro and _PyInitError.exitcode field.
* Rename _Py_FatalInitError() to _Py_ExitInitError().

5 years agobpo-36152: IDLE: Remove unused parameter from colorizer (GH-12109)
Cheryl Sabella [Fri, 1 Mar 2019 10:19:40 +0000 (05:19 -0500)]
bpo-36152: IDLE: Remove unused parameter from colorizer (GH-12109)

Remove colorizer.ColorDelegator.close_when_done and the corresponding argument of .close().  In IDLE, both have always been None or False since 2007.

5 years agobpo-36155: Check for identity on test_gc.test_get_objects (GH-12116)
Pablo Galindo [Fri, 1 Mar 2019 09:12:27 +0000 (01:12 -0800)]
bpo-36155: Check for identity on test_gc.test_get_objects (GH-12116)

5 years agobpo-36018: Add documentation link to "random variable" (GH-12114)
Raymond Hettinger [Fri, 1 Mar 2019 05:47:26 +0000 (21:47 -0800)]
bpo-36018: Add documentation link to "random variable" (GH-12114)

https://bugs.python.org/issue36018

5 years agobpo-36142: Exclude coreconfig.h from Py_LIMITED_API (GH-12111)
Victor Stinner [Fri, 1 Mar 2019 02:44:13 +0000 (03:44 +0100)]
bpo-36142: Exclude coreconfig.h from Py_LIMITED_API (GH-12111)

The whole coreconfig.h header is now excluded from Py_LIMITED_API.
Move functions definitions into a new internal pycore_coreconfig.h
header.

* Move Include/coreconfig.h to Include/cpython/coreconfig.h
* coreconfig.h header is now excluded from Py_LIMITED_API
* Move functions to pycore_coreconfig.h

5 years agobpo-29571: Fix test_re.test_locale_flag() (GH-12099)
Victor Stinner [Thu, 28 Feb 2019 23:08:03 +0000 (00:08 +0100)]
bpo-29571: Fix test_re.test_locale_flag() (GH-12099)

Use locale.getpreferredencoding() rather than locale.getlocale() to
get the locale encoding. With some locales, locale.getlocale()
returns the wrong encoding.

For example, on Fedora 29, locale.getlocale() returns ISO-8859-1
encoding for the "en_IN" locale, whereas
locale.getpreferredencoding() reports the correct encoding: UTF-8.

5 years agobpo-36018: Add special value tests and make minor tweaks to the docs (GH-12096)
Raymond Hettinger [Thu, 28 Feb 2019 17:16:25 +0000 (09:16 -0800)]
bpo-36018: Add special value tests and make minor tweaks to the docs (GH-12096)

https://bugs.python.org/issue36018

5 years agoAdd versionadded directives to ssl.minimum_version and ssl.maximum_version (GH-11894)
Zhiming Wang [Thu, 28 Feb 2019 17:15:04 +0000 (01:15 +0800)]
Add versionadded directives to ssl.minimum_version and ssl.maximum_version (GH-11894)

5 years agobpo-36146: Refactor setup.py (GH-12093)
Victor Stinner [Thu, 28 Feb 2019 16:48:38 +0000 (17:48 +0100)]
bpo-36146: Refactor setup.py (GH-12093)

* Rename globals to upper case to better distinguish if a variable is
  global or local:

  * Rename cross_compiling to CROSS_COMPILING
  * Rename host_platform to HOST_PLATFORM
  * Rename disabled_module_list to DISABLED_MODULE_LIST

* Add MS_WINDOWS, CYGWIN and MACOS constants.
* Use booleans: replace "return 0" with "return False"
  and replace "return 1" with "return True"

5 years agoDocument the surprising sideeffect PyErr_Print(). (#12081)
Gregory P. Smith [Wed, 27 Feb 2019 23:27:32 +0000 (15:27 -0800)]
Document the surprising sideeffect PyErr_Print(). (#12081)

Did you know an API documented as printing the pending traceback would sometimes exit the process?

You do now.

5 years agoFix grammar error in timeit module docs (GH-12066)
Shiv Dhar [Wed, 27 Feb 2019 23:21:15 +0000 (04:51 +0530)]
Fix grammar error in timeit module docs (GH-12066)

skip issue
skip news

5 years agoUpdate FAQ to point to Infrastructure Team website. (GH-12077)
Ned Deily [Wed, 27 Feb 2019 22:23:34 +0000 (17:23 -0500)]
Update FAQ to point to Infrastructure Team website. (GH-12077)

5 years agobpo-36096: IDLE: Refactor class variables in colorizer (GH-12002)
Cheryl Sabella [Wed, 27 Feb 2019 13:21:16 +0000 (08:21 -0500)]
bpo-36096: IDLE: Refactor class variables in colorizer (GH-12002)

5 years agobpo-31904: Add cross-build support for VxWorks RTOS (GH-11968)
pxinwr [Wed, 27 Feb 2019 11:09:28 +0000 (19:09 +0800)]
bpo-31904: Add cross-build support for VxWorks RTOS (GH-11968)

5 years agobpo-36123: Fix test_socket.testWithTimeoutTriggeredSend() race condition (GH-12053)
Joannah Nanjekye [Tue, 26 Feb 2019 16:18:23 +0000 (19:18 +0300)]
bpo-36123: Fix test_socket.testWithTimeoutTriggeredSend() race condition (GH-12053)

Use longer timeout for accept() in the server and block on accept in the client.
The client now only sets the timeout once the socket is connected.

5 years agobpo-35652: shutil.copytree(copy_function=...) erroneously pass DirEntry instead of...
Giampaolo Rodola [Tue, 26 Feb 2019 11:04:41 +0000 (12:04 +0100)]
bpo-35652: shutil.copytree(copy_function=...) erroneously pass DirEntry instead of path str (GH-11997)

5 years agocloses bpo-36115: Fix some reference leaks in typeobject.c. (GH-12045)
Benjamin Peterson [Tue, 26 Feb 2019 07:12:10 +0000 (23:12 -0800)]
closes bpo-36115: Fix some reference leaks in typeobject.c. (GH-12045)

a24107b04c1277e3c1105f98aff5bfa3a98b33a0 introduced a few refleaks.

https://bugs.python.org/issue36115

5 years agobpo-36106: Resolve sinpi name clash with libm (IEEE-754 violation). (GH-12027)
Dima Pasechnik [Tue, 26 Feb 2019 06:36:11 +0000 (06:36 +0000)]
bpo-36106: Resolve sinpi name clash with libm (IEEE-754 violation). (GH-12027)

The standard math library (libm) may follow IEEE-754 recommendation to
include an implementation of sinPi(), i.e. sinPi(x):=sin(pi*x).
And this triggers a name clash, found by FreeBSD developer
Steve Kargl, who worken on putting sinpi into libm used on FreeBSD
(it has to be named "sinpi", not "sinPi", cf. e.g.
https://en.cppreference.com/w/c/experimental/fpext4).

5 years agobpo-36109: Fix random test_descr failure. (GH-12044)
Serhiy Storchaka [Tue, 26 Feb 2019 06:03:21 +0000 (08:03 +0200)]
bpo-36109: Fix random test_descr failure. (GH-12044)

5 years agoRun autoreconf.
Benjamin Peterson [Tue, 26 Feb 2019 05:37:59 +0000 (21:37 -0800)]
Run autoreconf.

5 years agocloses bpo-13497: Fix `broken nice` configure test. (GH-12041)
ngie-eign [Tue, 26 Feb 2019 05:34:24 +0000 (21:34 -0800)]
closes bpo-13497: Fix `broken nice` configure test. (GH-12041)

Per POSIX, `nice(3)` requires `unistd.h` and `exit(3)` requires `stdlib.h`.

Fixing the test will prevent false positives with pedantic compilers like clang.

5 years agobpo-24643: Fix "#define timezone _timezone" clashes on Windows (GH-12019)
Zackery Spytz [Mon, 25 Feb 2019 23:56:44 +0000 (16:56 -0700)]
bpo-24643: Fix "#define timezone _timezone" clashes on Windows (GH-12019)

5 years agobpo-36102: Prepend slash to all POSIX shared memory block names (#12036)
Davin Potts [Mon, 25 Feb 2019 22:41:52 +0000 (16:41 -0600)]
bpo-36102: Prepend slash to all POSIX shared memory block names (#12036)

5 years agoClean up code which checked presence of os.{stat,lstat,chmod} (#11643)
Anthony Sottile [Mon, 25 Feb 2019 22:32:27 +0000 (14:32 -0800)]
Clean up code which checked presence of os.{stat,lstat,chmod} (#11643)

5 years agoAutospec functions should propagate mock calls to parent GH-11273
Xtreak [Mon, 25 Feb 2019 21:46:34 +0000 (03:16 +0530)]
Autospec functions should propagate mock calls to parent GH-11273

5 years agobpo-36030: Remove _PyStack_AsTuple() and _PyStack_AsTupleSlice() (GH-12032)
Sergey Fedoseev [Mon, 25 Feb 2019 21:37:26 +0000 (02:37 +0500)]
bpo-36030: Remove _PyStack_AsTuple() and _PyStack_AsTupleSlice() (GH-12032)

5 years agoPost v3.8.0a2
Łukasz Langa [Mon, 25 Feb 2019 20:08:21 +0000 (21:08 +0100)]
Post v3.8.0a2

5 years agoMerge tag 'v3.8.0a2'
Łukasz Langa [Mon, 25 Feb 2019 20:07:31 +0000 (21:07 +0100)]
Merge tag 'v3.8.0a2'

Python 3.8.0a2

5 years agobpo-36030: Add _PyTuple_FromArray() function (GH-11954)
Sergey Fedoseev [Mon, 25 Feb 2019 16:59:12 +0000 (21:59 +0500)]
bpo-36030: Add _PyTuple_FromArray() function (GH-11954)

5 years agoRemove empty Dictionaries section from programming FAQ (GH-12026)
Andre Delfino [Mon, 25 Feb 2019 16:22:07 +0000 (13:22 -0300)]
Remove empty Dictionaries section from programming FAQ (GH-12026)

5 years agobpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)
Serhiy Storchaka [Mon, 25 Feb 2019 15:59:46 +0000 (17:59 +0200)]
bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)

5 years agobpo-28450: Fix and improve the documentation for unknown escapes in RE. (GH-11920)
Serhiy Storchaka [Mon, 25 Feb 2019 15:58:30 +0000 (17:58 +0200)]
bpo-28450: Fix and improve the documentation for unknown escapes in RE. (GH-11920)

5 years agobpo-36048: Use __index__() instead of __int__() for implicit conversion if available...
Serhiy Storchaka [Mon, 25 Feb 2019 15:57:58 +0000 (17:57 +0200)]
bpo-36048: Use __index__() instead of __int__() for implicit conversion if available. (GH-11952)

Deprecate using the __int__() method in implicit conversions of Python
numbers to C integers.

5 years agoCorrect name of 'defaultobj' parameter in PyDict_SetDefault() signature. (GH-11929)
Sergey Fedoseev [Mon, 25 Feb 2019 14:52:40 +0000 (19:52 +0500)]
Correct name of 'defaultobj' parameter in PyDict_SetDefault() signature. (GH-11929)

5 years agov3.8.0a2 v3.8.0a2
Łukasz Langa [Mon, 25 Feb 2019 12:08:32 +0000 (13:08 +0100)]
v3.8.0a2

5 years agocloses bpo-36083: Fix formatting of the manpage Synopsis. (GH-12017)
Miro Hrončok [Mon, 25 Feb 2019 00:50:29 +0000 (01:50 +0100)]
closes bpo-36083: Fix formatting of the manpage Synopsis. (GH-12017)

More specifically, the options of --check-hash-based-pycs.

5 years agobpo-33671: allow setting shutil.copyfile() bufsize globally (GH-12016)
Giampaolo Rodola [Sun, 24 Feb 2019 23:46:40 +0000 (15:46 -0800)]
bpo-33671: allow setting shutil.copyfile() bufsize globally (GH-12016)

5 years agobpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (GH-11617)
Eric Snow [Sun, 24 Feb 2019 23:40:47 +0000 (15:40 -0800)]
bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (GH-11617)

This involves moving the global "pending calls" state to PyInterpreterState.

https://bugs.python.org/issue33608

5 years agobpo-36101: remove non-ascii characters in docstring (GH-12018)
animalize [Sun, 24 Feb 2019 23:18:48 +0000 (07:18 +0800)]
bpo-36101: remove non-ascii characters in docstring (GH-12018)

* remove non-ascii characters in docstring
* clinic.py emits a warning when docstring has non-ascii character

5 years agobpo-36018: Add properties for mean and stdev (GH-12022)
Raymond Hettinger [Sun, 24 Feb 2019 19:44:55 +0000 (11:44 -0800)]
bpo-36018: Add properties for mean and stdev (GH-12022)

Responding to suggestions on the tracker and some off-line suggestions.

Davin suggested that english named accessors instead of greek letters would result in more intelligible user code. Steven suggested that the parameters still need to be *mu* and *theta* which are used elsewhere (and I noted those parameter names are used in linked-to resources).

Michael suggested proving-out the API by seeing whether it generalized to *Lognormal*.  I did so and found that Lognormal distribution parameters *mu* and *sigma*  do not represent the mean and standard deviation of the lognormal distribution (instead, they are for the underlying regular normal distribution).

Putting these ideas together, we have NormalDist parameterized by *mu* and *sigma* but offering English named properties for accessors.  That gives lets us match other API that access mu and sigma, it matches the external resources on the topic, gives us clear english names in user code. The API extends nicely to LogNormal where the parameters and the summary statistic accessors are not the same.

https://bugs.python.org/issue36018

5 years agobpo-35512: Resolve string target to patch.dict decorator during function call GH...
Xtreak [Sun, 24 Feb 2019 18:54:49 +0000 (00:24 +0530)]
bpo-35512: Resolve string target to patch.dict decorator during function call GH#12000

* Resolve string target to patch.dict during function call

* Add NEWS entry

* Remove unneeded call

* Restore original value for support.target and refactor assertions

* Add extra assertion to verify unpatched dict

5 years agobpo-27313: Avoid test_ttk_guionly ComboboxTest fail with macOS Cocoa Tk (GH-12011)
Ned Deily [Sun, 24 Feb 2019 07:28:24 +0000 (02:28 -0500)]
bpo-27313: Avoid test_ttk_guionly ComboboxTest fail with macOS Cocoa Tk (GH-12011)

5 years agobpo-36018: Make __pos__ return a distinct instance of NormDist (GH-12009)
Raymond Hettinger [Sun, 24 Feb 2019 06:19:01 +0000 (22:19 -0800)]
bpo-36018: Make __pos__ return a distinct instance of NormDist (GH-12009)

https://bugs.python.org/issue36018

5 years agobpo-35813: Tests and docs for shared_memory (#11816)
Davin Potts [Sun, 24 Feb 2019 04:08:16 +0000 (22:08 -0600)]
bpo-35813: Tests and docs for shared_memory (#11816)

* Added tests for shared_memory submodule.

* Added tests for ShareableList.

* Fix bug in allocationn size during creation of empty ShareableList illuminated by existing test run on Linux.

* Initial set of docs for shared_memory module.

* Added docs for ShareableList, added doctree entry for shared_memory submodule, name refactoring for greater clarity.

* Added examples to SharedMemoryManager docs, for ease of documentation switched away from exclusively registered functions to some explicit methods on SharedMemoryManager.

* Wording tweaks to docs.

* Fix test failures on Windows.

* Added tests around SharedMemoryManager.

* Documentation tweaks.

* Fix inappropriate test on Windows.

* Further documentation tweaks.

* Fix bare exception.

* Removed __copyright__.

* Fixed typo in doc, removed comment.

* Updated SharedMemoryManager preliminary tests to reflect change of not supporting all registered functions on SyncManager.

* Added Sphinx doctest run controls.

* CloseHandle should be in a finally block in case MapViewOfFile fails.

* Missed opportunity to use with statement.

* Switch to self.addCleanup to spare long try/finally blocks and save one indentation, change to use decorator to skip test instead.

* Simplify the posixshmem extension module.

Provide shm_open() and shm_unlink() functions.  Move other
functionality into the shared_memory.py module.

* Added to doc around size parameter of SharedMemory.

* Changed PosixSharedMemory.size to use os.fstat.

* Change SharedMemory.buf to a read-only property as well as NamedSharedMemory.size.

* Marked as provisional per PEP411 in docstring.

* Changed SharedMemoryTracker to be private.

* Removed registered Proxy Objects from SharedMemoryManager.

* Removed shareable_wrap().

* Removed shareable_wrap() and dangling references to it.

* For consistency added __reduce__ to key classes.

* Fix for potential race condition on Windows for O_CREX.

* Remove unused imports.

* Update access to kernel32 on Windows per feedback from eryksun.

* Moved kernel32 calls to _winapi.

* Removed ShareableList.copy as redundant.

* Changes to _winapi use from eryksun feedback.

* Adopt simpler SharedMemory API, collapsing PosixSharedMemory and WindowsNamedSharedMemory into one.

* Fix missing docstring on class, add test for ignoring size when attaching.

* Moved SharedMemoryManager to managers module, tweak to fragile test.

* Tweak to exception in OpenFileMapping suggested by eryksun.

* Mark a few dangling bits as private as suggested by Giampaolo.

5 years agobpo-24310: Document IDLE settings dialog font tab sample (GH-12007)
Terry Jan Reedy [Sun, 24 Feb 2019 04:04:53 +0000 (23:04 -0500)]
bpo-24310: Document IDLE settings dialog font tab sample (GH-12007)

5 years agofix _abc.c compile error on Cygwin (GH-8445)
E. M. Bray [Sun, 24 Feb 2019 01:30:14 +0000 (02:30 +0100)]
fix _abc.c compile error on Cygwin (GH-8445)

5 years agobpo-36018: Add the NormalDist class to the statistics module (GH-11973)
Raymond Hettinger [Sat, 23 Feb 2019 22:44:07 +0000 (14:44 -0800)]
bpo-36018: Add the NormalDist class to the statistics module (GH-11973)

5 years agobpo-35724: Explicitly require the main interpreter for signal-handling. (GH-11530)
Eric Snow [Sat, 23 Feb 2019 22:40:43 +0000 (15:40 -0700)]
bpo-35724: Explicitly require the main interpreter for signal-handling. (GH-11530)

Ensure that the main interpreter is active (in the main thread) for signal-handling operations. This is increasingly relevant as people use subinterpreters more.

https://bugs.python.org/issue35724

5 years agobpo-1054041: Add What's New docs. (GH-11999)
Gregory P. Smith [Sat, 23 Feb 2019 18:43:49 +0000 (10:43 -0800)]
bpo-1054041: Add What's New docs. (GH-11999)

Add What's New docs about the Ctrl-C improvement. Correct the issue number in the NEWS entry.

5 years agobpo-35886: Make PyInterpreterState an opaque type in the public API. (GH-11731)
Eric Snow [Sat, 23 Feb 2019 18:35:52 +0000 (11:35 -0700)]
bpo-35886: Make PyInterpreterState an opaque type in the public API. (GH-11731)

Move PyInterpreterState into the "internal" header files.

5 years agobpo-36016: Add generation option to gc.getobjects() (GH-11909)
Pablo Galindo [Sat, 23 Feb 2019 03:02:06 +0000 (03:02 +0000)]
bpo-36016: Add generation option to gc.getobjects() (GH-11909)

5 years agobpo-36074: Result of `asyncio.Server.sockets` after `Server.close()` after is not...
Emmanuel Arias [Fri, 22 Feb 2019 17:34:41 +0000 (14:34 -0300)]
bpo-36074: Result of  `asyncio.Server.sockets` after `Server.close()` after  is not clear (GH-11987)

[bpo-36074](https://bugs.python.org/issue36074): It becomes clear on  that the None is still return for server closed.

https://bugs.python.org/issue36074

5 years agobpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)
Stéphane Wirtel [Fri, 22 Feb 2019 13:45:36 +0000 (14:45 +0100)]
bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)

5 years agoInclude the --prompt flag in venv's help output (GH-10711)
Holger Frey [Fri, 22 Feb 2019 11:05:20 +0000 (12:05 +0100)]
Include the --prompt flag in venv's help output (GH-10711)

Document usage of the existing `--prompt` option in the command line help.

5 years agoDoc: Missing backquotes. (GH-11982)
Julien Palard [Fri, 22 Feb 2019 08:22:27 +0000 (09:22 +0100)]
Doc: Missing backquotes. (GH-11982)

5 years agobpo-28235: Fix xml.etree.ElementTree.fromstring docs (GH-11903)
Manjusaka [Fri, 22 Feb 2019 00:33:57 +0000 (08:33 +0800)]
bpo-28235: Fix xml.etree.ElementTree.fromstring docs (GH-11903)

5 years agobpo-35904: Add statistics.fmean() (GH-11892)
Raymond Hettinger [Thu, 21 Feb 2019 23:06:29 +0000 (15:06 -0800)]
bpo-35904: Add statistics.fmean() (GH-11892)

5 years agobpo-36068: Make _tuplegetter objects serializable (GH-11981)
Joe Jevnik [Thu, 21 Feb 2019 21:00:40 +0000 (16:00 -0500)]
bpo-36068: Make _tuplegetter objects serializable (GH-11981)

5 years agobpo-36057 Update docs and tests for ordering in collections.Counter [no behavior...
Raymond Hettinger [Thu, 21 Feb 2019 17:19:00 +0000 (09:19 -0800)]
bpo-36057 Update docs and tests for ordering in collections.Counter [no behavior change] (#11962)

* Add tests for Counter order.  No behavior change.

* Update docs and tests

* Fix doctest output and capitalization

5 years agobpo-36060: Document how collections.ChainMap() determines iteration order (GH-11969)
Raymond Hettinger [Thu, 21 Feb 2019 17:12:15 +0000 (09:12 -0800)]
bpo-36060: Document how collections.ChainMap() determines iteration order (GH-11969)

5 years agoDocument other performance implication for __slots__ (GH-11974)
Raymond Hettinger [Thu, 21 Feb 2019 11:34:04 +0000 (03:34 -0800)]
Document other performance implication for __slots__ (GH-11974)

5 years agobpo-36052: Raise a SyntaxError when assigning a value to __debug__ with := (GH-11958)
Stéphane Wirtel [Thu, 21 Feb 2019 10:11:53 +0000 (11:11 +0100)]
bpo-36052: Raise a SyntaxError when assigning a value to __debug__ with := (GH-11958)

Trying to assign a value to __debug__ using the assignment operator is supposed to fail, but
a missing check for forbidden names when setting the context in the ast was preventing this behaviour.

5 years agobpo-36063: Minor performance tweak in long_divmod(). (GH-11915)
Sergey Fedoseev [Thu, 21 Feb 2019 10:01:11 +0000 (15:01 +0500)]
bpo-36063: Minor performance tweak in long_divmod(). (GH-11915)

5 years agobpo-36059: Update OrderedDict() docs to reflect that regular dicts are now ordered...
Raymond Hettinger [Thu, 21 Feb 2019 08:05:30 +0000 (00:05 -0800)]
bpo-36059: Update OrderedDict() docs to reflect that regular dicts are now ordered (GH-11966)

5 years agoDoc: fix example for iter() function. (GH-11959)
Cristian Ciupitu [Thu, 21 Feb 2019 07:53:06 +0000 (09:53 +0200)]
Doc: fix example for iter() function. (GH-11959)

read() returns bytes for a file opened in binary mode,
so b'' should be used as a sentinel instead of ''.
Otherwise the loop will be infinite.

5 years agobpo-33989: Ensure that ms.key_compare is always initialized in list_sort_impl()....
Zackery Spytz [Thu, 21 Feb 2019 07:47:14 +0000 (00:47 -0700)]
bpo-33989: Ensure that ms.key_compare is always initialized in list_sort_impl(). (GH-8710)

5 years agobpo-36062: Minor speed-up for list slicing and copying. (GH-11967)
Sergey Fedoseev [Thu, 21 Feb 2019 06:51:52 +0000 (11:51 +0500)]
bpo-36062: Minor speed-up for list slicing and copying. (GH-11967)

5 years agoRe-init _Py_UnhandledKeyboardInterrupt before run. (GH-11963)
Gregory P. Smith [Thu, 21 Feb 2019 01:35:54 +0000 (17:35 -0800)]
Re-init _Py_UnhandledKeyboardInterrupt before run. (GH-11963)

Explicitly reinitialize this every eval *just in case* someone is
calling into an embedded Python where they don't care about an uncaught
KeyboardInterrupt exception (why didn't they leave
`config.install_signal_handlers` set to `0`?!?) but then later call
`Py_Main()` itself (which *checks* this flag and dies with a signal after
its interpreter exits).  We don't want a previous embedded interpreter's
uncaught exception to trigger an unexplained signal exit from a future
`Py_Main()` based one.

5 years agobpo-31982: Improve sequence of presentation in ChainMap docs (GH-11960)
Raymond Hettinger [Wed, 20 Feb 2019 21:49:23 +0000 (13:49 -0800)]
bpo-31982: Improve sequence of presentation in ChainMap docs (GH-11960)

https://bugs.python.org/issue31982

5 years agobpo-36012: Avoid linear slot search for non-dunder methods (GH-11907)
Stefan Behnel [Wed, 20 Feb 2019 17:29:24 +0000 (18:29 +0100)]
bpo-36012: Avoid linear slot search for non-dunder methods (GH-11907)

5 years agobpo-35993: Fix _PyInterpreterState_DeleteExceptMain() (GH-11852)
Stéphane Wirtel [Wed, 20 Feb 2019 14:27:22 +0000 (15:27 +0100)]
bpo-35993: Fix _PyInterpreterState_DeleteExceptMain() (GH-11852)

 Fix a crash on fork when using subinterpreters.

5 years agobpo-12822: use monotonic clock for condvar if possible (GH-11723)
Inada Naoki [Wed, 20 Feb 2019 01:00:09 +0000 (10:00 +0900)]
bpo-12822: use monotonic clock for condvar if possible (GH-11723)

5 years agobpo-36049: Fix compiler warning in Python/ast.c (GH-11949)
Pablo Galindo [Tue, 19 Feb 2019 22:51:53 +0000 (22:51 +0000)]
bpo-36049: Fix compiler warning in Python/ast.c (GH-11949)

5 years agobpo-35584: Clarify role of caret in a class class (GH-11946)
Raymond Hettinger [Tue, 19 Feb 2019 19:32:18 +0000 (11:32 -0800)]
bpo-35584: Clarify role of caret in a class class (GH-11946)

https://bugs.python.org/issue35584

5 years agobpo-36037: Fix test_ssl for strict OpenSSL policy (GH-11940)
Victor Stinner [Tue, 19 Feb 2019 17:06:03 +0000 (18:06 +0100)]
bpo-36037: Fix test_ssl for strict OpenSSL policy (GH-11940)

Fix test_ssl for strict OpenSSL configuration like RHEL8 strict crypto policy.
Use older TLS version for minimum TLS version of the server SSL context if
needed, to test TLS version older than default minimum TLS version.

5 years agobpo-35153: Add headers parameter to xmlrpc.client.ServerProxy (GH-10308)
Cédric Krier [Tue, 19 Feb 2019 16:18:50 +0000 (17:18 +0100)]
bpo-35153: Add headers parameter to xmlrpc.client.ServerProxy (GH-10308)

Allow to add HTTP headers to XML-RPC requests sent to the server.

5 years agoDoc: Fix typo. (GH-11315)
Julien Palard [Tue, 19 Feb 2019 14:46:07 +0000 (15:46 +0100)]
Doc: Fix typo. (GH-11315)

From: https://mail.python.org/pipermail/docs/2018-December/038583.html

5 years agobpo-31506: Clarify error messages for object.__new__ and object.__init__ (GH-11641)
Sanyam Khurana [Tue, 19 Feb 2019 13:23:48 +0000 (18:53 +0530)]
bpo-31506: Clarify error messages for object.__new__ and object.__init__ (GH-11641)

`object.__new__` and `object.__init__` do take one argument each,
they just don't take extra user supplied arguments.

Patch by Sanyam Khurana.

5 years agoFix a misnamed test for lists. (GH-11933)
Serhiy Storchaka [Tue, 19 Feb 2019 11:53:07 +0000 (13:53 +0200)]
Fix a misnamed test for lists. (GH-11933)

5 years agoFix syntax warnings in tests introduced in bpo-35942. (GH-11934)
Serhiy Storchaka [Tue, 19 Feb 2019 11:52:35 +0000 (13:52 +0200)]
Fix syntax warnings in tests introduced in bpo-35942. (GH-11934)

5 years agoFix syntax warnings in tests introduced in bpo-15248. (GH-11932)
Serhiy Storchaka [Tue, 19 Feb 2019 11:49:09 +0000 (13:49 +0200)]
Fix syntax warnings in tests introduced in bpo-15248. (GH-11932)

5 years agobpo-35798: Add test.support.check_syntax_warning(). (#11895)
Serhiy Storchaka [Tue, 19 Feb 2019 06:30:15 +0000 (08:30 +0200)]
bpo-35798: Add test.support.check_syntax_warning(). (#11895)

It checks that a SyntaxWarning is raised when compile specified
statement, that it is raised only once, that it is converted to
a SyntaxError when raised as exception, and that both warning and
exception objects have corresponding attributes.

5 years agobpo-35689: IDLE: Add docstrings and unittests for colorizer.py (GH-11472)
Cheryl Sabella [Tue, 19 Feb 2019 05:11:18 +0000 (00:11 -0500)]
bpo-35689: IDLE: Add docstrings and unittests for colorizer.py (GH-11472)

5 years agobpo-34572: change _pickle unpickling to use import rather than retrieving from sys...
tjb900 [Mon, 18 Feb 2019 15:30:51 +0000 (23:30 +0800)]
bpo-34572: change _pickle unpickling to use import rather than retrieving from sys.modules (GH-9047)

Fix C implementation of pickle.loads to use importlib's locking mechanisms, and thereby avoid using partially-loaded modules.

5 years agobpo-34294: re module, fix wrong capturing groups in rare cases. (GH-11546)
animalize [Mon, 18 Feb 2019 13:26:37 +0000 (21:26 +0800)]
bpo-34294: re module, fix wrong capturing groups in rare cases. (GH-11546)

Need to reset capturing groups between two SRE(match) callings in loops, this fixes wrong capturing groups in rare cases.

Also add a missing index in re.rst.

5 years agobpo-35704: Include correct NEWS entry (GH-11914)
Nick Coghlan [Mon, 18 Feb 2019 11:23:36 +0000 (21:23 +1000)]
bpo-35704: Include correct NEWS entry (GH-11914)

The wrong NEWS snippet was inadvertently included in
GH-11500, this switches to the correct one.

https://bugs.python.org/issue35704

5 years agobpo-35704: Prevent test_shutil fail result when AIX is 32-bit and MAXDATA < 0x2000000...
Michael Felt [Mon, 18 Feb 2019 11:02:44 +0000 (12:02 +0100)]
bpo-35704: Prevent test_shutil fail result when AIX is 32-bit and MAXDATA < 0x20000000 (GH-11500)

https://bugs.python.org/issue35704

5 years agobpo-35942: Improve the error message if __fspath__ returns invalid types in path_conv...
Pablo Galindo [Mon, 18 Feb 2019 10:46:34 +0000 (10:46 +0000)]
bpo-35942: Improve the error message if __fspath__ returns invalid types in path_converter (GH-11831)

The error message emitted when returning invalid types from __fspath__ in interfaces that allow passing PathLike objects has been improved and now it does explain the origin of the error.

5 years agobpo-35992: Use PySequence_GetItem only if sq_item is not NULL (GH-11857)
Ivan Levkivskyi [Sun, 17 Feb 2019 23:13:46 +0000 (23:13 +0000)]
bpo-35992: Use PySequence_GetItem only if sq_item is not NULL (GH-11857)

Not using `__class_getitem__()` fallback if there is a non-subcriptable metaclass was caused by a certain asymmetry between how `PySequenceMethods` and `PyMappingMethods` are used in `PyObject_GetItem`. This PR removes this asymmetry. No tests failed, so I assume it was not intentional.

5 years agobpo-34720: Fix test_importlib.test_bad_traverse for AIX (GH-9391)
Michael Felt [Sun, 17 Feb 2019 12:02:56 +0000 (13:02 +0100)]
bpo-34720: Fix test_importlib.test_bad_traverse for AIX (GH-9391)

Fix  Modules/_testmultiphase.c so that it exits with non-zero status on AIX just as other systems do (non zero exit status, e.g. as result of a segmentation fault) when a NULL pointer is accessed for data.

https://bugs.python.org/issue34720

5 years agobpo-36013: delete fragile interactive shell SIGINT test (GH-11902)
Gregory P. Smith [Sun, 17 Feb 2019 01:22:39 +0000 (17:22 -0800)]
bpo-36013: delete fragile interactive shell SIGINT test (GH-11902)

It makes the existing smaller test more readable and robust at the same time.

The execution of a shell in interactive mode from CI and buildbot test automation wasn't working out.  What would work locally in our terminals would only work within a fraction of automation systems.  The integration test was a nice to have.  painful.  deleting. :)

5 years agoConvert range to repeat for choices() (#11889)
Raymond Hettinger [Sat, 16 Feb 2019 21:30:51 +0000 (13:30 -0800)]
Convert range to repeat for choices() (#11889)

5 years agobpo-1054041: Exit properly after an uncaught ^C. (#11862)
Gregory P. Smith [Sat, 16 Feb 2019 20:57:40 +0000 (12:57 -0800)]
bpo-1054041: Exit properly after an uncaught ^C. (#11862)

* bpo-1054041: Exit properly by a signal after a ^C.

An uncaught KeyboardInterrupt exception means the user pressed ^C and
our code did not handle it.  Programs that install SIGINT handlers are
supposed to reraise the SIGINT signal to the SIG_DFL handler in order
to exit in a manner that their calling process can detect that they
died due to a Ctrl-C.  https://www.cons.org/cracauer/sigint.html

After this change on POSIX systems

 while true; do python -c 'import time; time.sleep(23)'; done

can be stopped via a simple Ctrl-C instead of the shell infinitely
restarting a new python process.

What to do on Windows, or if anything needs to be done there has not
yet been determined.  That belongs in its own PR.

TODO(gpshead): A unittest for this behavior is still needed.

* Do the unhandled ^C check after pymain_free.

* Return STATUS_CONTROL_C_EXIT on Windows.

* Fix ifdef around unistd.h include.

* 📜🤖 Added by blurb_it.

* Add STATUS_CTRL_C_EXIT to the os module on Windows

* Add unittests.

* Don't send CTRL_C_EVENT in the Windows test.

It was causing CI systems to bail out of the entire test suite.

See https://dev.azure.com/Python/cpython/_build/results?buildId=37980
for example.

* Correct posix test (fail on macOS?) check.

* STATUS_CONTROL_C_EXIT must be unsigned.

* Improve the error message.

* test typo :)

* Skip if the bash version is too old.

...and rename the windows test to reflect what it does.

* min bash version is 4.4, detect no bash.

* restore a blank line i didn't mean to delete.

* PyErr_Occurred() before the Py_DECREF(co);

* Don't add os.STATUS_CONTROL_C_EXIT as a constant.

* Update the Windows test comment.

* Refactor common logic into a run_eval_code_obj fn.

5 years ago bpo-35884: Add missing FIFO queue benchmark (GH-11898)
Raymond Hettinger [Sat, 16 Feb 2019 20:51:02 +0000 (12:51 -0800)]
 bpo-35884: Add missing FIFO queue benchmark (GH-11898)

https://bugs.python.org/issue35884

5 years agobpo-33234: Add another attribution in Whatsnew (GH-11899)
Raymond Hettinger [Sat, 16 Feb 2019 20:47:48 +0000 (12:47 -0800)]
bpo-33234: Add another attribution in Whatsnew (GH-11899)

https://bugs.python.org/issue33234

5 years agobpo-32492: Add missing whatsnew entries for itemgetter and namedtuple (GH-11897)
Raymond Hettinger [Sat, 16 Feb 2019 20:02:22 +0000 (12:02 -0800)]
bpo-32492: Add missing whatsnew entries for itemgetter and namedtuple (GH-11897)

https://bugs.python.org/issue32492