Commit Graph

1562 Commits

Author SHA1 Message Date
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 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
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
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
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
Paul Monson 8a1657b934 bpo-35976: Enable Windows projects to build with platform ARM32 (GH-11825)
This change adds the necessary items to the build projects to avoid erroring out right at the start. It does not add _support_ for targeting Windows on ARM32, but is a necessary prerequisite for adding it.
2019-02-14 08:31:30 -08:00
Zackery Spytz bb3c05d7ef closes bpo-35991: Fix a potential double free in Modules/_randommodule.c. (GH-11849) 2019-02-13 23:43:17 -08:00
Susan Su 2bdd5858e3 bpo-35500: align expected and actual calls on mock.assert_called_with error message. (GH-11804) 2019-02-13 18:22:29 -08:00
Victor Stinner dcb68f47f7
bpo-35961: Fix a crash in slice_richcompare() (GH-11830)
Fix a crash in slice_richcompare(): use strong references rather than
stolen references for the two temporary internal tuples.

The crash (or assertion error) occurred if a garbage collection
occurred during slice_richcompare(), especially while calling
PyObject_RichCompare(t1, t2, op).
2019-02-13 12:31:56 +01:00
Cheryl Sabella 5680f6546d bpo-18283: Add support for bytes to shutil.which (GH-11818) 2019-02-13 12:25:10 +01:00
Matěj Cepl 3dc67d0316 bpo-35505: Skip test_imap4_host_default_value if localhost listens on IMAP port (GH-11823)
Make test_imap4_host_default_value independent on whether the 
local IMAP server is running.
2019-02-12 19:30:19 +01:00
Christopher Hunt b01786c881 bpo-35960: Fix dataclasses.field throwing away empty metadata. (GH-11815) 2019-02-12 06:50:49 -05:00
Rémi Lapeyre a31f4cc881 bpo-35918: Remove broken has_key method and add test (#11819) 2019-02-11 16:37:24 -08:00
Pablo Galindo 3766f18c52
bpo-35378: Fix multiprocessing.Pool references (GH-11627)
Changes in this commit:

1. Use a _strong_ reference between the Pool and associated iterators
2. Rework PR #8450 to eliminate a cycle in the Pool.

There is no test in this commit because any test that automatically tests this behaviour needs to eliminate the pool before joining the pool to check that the pool object is garbaged collected/does not hang. But doing this will potentially leak threads and processes (see https://bugs.python.org/issue35413).
2019-02-11 17:29:00 +00:00
Eivind Teig 537b6caa56 bpo-22062: Updated docstring and documentation for pathlib (GH-8519)
Original patch by Mike Short


https://bugs.python.org/issue22062
2019-02-11 02:47:09 -08:00
Terry Jan Reedy 8a03ff2ff4
bpo-35833: Revise IDLE doc for control codes sent to Shell. (GH-11799)
Add  a code example block.
2019-02-08 22:51:51 -05:00
Fish 96d37dbcd2 bpo-35615: Fix crashes when copying a Weak{Key,Value}Dictionary. (GH-11384)
Protect dict iterations by wrapping them with _IterationGuard in the
following methods:

- WeakValueDictionary.copy()
- WeakValueDictionary.__deepcopy__()
- WeakKeyDictionary.copy()
- WeakKeyDictionary.__deepcopy__()
2019-02-07 19:51:59 +00:00
Pierre Glaser df8d2cde63 bpo-35911: add cell constructor (GH-11771)
Add a cell constructor, expose the cell type in the types module.
2019-02-07 19:36:48 +00:00
Jason R. Coombs f289084c83
bpo-24209: In http.server script, rely on getaddrinfo to bind to preferred address based on the bind parameter. (#11767)
In http.server script, rely on getaddrinfo to bind to preferred address based on the bind parameter.

As a result, now IPv6 is used as the default (including IPv4 on dual-stack systems). Enhanced tests.
2019-02-07 08:22:45 -05:00
Giampaolo Rodola 2848d9d299 bpo-35917: Test multiprocessing manager classes and shareable types (GH-11772)
multiprocessing: provide unittests for manager classes and shareable types
2019-02-07 11:03:11 +00:00
Pablo Galindo bc09851586 bpo-35606: Implement math.prod (GH-11359) 2019-02-06 23:04:02 -08:00
Steve Dower 85e102a2b0
bpo-35299: Fixed sysconfig and distutils during PGO profiling (GH-11744) 2019-02-04 17:15:13 -08:00
Nina Zakharenko 69091cb497 bpo-35321: Set the spec origin to frozen in frozen modules (#11732)
* bpo-35321: Set the spec origin to frozen in frozen modules

This fix correctly sets the spec origin to
"frozen" for the _frozen_importlib module. Note that the
origin was already correctly set in _frozen_importlib_external.

* 📜🤖 Added by blurb_it.
2019-02-04 16:56:26 -08:00
Paul Ganssle 89427cd0fe bpo-32417: Make timedelta arithmetic respect subclasses (#10902)
* Make timedelta return subclass types

Previously timedelta would always return the `date` and `datetime`
types, regardless of what it is added to. This makes it return
an object of the type it was added to.

* Add tests for timedelta arithmetic on subclasses

* Make pure python timedelta return subclass types

* Add test for fromtimestamp with tz argument

* Add tests for subclass behavior in now

* Add news entry.

Fixes:
bpo-32417
bpo-35364

* More descriptive variable names in tests

Addresses Victor's comments
2019-02-04 14:42:04 -05:00
Łukasz Langa e7afe1ab25 Python 3.8.0a1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAlxW66AACgkQsmmV4xAl
 BWh3QQ//ZMI2a0KicKZ/MTnaW0cpTSQ5MoikOVL98z1Mx2MGDm5k5pzxN7E4qT39
 WPcnUJyK6o6juigq49qwpufaHRDhn/FoscFpQgTwf4POw23f6OB6karzV6xijOW7
 AoxjqKs7QhjIifAsxe76c4KzpR85tUgxJGsN4KHC6hwAbkri5HQ0372bjg+dkis1
 nmjnDwf6ZkzwtNqOwP5aAnm5z6XWXngQk1BHL1xG+ECXeAYTWEHbgjMlJpsc/28E
 rPDeL08BYiJYLuOghV71Yq3T1FSHicLwwKt0+Q61zBGsjwrEmqfRZpB4oOrr65Ca
 0QdqYbNwm9hkfp3/XnNV+JwBnBLJsd+vzEz3Lcu/hPb7YMAD7DMIrIeG6zVHVVEo
 9edurimM8w5QsmHyGFgVVEh4qImiGgmYSDFrU3l/u3SXjnSLnNJM2dGLMSmJ6N14
 komPeq4vg0daPqRPTbWHTZvjt7aidAJlSzrmjg45KOgv6TdJq8X/Sm/v70zopaXL
 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NATURE-----

Merge tag 'v3.8.0a1'

Python 3.8.0a1
2019-02-04 09:30:59 +01:00
Steve Dower a8474d025c
bpo-35872 and bpo-35873: Clears __PYVENV_LAUNCHER__ variable (GH-11745)
After reading __PYVENV_LAUNCHER__ we now set sys._base_executable value for later use.
Make the same changes for macOS to avoid extra platform checks.
2019-02-03 23:19:38 -08:00
Steve Dower 2f6fae6e51
bpo-35692: pathlib no longer raises when checking file and directory existence on drives that are not ready (GH-11746) 2019-02-03 23:08:18 -08:00
Łukasz Langa 8efa3b69f6
[blurb] v3.8.0a1 2019-02-03 14:02:52 +01:00
Raymond Hettinger f75d59e1a8
bpo-35884: Add variable access benchmarking script (GH-11725) 2019-02-02 22:54:56 -08:00
Minmin Gong 8ebc6451f3 bpo-35890 : Fix some API calling consistency (GH-11742)
Unicode version of Windows APIs are used in places, but not for GetVersionEx in Python/sysmodule.c
The wcstok_s is called on Windows in Modules/main.c and PC/launcher.c, but not in Python/pathconfig.c
2019-02-02 20:26:55 -08:00
Steve Dower 4c70d9f79c
bpo-34691: Compile _contextvars module into main Python library (GH-11741) 2019-02-02 14:36:23 -08:00
Mark Becwar b82bfac436 bpo-29734: nt._getfinalpathname handle leak (GH-740)
Make sure that failure paths call CloseHandle outside of the function that failed
2019-02-02 13:08:23 -08:00
Shiva Saxena cb09047626 bpo-32560: inherit the py launcher's STARTUPINFO (GH-9000)
https://bugs.python.org/issue32560
2019-02-02 11:21:04 -08:00
Stefan Krah d08ea70464
bpo-35845: Add order={'C', 'F', 'A'} parameter to memoryview.tobytes(). (#11730) 2019-02-02 18:57:41 +01:00
Tony Roberts 4860f01ac0 bpo-33895: Relase GIL while calling functions that acquire Windows loader lock (GH-7789)
LoadLibrary, GetProcAddress, FreeLibrary and GetModuleHandle acquire the system loader lock. Calling these while holding the GIL will cause a deadlock on the rare occasion that another thread is detaching and needs to destroy its thread state at the same time.
2019-02-02 09:16:42 -08:00
Tzu-ping Chung 2de576e16d bpo-1104: msilib.SummaryInfo.GetProperty() truncates the string by one character (GH-4517)
Add one char to MsiSummaryInfoGetProperty() output
Based on the patch in bpo-1104 by Anthony Tuininga (atuining) and Mark McMahon (markm).
2019-02-02 09:13:23 -08:00
native-api 05e922136a bpo-33316: PyThread_release_lock always fails (GH-6541)
Use correct interpretation of return value from APIs.
2019-02-02 08:22:55 -08:00
Davin Potts e5ef45b8f5
bpo-35813: Added shared_memory submodule of multiprocessing. (#11664)
Added shared_memory submodule to multiprocessing in time for first alpha with cross-platform tests soon to follow.
2019-02-01 22:52:23 -06:00
Xtreak d4fceaafb8 bpo-35877: Make parenthesis optional for named expression in while statement (GH-11724)
* Add parenthesis optional in named expressions for while statement

* Add NEWS entry
2019-02-01 14:40:16 -07:00
Joannah Nanjekye 80c5dfe74b bpo-35537: Add setsid parameter to os.posix_spawn() and os.posix_spawnp() (GH-11608) 2019-02-01 11:05:22 +01:00
Guido van Rossum dcfcd146f8 bpo-35766: Merge typed_ast back into CPython (GH-11645) 2019-01-31 12:40:27 +01:00