Commit Graph

106316 Commits

Author SHA1 Message Date
Carl Friedrich Bolz-Tereick a327677905
bpo-39485: fix corner-case in method-detection of mock (GH-18252)
Replace check for whether something is a method in the mock module. The
previous version fails on PyPy, because there no method wrappers exist
(everything looks like a regular Python-defined function). Thus the
isinstance(getattr(result, '__get__', None), MethodWrapperTypes) check
returns True for any descriptor, not just methods.

This condition could also return erroneously True in CPython for
C-defined descriptors.

Instead to decide whether something is a method, just check directly
whether it's a function defined on the class. This passes all tests on
CPython and fixes the bug on PyPy.
2020-01-29 15:43:37 +00:00
Victor Stinner 3cb49b62e6
bpo-39460: Fix test_zipfile.test_add_file_after_2107() (GH-18247)
XFS filesystem is limited to 32-bit timestamp, but the utimensat()
syscall doesn't fail. Moreover, there is a VFS bug which returns
a cached timestamp which is different than the value on disk.

https://bugzilla.redhat.com/show_bug.cgi?id=1795576
https://bugs.python.org/issue39460#msg360952
2020-01-29 15:23:29 +01:00
Julien Palard 35eac4500a
Doc: Fix external links to functional programming tutorial. (GH-18249) 2020-01-29 14:10:54 +01:00
Joannah Nanjekye e1e80002e2
bpo-39153: Clarify C API *SetItem refcounting semantics (GH-18220)
Some of the *SetItem methods in the C API steal a reference to the
given value. This annotates the better behaved ones to assure the
reader that these are not the ones with the inconsistent behaviour.

* 📜🤖 Added by blurb_it.

* make docs consistent with signature

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-01-29 21:20:53 +10:00
Bruce Merry d07d9f4c43
bpo-36051: Drop GIL during large bytes.join() (GH-17757)
Improve multi-threaded performance by dropping the GIL in the fast path
of bytes.join. To avoid increasing overhead for small joins, it is only
done if the output size exceeds a threshold.
2020-01-29 16:09:24 +09:00
Steve Dower 6a65eba44b
bpo-39401: Avoid unsafe DLL load on Windows 7 and earlier (GH-18231)
As Windows 7 is not supported by Python 3.9, we just replace the dynamic load with a static import. Backports will have a different fix to ensure they continue to behave the same.
2020-01-29 13:46:33 +11:00
Dino Viehland 0cd5bff6b7
bpo-39459: include missing test files in windows installer
Adds missing test files to Windows installer to wrap up bpo-39459
2020-01-28 13:24:12 -08:00
David Carlier aabdeb766b bpo-38960: DTrace build fix for FreeBSD. (GH-17451)
DTrace build fix for FreeBSD.

- allowing passing an extra flag as it need to define the arch size.
- casting some probe's arguments.
2020-01-28 13:53:32 +01:00
Rémi Lapeyre 2cca8efe46 bpo-36350: inspect: Replace OrderedDict with dict. (GH-12412) 2020-01-28 21:47:03 +09:00
Adam Meily 0be3246d4f bpo-39439: Fix multiprocessing spawn path in a venv on Windows (GH-18158) 2020-01-28 21:34:23 +11:00
Inada Naoki 148610d88a
bpo-39287: Doc: Add UTF-8 mode section in using/windows. (GH-17935)
Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
2020-01-28 19:12:31 +09:00
Zackery Spytz 13c1c3556f bpo-39393: Misleading error message on dependent DLL resolution failure (GH-18093) 2020-01-28 20:42:43 +11:00
Christoph Reiter c45a2aa9e2 bpo-38883: Don't use POSIX `$HOME` in `pathlib.Path.home/expanduser` on Windows (GH-17961)
In bpo-36264 os.path.expanduser was changed to ignore HOME on Windows.

Path.expanduser/home still honored HOME despite being documented as behaving the same
as os.path.expanduser. This makes them also ignore HOME so that both implementations
behave the same way again.
2020-01-28 20:41:50 +11:00
Victor Stinner 61f4db8c56
bpo-38644: Pass tstate in ceval.c (GH-18222)
Pass explicitly the Python thread state (tstate) in ceval.c.
2020-01-28 03:37:45 +01:00
Raymond Hettinger 01bf2196d8
bpo-36018: Minor fixes to the NormalDist() examples and recipes. (GH-18226)
* Change the source for the SAT data to a primary source.
* Fix typo in the standard deviation
* Clarify that the binomial probabalities are just for the Python room.
2020-01-27 18:31:46 -08:00
Brian Quinlan 884eb89d4a
bpo-39205: Tests that highlight a hang on ProcessPoolExecutor shutdown (#18221) 2020-01-27 16:50:37 -08:00
Terry Jan Reedy 2824c45a0a
bpo-39392: Turtle overlap fill depends on OS (#18223)
Whether or not overlap regions for self-intersecting polygons
or multiple shapes are filled depends on the operating system graphics,
typeof overlap, and number of overlaps.
2020-01-27 18:41:18 -05:00
Victor Stinner a278313518
bpo-38631: Avoid Py_FatalError() in PyCode_New() (GH-18215)
intern_strings() now raises a SystemError, rather than calling
Py_FatalError().

intern_string_constants() now reports exceptions to the caller,
rather than ignoring silently exceptions.
2020-01-27 23:24:13 +01:00
Victor Stinner d3a1de2270
bpo-38631: Avoid Py_FatalError() in _PyCodecRegistry_Init() (GH-18217)
_PyCodecRegistry_Init() now reports exceptions to the caller,
rather than calling Py_FatalError().
2020-01-27 23:23:12 +01:00
Cheryl Sabella dd023ad161 bpo-30780: Add IDLE configdialog tests (#3592)
Expose dialog buttons to test code and complete their test coverage.
Complete test coverage for highlights and keys tabs.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-01-27 17:15:56 -05:00
Dino Viehland 2528a6c3d0
Add test.test_import.data.unwritable package to makefile (#18211) 2020-01-27 14:04:56 -08:00
Victor Stinner 47ee8a6063
bpo-38631: Avoid Py_FatalError() in _memory_release() (GH-18214)
If the export count is negative, _memory_release() now raises a
SystemError and returns -1, rather than calling Py_FatalError()
which aborts the process.
2020-01-27 22:37:44 +01:00
Victor Stinner a94c6b61aa
bpo-38631: Avoid Py_FatalError() in PyModule_Create2() (GH-18212)
If PyModule_Create2() is called when the Python import machinery is
not initialized, it now raises a SystemError and returns NULL,
instead of calling Py_FatalError() which aborts the process.

The caller must be prepared to handle NULL anyway.
2020-01-27 22:37:05 +01:00
Victor Stinner 4a46adc774
bpo-39459: test.pythoninfo logs effective uid/gid (GH-18203)
Fix also umask formatting: use octal prefix.
2020-01-27 18:06:42 +01:00
Dong-hee Na 9e1ed518a5 bpo-39453: Add testcase for bpo-39453 (GH-18202)
https://bugs.python.org/issue39453



Automerge-Triggered-By: @pablogsal

Automerge-Triggered-By: @pablogsal
2020-01-27 09:04:25 -08:00
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