Commit Graph

106241 Commits

Author SHA1 Message Date
Nick Coghlan 7023288dc5
Ignore NEWS snippets in code coverage stats (GH-18194) 2020-01-28 02:05:03 +10:00
Dong-hee Na 4dbf2d8c67 bpo-39453: Make list.__contains__ hold strong references to avoid crashes (GH-18181) 2020-01-27 15:02:23 +00:00
Chris Withers a46575a8f2
Clarify and fix assertions that mocks have not been awaited (GH-18196)
- The gc.collect is needed for other implementations, such as pypy
- Using context managers over multiple lines will only catch the warning from the first line in the context!
- remove a skip for a test that no longer fails on pypy
2020-01-27 14:55:56 +00:00
Chris Withers c7dd3c7d87
Use relative imports in mock and its tests to help backporting (GH-18197)
* asyncio.run only available in 3.8+

* iscoroutinefunction has important bungfixes in 3.8

* IsolatedAsyncioTestCase only available in 3.8+
2020-01-27 14:11:19 +00:00
Toshio Kuratomi 997443c14c Fix so that test.test_distutils can be executed by unittest and not just regrtest (GH-13480) 2020-01-27 07:08:39 -05:00
Mark Shannon 8a4cd700a7
bpo-39320: Handle unpacking of **values in compiler (GH-18141)
* Add DICT_UPDATE and DICT_MERGE bytecodes. Use them for ** unpacking.

* Remove BUILD_MAP_UNPACK and BUILD_MAP_UNPACK_WITH_CALL, as they are now unused.

* Update magic number for ** unpacking opcodes.

* Update dis.rst to incorporate new bytecodes.

