Commit Graph

103597 Commits

Author SHA1 Message Date
Raymond Hettinger 47d9987247
bpo-35904: Add statistics.fmean() (GH-11892) 2019-02-21 15:06:29 -08:00
Joe Jevnik f36f89257b bpo-36068: Make _tuplegetter objects serializable (GH-11981) 2019-02-21 13:00:40 -08:00
Raymond Hettinger 407c734326
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
2019-02-21 09:19:00 -08:00
Raymond Hettinger 86f093f71a
bpo-36060: Document how collections.ChainMap() determines iteration order (GH-11969) 2019-02-21 09:12:15 -08:00
Raymond Hettinger 7463884f69 Document other performance implication for __slots__ (GH-11974) 2019-02-21 03:34:04 -08:00
Stéphane Wirtel 3ad9167305 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.
2019-02-21 10:11:53 +00:00
Sergey Fedoseev ea6207d593 bpo-36063: Minor performance tweak in long_divmod(). (GH-11915) 2019-02-21 12:01:11 +02:00
Raymond Hettinger 49fd6dd887
bpo-36059: Update OrderedDict() docs to reflect that regular dicts are now ordered (GH-11966) 2019-02-21 00:05:30 -08:00
Cristian Ciupitu 11fa0e48a9 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.
2019-02-21 09:53:06 +02:00
Zackery Spytz ebc793d6ac bpo-33989: Ensure that ms.key_compare is always initialized in list_sort_impl(). (GH-8710) 2019-02-21 09:47:14 +02:00
Sergey Fedoseev ef1b88bf57 bpo-36062: Minor speed-up for list slicing and copying. (GH-11967) 2019-02-21 08:51:52 +02:00
Gregory P. Smith d9bc543cbb
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.
2019-02-20 17:35:54 -08:00
Raymond Hettinger 9b0c681e2d bpo-31982: Improve sequence of presentation in ChainMap docs (GH-11960)
https://bugs.python.org/issue31982
2019-02-20 13:49:23 -08:00
Stefan Behnel d8b9e1fc2e bpo-36012: Avoid linear slot search for non-dunder methods (GH-11907) 2019-02-20 09:29:24 -08:00
Stéphane Wirtel b5409dacc4 bpo-35993: Fix _PyInterpreterState_DeleteExceptMain() (GH-11852)
Fix a crash on fork when using subinterpreters.
2019-02-20 15:27:22 +01:00
Inada Naoki 001fee14e0
bpo-12822: use monotonic clock for condvar if possible (GH-11723) 2019-02-20 10:00:09 +09:00
Pablo Galindo 46a97920fe
bpo-36049: Fix compiler warning in Python/ast.c (GH-11949) 2019-02-19 22:51:53 +00:00
Raymond Hettinger 3bacf61265 bpo-35584: Clarify role of caret in a class class (GH-11946)
https://bugs.python.org/issue35584
2019-02-19 11:32:18 -08:00
Victor Stinner 3ef6344ee5
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.
2019-02-19 18:06:03 +01:00
Cédric Krier beda52ed36 bpo-35153: Add headers parameter to xmlrpc.client.ServerProxy (GH-10308)
Allow to add HTTP headers to XML-RPC requests sent to the server.
2019-02-19 17:18:50 +01:00
Julien Palard 513e9b4425 Doc: Fix typo. (GH-11315)
From: https://mail.python.org/pipermail/docs/2018-December/038583.html
2019-02-19 06:46:07 -08:00
Sanyam Khurana 5105483acb 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.
2019-02-19 23:23:48 +10:00
Serhiy Storchaka f522a57ec7
Fix a misnamed test for lists. (GH-11933) 2019-02-19 13:53:07 +02:00
Serhiy Storchaka 8d01eb49fc
Fix syntax warnings in tests introduced in bpo-35942. (GH-11934) 2019-02-19 13:52:35 +02:00
Serhiy Storchaka 8e79e6e56f
Fix syntax warnings in tests introduced in bpo-15248. (GH-11932) 2019-02-19 13:49:09 +02:00
Serhiy Storchaka e7a4bb554e
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.
2019-02-19 08:30:15 +02:00
Cheryl Sabella ee0f927bd8 bpo-35689: IDLE: Add docstrings and unittests for colorizer.py (GH-11472) 2019-02-19 00:11:18 -05:00
tjb900 4371c0a9c0 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.
2019-02-18 15:30:51 +00:00
animalize 4a7f44a2ed 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.
2019-02-18 15:26:37 +02:00
Nick Coghlan 02c04f26df 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
2019-02-18 03:23:36 -08:00
Michael Felt ef110b1807 bpo-35704: Prevent test_shutil fail result when AIX is 32-bit and MAXDATA < 0x20000000 (GH-11500)
https://bugs.python.org/issue35704
2019-02-18 03:02:44 -08:00
Pablo Galindo 09fbcd6085
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.
2019-02-18 10:46:34 +00:00
Ivan Levkivskyi ac28147e78
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.
2019-02-17 23:13:46 +00:00
Michael Felt 1bf8845f74 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
2019-02-17 04:02:56 -08:00
Gregory P. Smith 414c625a7e
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. :)
2019-02-16 17:22:39 -08:00
Raymond Hettinger 5382203ae1
Convert range to repeat for choices() (#11889) 2019-02-16 13:30:51 -08:00
Gregory P. Smith 38f11cc3f6
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.
2019-02-16 12:57:40 -08:00
Raymond Hettinger 43766f82dd bpo-35884: Add missing FIFO queue benchmark (GH-11898)
https://bugs.python.org/issue35884
2019-02-16 12:51:02 -08:00
Raymond Hettinger e182318e6a bpo-33234: Add another attribution in Whatsnew (GH-11899)
https://bugs.python.org/issue33234
2019-02-16 12:47:48 -08:00
Raymond Hettinger 63fa1cfece bpo-32492: Add missing whatsnew entries for itemgetter and namedtuple (GH-11897)
https://bugs.python.org/issue32492
2019-02-16 12:02:22 -08:00
Raymond Hettinger 3ff5962d2e bpo-33089: Add math.dist() and math.hypot() to Whatsnew (GH-11896)
https://bugs.python.org/issue33089
2019-02-16 11:00:42 -08:00
Serhiy Storchaka 4583525835
bpo-35798: Fix duplicate SyntaxWarning: "is" with a literal. (GH-11639) 2019-02-16 08:29:46 +02:00
Serhiy Storchaka 62e4481238
bpo-15248: Emit a compiler warning when missed a comma before tuple or list. (GH-11757) 2019-02-16 08:12:19 +02:00
Anthony Sottile a16ab00c0b bpo-36007: Bump minimum sphinx version to 1.8 (GH-11887)
https://bugs.python.org/issue36007
2019-02-15 15:41:15 -08:00
Alexey Izbyshev 36433221f0 bpo-35984: _xxsubinterpreters: Fix memory leak in _channel_send() (GH-11845)
https://bugs.python.org/issue35984
2019-02-15 14:28:58 -08:00
Daniel Hahler 4327705cfa bpo-35931: Gracefully handle SyntaxError in pdb debug command (GH-11782)
Previously, `debug print(` would cause the interpreter to exit on a SyntaxError whereas `print(` would properly display the error and return to the pdb prompt.

This patch fixes this by pre-compiling the code before passing it to `Pdb.run`.


https://bugs.python.org/issue35931
2019-02-15 12:52:53 -08:00
Raymond Hettinger 9abb725cea Improve readability of random module examples (GH-11884)
Based on reviewer feedback from Allen Downey, convert ``lambda`` to ``def``.
2019-02-15 12:40:18 -08:00
Jack Wilsdon 903567e4f5 Fix the versionadded info for typing.NoReturn (GH-11880)
The earliest version that `typing.NoReturn` appears in is [3.5.4rc1](https://docs.python.org/3/whatsnew/changelog.html#python-3-5-4-release-candidate-1)
2019-02-15 11:20:28 -08:00
Emmanuel Arias 522630a746 bpo-36006: Fix versionchanged directive alignment in io module documentation (GH-11881)
https://bugs.python.org/issue36006
2019-02-15 11:02:38 -08:00
Victor Stinner 355f16fd4b
bpo-35746: Credit Colin Read and Nicolas Edet (GH-11863)
Add credit for the cert parser vulnerability. Mention also Cisco
TALOS-2018-0758 identifier.
2019-02-15 12:25:47 +01:00