Commit Graph

2311 Commits

Author SHA1 Message Date
Victor Stinner 96b4087ce7
bpo-37140: Fix StructUnionType_paramfunc() (GH-15612)
Fix a ctypes regression of Python 3.8. When a ctypes.Structure is
passed by copy to a function, ctypes internals created a temporary
object which had the side effect of calling the structure finalizer
(__del__) twice. The Python semantics requires a finalizer to be
called exactly once. Fix ctypes internals to no longer call the
finalizer twice.

Create a new internal StructParam_Type which is only used by
_ctypes_callproc() to call PyMem_Free(ptr) on Py_DECREF(argument).
StructUnionType_paramfunc() creates such object.
2019-08-30 14:30:33 +02:00
Ned Deily 7fcc2088a5 bpo-37834: Prevent shutil.rmtree exception (GH-15602)
when built on non-Windows system without fd system call support,
like older versions of macOS.
2019-08-29 23:20:03 +02:00
Raymond Hettinger 88ea166dad
bpo-8425: Fast path for set inplace difference when the second set is large (GH-15590) 2019-08-29 09:02:58 -07:00
Rémi Lapeyre 4901fe274b bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593) 2019-08-29 17:49:08 +03:00
Paul Ganssle 59725f3bad bpo-37979: Add alternative to fromisoformat in documentation (GH-15596)
Adds a link to `dateutil.parser.isoparse` in the documentation.

It would be nice to set up intersphinx for things like this, but I think we can leave that for a separate PR.

CC: @pitrou 