* Add blurb entry.
2020-01-27 09:57:45 +00:00
Karthikeyan Singaravelan 72b1004657 bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock (#16029) 2020-01-27 06:48:15 +00:00
Raymond Hettinger 10355ed7f1
bpo-36018: Add another example for NormalDist() (#18191) 2020-01-25 20:21:17 -08:00
加和 4515a590a4 Fix linecache.py add lazycache to __all__ and use dict.clear to clear the cache (GH-4641) 2020-01-25 21:07:40 -05:00
Juhana Jauhiainen 8271441d8b bpo-39374: Updated sorting documentation (GH-18177) 2020-01-25 14:18:58 -08:00
Windson yang 4b09dc79f4 bpo-36654: Add examples for using tokenize module programmically (#12947) 2020-01-25 22:23:00 +03:00
alclarks 7de617455e bpo-15243: Document __prepare__ as classmethod (GH-17124) 2020-01-25 21:49:58 +03:00
Vegard Stikbakke aef7dc8987 bpo-38932: Mock fully resets child objects on reset_mock(). (GH-17409) 2020-01-25 15:44:46 +00:00
fireattack 9bfb4a7061 Update 3.8.rst (GH-18173)
Fixed the name of the contributor (@selik).
2020-01-25 10:08:13 -05:00
Łukasz Langa d23b08f8d0
Post 3.9.0a3 2020-01-25 14:52:44 +01:00
Łukasz Langa b07ead3411 Python 3.9.0a3
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl4rXBoACgkQsmmV4xAl
 BWid+xAAmRi6rMnpTrJG6V4herWLg4tQg4LaghxXPHtAfcZCgYkbA3kI4nq7SoKy
 7XnJRX6Uk3FhT2rzM2+sg+sPDMNz5ki+G6L0rYrmouZSy+y7/KDBTzh7u8nnAZD1
 t72Zl3LyWFgeg58MVld5LWoCt7+ywAfIAEbeYAFonH4yY1MqK8Q5+kbNtuMBar81
 S44i/UIjVD1GJTzxxDqWU4B0BmCGizenBiyssAwTbM556dzjR7tDqWhDfiXcMLgW
 7Wq5sj96GjNOrNTbtPikiu3sl97hHlJgZEel/vBq2RNArEspRa0F3uqNYyaRedHr
 F9XDlsXLdj+18w1tG1HejZiGquW9y55vexEtDp2e2FXl9bHm5n7D8PUX8rCuw6li
 lR2W+oB0i8/Jd1R8GymJ4RfHrh7jHoTCskcLp8BrBlFBU0d3DAoYFT9rA5GSj3dx
 MIQgA2KbDJEYU7i0/uLLqK6L37PD8NaAPhdVjUN1B2qJ47RrC3yc5tPHIuyiBMYu
 M2PW8LNhg/+ZIQjznSam3xiLDzEv/TeHA0YgfdIaXgdtybFSGIUWMxCGQjNtzrHS
 u4WjsQy9yFAtF+mgPKqXBI+coBtLUhvRfOGHwhnbjkao7i65ztZC2VX/e2CfquO/
 DDJZoiGS0wGbDJfeApNaT7/Kac2uGgvYfx1foGReK3fqRqLl8aU=
 =xsba
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl4sSAgQHGx1a2FzekBs
 YW5nYS5wbAAKCRCyaZXjECUFaGJkD/9ktOT+LKyW8+9nKRkVNHy4+PRGdKA/7O7y
 q8qieymxaJoq2sFKQmgBvDTEh/S6Z75BlsHiTucpDnFe+WVwLJ79g0w9ehbzWx8g
 XjNn1ONvsd/sDgUxZ3YiYy6uMbrCMPmcb0VPdlVW1l55uCDccNkh94Sa0lDEYnJo
 +Xr6kDd+dyrF6XswyfDSSYriUNHODfT4aezFbS/EAaD3uX+hqtEW+kl1C3unbN5H
 xxqe986NYGX5Yd7sIr9tqVBz4m0gQLDXX1i10pZFi+4pqog/ZV6XQbW+RSjr3SuU
 FktleKz5erwY2fEz9KHRjonpPDPwEnWOnnn+MNPDECuIVyHswkAidUS69DkzfUpf
 us1RrUoOmzi3cBxhrPCLVMnFFKpdxigiKWVa1CVNEhr7nhLLT3JPdfjXY/XEezW3
 i9xJkCaxJUw7xrt808O1MHhkKAC9VFk/s2YDpmhCcmwfF8IR2K4L0XpQRG4+dfwz
 WFPA8xQC2W+BHsHQoXW4XFZJQaCDmXZX2c0SOjl2fwZUyi2h3vvqJPfDxtjIRltN
 TqAZJuaZgJNhtvK9R2BIY6Xr72owczdM8z35Je44K6oiUgFYs4UN9U+6D4sdRkSc
 YBDgRmnGHTb07VWTWxyuzkXmUDiQ458KpdA9xDE47463v+NqkD9scR3EgX/e6OTR
 0+EgUU6dYg==
 =MyW2
 -----END PGP SIGNATURE-----

Merge tag 'v3.9.0a3'

Python 3.9.0a3
2020-01-25 14:52:06 +01:00
Paulo Henrique Silva 40c080934b bpo-37955: correct mock.patch docs with respect to the returned type (GH-15521) 2020-01-25 10:53:54 +00:00
Matthew Kokotovich 62865f4532 bpo-39082: Allow AsyncMock to correctly patch static/class methods (GH-18116) 2020-01-25 10:17:47 +00:00
Cheryl Sabella d0d9fa8c5e bpo-39388: IDLE: Fix bug when cancelling out of configdialog (GH-18068)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-01-25 04:00:54 -05:00
Łukasz Langa c33378df39
Python 3.9.0a3 2020-01-24 22:05:07 +01:00
Serhiy Storchaka 9017e0bd5e bpo-39430: Fix race condition in lazy imports in tarfile. (GH-18161)
Use `from ... import ...` to ensure module is fully loaded before accessing its attributes.
2020-01-24 09:55:52 -08:00
Victor Stinner 656c45ec9a
bpo-38631: Avoid Py_FatalError() in GC collect() (GH-18164)
collect() should not get an exception, but it does, logging the
exception is enough. Override sys.unraisablehook to decide how to
handle unraisable exceptions.

Py_FatalError() should be avoided whenever possible.
2020-01-24 18:05:24 +01:00
mbarkhau 88704334e5 bpo-39390 shutil: fix argument types for ignore callback (GH-18122) 2020-01-24 15:51:16 +01:00
Karthikeyan Singaravelan 66b00a9d3a bpo-38473: Handle autospecced functions and methods used with attach_mock (GH-16784) 2020-01-24 13:14:29 +00:00
Victor Stinner b8d1262e8a
bpo-39395: putenv() and unsetenv() always available (GH-18135)
The os.putenv() and os.unsetenv() functions are now always available.

On non-Windows platforms, Python now requires setenv() and unsetenv()
functions to build.

Remove putenv_dict from posixmodule.c: it's not longer needed.
2020-01-24 14:05:48 +01:00
Victor Stinner 161e7b36b1
bpo-39413: Implement os.unsetenv() on Windows (GH-18163)
The os.unsetenv() function is now also available on Windows.
2020-01-24 11:53:44 +01:00
Ammar Askar 2d5097663d bpo-39361: Document the removal of PyTypeObject.tp_print (GH-18125) 2020-01-24 11:35:01 +01:00
Mark Dickinson e9652e8d58 bpo-39426: Fix outdated default and highest protocols in docs (GH-18154)
Some portions of the pickle documentation hadn't been updated for the pickle protocol changes in Python 3.8 (new protocol 5, default protocol 4). This PR fixes those docs.


https://bugs.python.org/issue39426
2020-01-24 02:03:22 -08:00
Victor Stinner b9783d2e03
bpo-39429: Add a new "Python Development Mode" doc page (GH-18132) 2020-01-24 10:22:18 +01:00
Mario Corchero e131c9720d Fix `mock.patch.dict` to be stopped with `mock.patch.stopall` (#17606)
As the function was not registering in the active patches, the mocks
started by `mock.patch.dict` were not being stopped when
`mock.patch.stopall` was being called.
2020-01-24 08:38:32 +00:00
Emmanuel Arias 1d0c5e16ea bpo-24928: Add test case for patch.dict using OrderedDict (GH -11437)
* add test for path.dict using OrderedDict

Co-authored-by: Yu Tomita nekobon@users.noreply.github.com
2020-01-24 08:14:14 +00:00
Pablo Galindo 65ecc390c1
bpo-17005: Minor improvements to the documentation of TopologicalSorter (GH-18155) 2020-01-23 21:01:50 +00:00
Shanavas M 7142df5ea2 bpo-39431: Also mention nonlocal in assignment quirk (GH-17375) 2020-01-23 13:09:21 -05:00
Pablo Galindo 99e6c260d6
bpo-17005: Add a class to perform topological sorting to the standard library (GH-11583)
Co-Authored-By: Tim Peters <tim.peters@gmail.com>
2020-01-23 15:29:52 +00:00
Pablo Galindo 79f89e6e5a
bpo-39421: Fix posible crash in heapq with custom comparison operators (GH-18118)
* bpo-39421: Fix posible crash in heapq with custom comparison operators

* fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators

* fixup! fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators
2020-01-23 14:07:05 +00:00
Mark Shannon 13bc13960c
bpo-39320: Handle unpacking of *values in compiler (GH-17984)
* Add three new bytecodes: LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE. Use them to implement star unpacking expressions.

* Remove four bytecodes BUILD_LIST_UNPACK, BUILD_TUPLE_UNPACK, BUILD_SET_UNPACK and  BUILD_TUPLE_UNPACK_WITH_CALL opcodes as they are now unused.

* Update magic number and dis.rst for new bytecodes.
2020-01-23 09:25:17 +00:00
Terry Jan Reedy f9e07e116c
bpo-32989: IDLE - remove unneeded parameter (GH-18138)
IDLE does not pass a non-default _synchre in any of its calls to
pyparse.find_good_parse_start.
2020-01-22 23:55:07 -05:00
Zackery Spytz 2e43b64c94 bpo-39050: The Help button in IDLE's config menu works again (GH-17611)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-01-22 22:54:30 -05:00
William Woodruff dd754caf14 bpo-29435: Allow is_tarfile to take a filelike obj (GH-18090)
`is_tarfile()` now supports `name` being a file or file-like object.
2020-01-22 18:24:16 -08:00
Pablo Galindo 41f0ef6abb bpo-39427: Document -X opt options in the CLI --help and the man page (GH-18131)
https://bugs.python.org/issue39427



Automerge-Triggered-By: @pablogsal
2020-01-22 17:03:04 -08:00
Dino Viehland 9b6fec4651
bpo-39336: Allow packages to not let their child modules be set on them (#18006)
* bpo-39336: Allow setattr to fail on modules which aren't assignable

When attaching a child module to a package if the object in sys.modules raises an AttributeError (e.g. because it is immutable) it causes the whole import to fail.  This now allows immutable packages to exist and an ImportWarning is reported and the AttributeError exception is ignored.
2020-01-22 16:42:38 -08:00
Alex Rebert d3ae95e1e9 bpo-35182: fix communicate() crash after child closes its pipes (GH-17020) (GH-18117)
When communicate() is called in a loop, it crashes when the child process
has already closed any piped standard stream, but still continues to be running

Co-authored-by: Andriy Maletsky <andriy.maletsky@gmail.com>
2020-01-22 15:28:31 -08:00
Dong-hee Na 1f0f102dec bpo-39366: Remove xpath() and xgtitle() methods of NNTP (GH-18035) 2020-01-23 00:59:43 +03:00
Victor Stinner b477d19a6b
bpo-39406: Implement os.putenv() with setenv() if available (GH-18128)
If setenv() C function is available, os.putenv() is now implemented
with setenv() instead of putenv(), so Python doesn't have to handle
the environment variable memory.
2020-01-22 22:48:16 +01:00
Victor Stinner 0852c7dd52
bpo-39406: os.putenv() avoids putenv_dict on Windows (GH-18126)
Windows: _wputenv(env) copies the *env* string and doesn't require
the caller to manage the variable memory.
2020-01-22 21:53:26 +01:00
Victor Stinner b73dd02ea7
Revert "bpo-39413: Implement os.unsetenv() on Windows (GH-18104)" (GH-18124)
This reverts commit 56cd3710a1.
2020-01-22 21:11:17 +01:00
Victor Stinner beea26b57e
bpo-39353: Deprecate the binhex module (GH-18025)
Deprecate binhex4 and hexbin4 standards. Deprecate the binhex module
and the following binascii functions:

* b2a_hqx(), a2b_hqx()
* rlecode_hqx(), rledecode_hqx()
* crc_hqx()
2020-01-22 20:44:22 +01:00
Dong-hee Na 14d80d0b60 bpo-39425: Fix list.count performance regression (GH-18119)
https://bugs.python.org/issue39425



Automerge-Triggered-By: @pablogsal
2020-01-22 09:36:54 -08:00
Inada Naoki 5bbac8cbdf
bpo-39377: json: Update doc about the encoding option. (GH-18076)
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-01-22 19:01:24 +09:00
Dong-hee Na 0d5eac8c32 closes bpo-39415: Remove unused codes from longobject.c complexobject.c floatobject.c. (GH-18105) 2020-01-21 18:49:30 -08:00