[bpo-37979](https://bugs.python.org/issue37979)


https://bugs.python.org/issue37979



Automerge-Triggered-By: @pitrou
2019-08-29 07:47:48 -07:00
Joannah Nanjekye 2c5fb17118 bpo-36833: Add tests for Datetime C API Macros (GH-14842)
Added tests for PyDateTime_xxx_GET_xxx() macros of the C API of
the datetime module.
2019-08-29 14:54:46 +02:00
Raymond Hettinger 35f6301d68
bpo-10978: Semaphores can release multiple threads at a time (GH-15588) 2019-08-29 01:45:19 -07:00
Justin Blanchard 122376df55 bpo-37372: Fix error unpickling datetime.time objects from Python 2 with seconds>=24. (GH-14307) 2019-08-29 10:36:15 +03:00
Serhiy Storchaka e64f948e76
bpo-37950: Fix ast.dump() when call with incompletely initialized node. (GH-15510) 2019-08-29 09:30:23 +03:00
Serhiy Storchaka b235a1b473
bpo-37960: Silence only necessary errors in repr() of buffered and text streams. (GH-15543) 2019-08-29 09:25:22 +03:00
Xtreak c96127821e bpo-36871: Ensure method signature is used when asserting mock calls to a method (GH13261)
* Fix call_matcher for mock when using methods

* Add NEWS entry

* Use None check and convert doctest to unittest

* Use better name for mock in tests. Handle _SpecState when the attribute was not accessed and add tests.

* Use reset_mock instead of reinitialization. Change inner class constructor signature for check

* Reword comment regarding call object lookup logic
2019-08-29 07:09:01 +01:00
Ronald Oussoren b0caf32981 bpo-18378: Recognize "UTF-8" as a valid name in locale._parse_localename (GH-14736) 2019-08-29 00:33:52 -04:00
HongWeipeng fa220ec763 Raise a RuntimeError when tee iterator is consumed from different threads (GH-15567) 2019-08-28 20:39:25 -07:00
Vinay Sharma 13f37f2ba8 closes bpo-37964: add F_GETPATH command to fcntl (GH-15550)
https://bugs.python.org/issue37964



Automerge-Triggered-By: @benjaminp
2019-08-28 18:56:17 -07:00
Anonymous Maarten 55aabee075 closes bpo-37965: Fix compiler warning of distutils CCompiler.test_function. (GH-15560)
https://bugs.python.org/issue37965


https://bugs.python.org/issue37965



Automerge-Triggered-By: @benjaminp
2019-08-28 10:11:03 -07:00
Daniel Fortunov 2a16eea71f bpo-36582: Make collections.UserString.encode() return bytes, not str (GH-13138) 2019-08-27 21:38:09 -07:00
Christian Heimes 98d90f745d
bpo-37951: Lift subprocess's fork() restriction (GH-15544) 2019-08-27 23:36:56 +02:00
vrajivk 8bf5fef873 bpo-36205: Fix the rusage implementation of time.process_time() (GH-15538) 2019-08-27 00:13:12 -04:00
Inada Naoki fae0ed5099
bpo-37328: remove deprecated HTMLParser.unescape (GH-14186)
It is deprecated since Python 3.4.
2019-08-27 11:48:06 +09:00
Pradyun Gedam 10c452b894 bpo-37664: Update ensurepip bundled wheels, again (GH-15483)
/cc @ambv since this needs to be included in 3.8 -- see https://github.com/pypa/pip/issues/6885.

Sorry about the last minute PR!


https://bugs.python.org/issue37664



Automerge-Triggered-By: @zooba
2019-08-26 11:19:30 -07:00
Pablo Galindo 0e4ea16336
bpo-37947: Adjust correctly the recursion level in symtable for named expressions (GH-15499) 2019-08-26 15:52:25 +01:00
Andrew Svetlov 1c06009986
bpo-34679: Restore instantiation Windows IOCP event loop from non-main thread (#15492)
* Restore running proactor event loop from non-main thread

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
2019-08-26 12:51:08 +03:00
Forest Gregg 998cf1f03a bpo-27575: port set intersection logic into dictview intersection (GH-7696) 2019-08-26 00:17:43 -07:00
Serhiy Storchaka c3ea41e9bf
bpo-36917: Add default implementation of ast.NodeVisitor.visit_Constant(). (GH-15490)
It emits a deprecation warning and calls corresponding method
visit_Num(), visit_Str(), etc.
2019-08-26 10:13:19 +03:00
Dong-hee Na 44cd86bbdd bpo-37805: Add tests for json.dump(..., skipkeys=True) (GH-15489)
https://bugs.python.org/issue37805



Automerge-Triggered-By: @methane
2019-08-26 00:04:35 -07:00
Terry Jan Reedy 1039f39c9c
bpo-37824: Properly handle user input warnings in IDLE shell. (GH-15500)
Cease turning SyntaxWarnings into SyntaxErrors.
2019-08-26 02:27:56 -04:00
Flavian Hautbois da27d9b9dc bpo-29553: Fix ArgumentParser.format_usage() for mutually exclusive groups (GH-14976)
Co-authored-by: Andrew Nester <andrew.nester.dev@gmail.com>
2019-08-25 22:06:45 +03:00
Nick Coghlan 5dbe0f59b7
bpo-37757: Disallow PEP 572 cases that expose implementation details (GH-15131)
- drop TargetScopeError in favour of raising SyntaxError directly
  as per the updated PEP 572
- comprehension iteration variables are explicitly local, but
  named expression targets in comprehensions are nonlocal or
  global. Raise SyntaxError as specified in PEP 572
- named expression targets in the outermost iterable of a
  comprehension have an ambiguous target scope. Avoid resolving
  that question now by raising SyntaxError. PEP 572
  originally required this only for cases where the bound name
  conflicts with the iteration variable in the comprehension,
  but CPython can't easily restrict the exception to that case
  (as it doesn't know the target variable names when visiting
  the outermost iterator expression)
2019-08-25 23:45:40 +10:00
Zackery Spytz ce6a070414 bpo-34880: Add the LOAD_ASSERTION_ERROR opcode. (GH-15073)
Fix assert statement misbehavior if AssertionError is shadowed.
2019-08-25 12:44:09 +03:00
Tal Einat d4b4c00b57
bpo-37929: IDLE: avoid Squeezer-related config dialog crashes (GH-15452)
These were caused by keeping around a reference to the Squeezer
instance and calling it's load_font() upon config changes, which
sometimes happened even if the shell window no longer existed.

This change completely removes that mechanism, instead having the
editor window properly update its width attribute, which can then
be used by Squeezer.
2019-08-25 08:52:58 +03:00
Raymond Hettinger aef9ad82f7
bpo-37942: Improve argument clinic float converter (GH-15470) 2019-08-24 19:10:39 -07:00
Berker Peksag 805f8f9afe bpo-19072: Make @classmethod support chained decorators (GH-8405) 2019-08-24 15:37:25 -07:00
Terry Jan Reedy 0dfc025ccc
Fix typo and rearrange words in IDLE news item (GH-15471)
Redo of #15402 by GeeTransit and Kyle Stanley.
2019-08-24 17:32:33 -04:00
Terry Jan Reedy fa7a6f5e35
Revert "(TH-15402)" (#15468)
This reverts commit a50f0a4c2b.
2019-08-24 14:10:04 -04:00
Dong-hee Na 8ad22a4226 bpo-37798: Test both Python and C versions in test_statistics.py (GH-15453) 2019-08-24 10:51:20 -07:00
Greg Price 5e63ab05f1 bpo-37812: Convert CHECK_SMALL_INT macro to a function so the return is explicit. (GH-15216) 2019-08-24 10:19:37 -07:00
GeeTransit a50f0a4c2b (TH-15402) 2019-08-24 13:01:36 -04:00
shireenrao a4e2991bdc bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170)
* fix Path._add_implied_dirs to include all implied directories

* fix Path._add_implied_dirs to include all implied directories

* Optimize code by using sets instead of lists

* 📜🤖 Added by blurb_it.

* fix Path._add_implied_dirs to include all implied directories

* Optimize code by using sets instead of lists

* 📜🤖 Added by blurb_it.

* Add tests to zipfile.Path.iterdir() fix

* Update test for zipfile.Path.iterdir()

* remove whitespace from test file

* Rewrite NEWS blurb to describe the user-facing impact and avoid implementation details.

* remove redundant [] within set comprehension

* Update to use unique_everseen to maintain order and other suggestions in review

* remove whitespace and add back add_dirs in tests

* Add new standalone function parents using posixpath to get parents of a directory

* removing whitespace (sorry)

* Remove import pathlib from zipfile.py

* Rewrite _parents as a slice on a generator of the ancestry of a path.

* Remove check for '.' and '/', now that parents no longer returns those.

* Separate calculation of implied dirs from adding those

* Re-use _implied_dirs in tests for generating zipfile with dir entries.

* Replace three fixtures (abcde, abcdef, abde) with one representative example alpharep.

* Simplify implementation of _implied_dirs by collapsing the generation of parent directories for each name.
2019-08-24 11:26:41 -04:00
Serhiy Storchaka ef61c524dd
bpo-37830: Fix compilation of break and continue in finally. (GH-15320)
Fix compilation of "break" and "continue" in the
"finally" block when the corresponding "try" block
contains "return" with a non-constant value.
2019-08-24 13:11:52 +03:00
Dong-hee Na 0a18ee4be7 bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() (GH-15266) 2019-08-23 15:20:30 -07:00
Zackery Spytz 5be666010e bpo-37549: os.dup() fails for standard streams on Windows 7 (GH-15389) 2019-08-23 11:38:41 -07:00
Raymond Hettinger 8f080b0995
bpo-26589: Add http status code 451 (GH-15413) 2019-08-23 10:19:15 -07:00
Victor Stinner 120b707a6d
bpo-36763: PyConfig_Read() handles PySys_AddXOption() (GH-15431)
PyConfig_Read() is now responsible to handle early calls to
PySys_AddXOption() and PySys_AddWarnOption().

Options added by PySys_AddXOption() are now handled the same way than
PyConfig.xoptions and command line -X options.

For example, PySys_AddXOption(L"faulthandler") enables faulthandler
as expected.
2019-08-23 18:03:08 +01:00
Stefan Behnel b5d3ceea48
bpo-14465: Add an indent() function to xml.etree.ElementTree to pretty-print XML trees (GH-15200) 2019-08-23 16:44:25 +02:00
Victor Stinner c48682509d
bpo-37926: Fix PySys_SetArgvEx(0, NULL, 0) crash (GH-15415)
empty_argv is no longer static in Python 3.8, but it is declared in
a temporary scope, whereas argv keeps a reference to it.
empty_argv memory (allocated on the stack) is reused by
make_sys_argv() code which is inlined when using gcc -O3.

Define empty_argv in PySys_SetArgvEx() body, to ensure
that it remains valid for the whole lifetime of
the PySys_SetArgvEx() call.
2019-08-23 11:04:16 +01:00
Pablo Galindo 4be11c009a bpo-37915: Fix comparison between tzinfo objects and timezone objects (GH-15390)
https://bugs.python.org/issue37915



Automerge-Triggered-By: @pablogsal
2019-08-22 12:24:25 -07:00
Raymond Hettinger d0cdeaab76
bpo-32554: Deprecate hashing arbitrary types in random.seed() (GH-15382) 2019-08-22 09:19:36 -07:00
Steve Dower 7ebdda0dbe
bpo-36311: Fixes decoding multibyte characters around chunk boundaries and improves decoding performance (GH-15083) 2019-08-21 16:22:33 -07:00
bsiem df0c21ff46 bpo-37482: Fix email address name with encoded words and special chars (GH-14561)
Special characters in email address header display names are normally
put within double quotes. However, encoded words (=?charset?x?...?=) are
not allowed withing double quotes. When the header contains a word with
special characters and another word that must be encoded, the first one
must also be encoded.

In the next example, the display name in the From header is quoted and
therefore the comma is allowed; in the To header, the comma is not
within quotes and not encoded, which is not allowed and therefore
rejected by some mail servers.

From: "Foo Bar, France" <foo@example.com>
To: Foo Bar, =?utf-8?q?Espa=C3=B1a?= <foo@example.com>





https://bugs.python.org/issue37482
2019-08-21 16:00:39 -07:00
Brett Cannon 48ede6b8f6
bpo-37663: have venv activation scripts all consistently use __VENV_PROMPT__ for prompt customization (GH-14941)
The activation scripts generated by venv were inconsistent in how they changed the shell's prompt. Some used `__VENV_PROMPT__` exclusively, some used `__VENV_PROMPT__` if it was set even though by default `__VENV_PROMPT__` is always set and the fallback matched the default, and one ignored `__VENV_PROMPT__` and used `__VENV_NAME__` instead (and even used a differing format to the default prompt). This change now has all activation scripts use `__VENV_PROMPT__` only and relies on the fact that venv sets that value by default.

The color of the customization is also now set in fish to the blue from the Python logo for as hex color support is built into that shell (much like PowerShell where the built-in green color is used).
2019-08-21 15:58:01 -07:00