Commit Graph

44857 Commits

Author SHA1 Message Date
Benjamin Peterson 44867bb937
Fix test_posix if RWF_HIPRI is defined but not preadv2. (GH-13980)
If preadv2 is not available, preadv will raise NotImplementedError.
2019-06-11 10:15:31 -07:00
Benjamin Peterson 910b3fcb01
closes bpo-33758: Skip test_get_type_hints_modules_forwardref. (GH-13977)
This test "works" if things are run in the right order, so it's better to use @skip than @expectedFailure here.
2019-06-11 09:18:31 -07:00
Andrew Svetlov 65aa64fae8 bpo-36607: Eliminate RuntimeError raised by asyncio.all_tasks() (GH-13971)
If internal tasks weak set is changed by another thread during iteration.



https://bugs.python.org/issue36607
2019-06-11 08:27:30 -07:00
Raymond Hettinger 1f11cf9521
bpo-37219: Remove erroneous optimization for differencing an empty set (GH-13965) 2019-06-11 01:15:24 -07:00
Victor Stinner b589cef9c4
bpo-37223: test_io: silence destructor errors (GH-13954)
Implement also MockNonBlockWriterIO.seek() method.
2019-06-11 03:10:59 +02:00
Victor Stinner 4f6f7c5a61
bpo-18748: Fix _pyio.IOBase destructor (closed case) (GH-13952)
_pyio.IOBase destructor now does nothing if getting the closed
attribute fails to better mimick _io.IOBase finalizer.
2019-06-11 02:49:06 +02:00
Marcin Niemira 45a14942c9 bpo-11122: fix hardcoded path checking for rpmbuild in bdist_rpm.py (GH-10594) 2019-06-08 17:05:05 -04:00
Raymond Hettinger e119b3d136
bpo-37178: Allow a one argument form of math.perm() (GH-13905) 2019-06-08 08:58:11 -07:00
Rémi Lapeyre 8cc605acdd bpo-34886: Fix subprocess.run handling of exclusive arguments (GH-11727)
Fix an unintended ValueError from :func:`subprocess.run` when checking for
conflicting `input` and `stdin` or `capture_output` and `stdout` or `stderr` args
when they were explicitly provided but with `None` values within a passed in
`**kwargs` dict rather than as passed directly by name.
2019-06-08 07:56:24 -07:00
Philipp A d407d2a726 bpo-37173: Show passed class in inspect.getfile error (GH-13861)
Currently, inspect.getfile(str) will report nonsense:

```pytb
>>> inspect.getfile(str)
TypeError: <module 'builtins' (built-in)> is a built-in class
```

This fixes that


https://bugs.python.org/issue37173
2019-06-08 05:05:46 -07:00
Anthony Sottile 65e5860fcc cross port importlib-metadata PR #76 (#13903)
https://gitlab.com/python-devs/importlib_metadata/merge_requests/76
2019-06-07 14:23:38 -07:00
zygocephalus 03d5831a2d bpo-37150: Throw ValueError if FileType class object was passed in add_argument (GH-13805)
There is a possibility that someone (like me) accidentally will omit parentheses with `FileType` arguments after `FileType`, and parser will contain wrong file until someone will try to use it. 

Example:
```python
parser = argparse.ArgumentParser()
parser.add_argument('-x', type=argparse.FileType)
```


https://bugs.python.org/issue37150
2019-06-07 13:08:36 -07:00
Paul Monson e7e5039d69 bpo-37181: Fix test_regrtest failures on Windows arm64 (GH-13872) 2019-06-07 10:58:41 -07:00
Victor Stinner 740a84de73
bpo-37191: Move TestPEP590 from test_capi to test_call (GH-13892) 2019-06-07 17:51:28 +02:00
Victor Stinner 3bf0f3ad20
bpo-37169: Rewrite _PyObject_IsFreed() unit tests (GH-13888)
Replace two Python function calls with a single one to ensure that no
memory allocation is done between the invalid object is created and
when _PyObject_IsFreed() is called.
2019-06-07 16:22:21 +02:00
Jeroen Demeyer 3f345c3925 bpo-37151: simplify classmethoddescr_call (GH-13340) 2019-06-07 12:20:23 +02:00
Stefan Krah 307d4cb957
Use assertEqual(). (#13883) 2019-06-07 11:18:34 +02:00
Cheryl Sabella 7f8a38a7c4
IDLE: Standardize naming convention for DummyEditwin in tests (GH-13876)
* Change from Dummy_Editwin to DummyEditwin to match other tests.
2019-06-07 05:08:20 -04:00
Eric Wieser 0690c79c41 bpo-37188: Fix a divide-by-zero in arrays of size-0 objects (#13881) 2019-06-07 10:13:26 +02:00
Tal Einat 554450fb4e
bpo-37177: make IDLE's search dialogs transient (GH-13869)
This avoids the search dialogs being hidden behind the editor window.
2019-06-07 08:54:40 +03:00
websurfer5 f6713e84af bpo-36520: Email header folded incorrectly (#13608)
* bpo-36520: reset the encoded word offset when starting a new
line during an email header folding operation

* 📜🤖 Added by blurb_it.

* bpo-36520: add an additional test case, and provide descriptive
comments for the test_folding_with_utf8_encoding_* tests

* bpo-36520: fix whitespace issue

* bpo-36520: changes per reviewer request -- remove extraneous
backslashes; add whitespace between terminating quotes and
line-continuation backslashes; use "bpo-" instead of
"issue #" in comments
2019-06-06 12:53:27 -07:00
Walter Dörwald 6af230359e bpo-2661: Make mapping tests better usable for custom mapping classes. (GH-11157)
In test_fromkeys() the derived test class now supports all arguments in its
constructor so that the class to be tested can use its own constructor in its
fromkeys() implementation.

In test_mutatingiteration() the test fails as soon as iterating over a
dictionary with one entry and adding new entries in the loop iterates more
than once (to avoid endless loops in faulty implementations).



https://bugs.python.org/issue2661
2019-06-06 03:13:08 -07:00
Inada Naoki cb65202520
bpo-35551: remove mac_centeuro encoding (GH-13856)
It is alias to mac_latin2 now.
2019-06-06 14:38:52 +09:00
Ashwin Ramaswami c4c15ed7a2 bpo-35551: encodings update (GH-11446) 2019-06-05 18:18:06 -04:00
Abhilash Raj 66c4f3f38b bpo-21315: Fix parsing of encoded words with missing leading ws. (#13425)
* bpo-21315: Fix parsing of encoded words with missing leading ws.

Because of missing leading whitespace, encoded word would get parsed as
unstructured token. This patch fixes that by looking for encoded words when
splitting tokens with whitespace.

Missing trailing whitespace around encoded word now register a defect
instead.

Original patch suggestion by David R. Murray on bpo-21315.
2019-06-05 09:56:33 -07:00
Serhiy Storchaka 142566c028
[3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)
Turn deprecation warnings added in 3.8 into TypeError.
2019-06-05 18:22:31 +03:00
Raymond Hettinger 6c01ebcc0d
bpo-37158: Simplify and speed-up statistics.fmean() (GH-13832) 2019-06-05 07:39:38 -07:00
Zackery Spytz 9aa78566fb bpo-34767: Do not always create a collections.deque() in asyncio.Lock() (GH-13834)
https://bugs.python.org/issue34767
2019-06-05 02:33:26 -07:00
Emmanuel Arias 6d64a8f49e bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [streams] (GH-13671)
This PR deprecate explicit loop parameters in all public asyncio APIs

This issues is split to be easier to review.

Second step: streams.py





https://bugs.python.org/issue36373
2019-06-04 22:45:53 -07:00
Terry Jan Reedy 949fe976d5
bpo-35763: Make IDLE calltip note about '/' less obtrusive (GH-13791)
Add it to the end of the first line if there is room.  Tests were reworked.
2019-06-04 21:55:37 -04:00
Zachary Ware 19a1e1eb86 bpo-34282: Remove deprecated enum _convert method (GH-13823) 2019-06-04 23:03:10 +02:00
Łukasz Langa 23d7ce7471 Python 3.8.0b1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAlz2r2cACgkQsmmV4xAl
 BWhasQ/9EDLL+KtFUdi3iMr7+C1UN/2u2v3OnOsZQA0WE7TfEebbf5GS4baN/pHk
 PslVY6kRqRfQIxjemXFpq52mn9+3SUE4m3avkgnUZMu8XEaUczM4IdcizGMO3qNr
 c1iz6BraJo8gZ1g+dNcRbEc89V9e1SzrBZOR9MXGjxxo0HHEPdjW9ptg1BtHq9To
 n4iivdQSnnxzP7D7SpItWPL/gFv90GBbXaTRerGUlmj/uwnBhzHB1fi4r+WDn8yR
 4AiFVSlUFpTXYOiH5A3MYQtLq8kH9AAmo6Bmj/73NvChxv7GV5v968+tlEWEK+/h
 UtTUEw8L/oSH74m8wd0q0tQdTe8VJgtwKyR6h5GLL8TLa73nN/jK4Koqirpc8mpK
 DcHVLpxHQ/yhPtAcQXp81qqJSbhnPOvbRjNQP5bHcNIl8p+OsF7N9z/tu6gmMorO
 k+f2OCOC0ZsG/EL7DPz6kG6+Cy5NhA+/IJ9I3Ayk6AsSjbzqtgai3bKKVF3s27r8
 OIZprMAVKsmsPpEfuSG8rshKxmLH5/n7YuwSuMmWXv06QspfG43zxp1VYq94zBoI
 wpBy8QxBwef7oDpMI+WgE/g8Prj1NmQuIy7co/pZDsOHeQWr96z90BcpSX8XKHKT
 9W829jFKoQEnGnuFgoUxacR8a4bQKVla5mVFvjUtGjb9GS9kJkk=
 =V2hy
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAlz2zD8QHGx1a2FzekBs
 YW5nYS5wbAAKCRCyaZXjECUFaIw/EACXkzdCOq5D/itTvFElnNWjlon8ot4toVEf
 zw4isSYiYS4B3dBI6+VyCZWNxR5F6fwfyhPLHf7CzPn+7Yp5+dX9//x0HqhNLQCY
 PmwuYG/4nWcww8UhUweGVI1u8Fjrw+LzLJPVyhLQia/TXUBfCFcggS2xo9S6mSsA
 isJr9RaCDaoit6ZjFIuo+sOn2YTx2eYBe6LlhlSx9zz0ayyy+ADqPeUq/hoEFDPD
 EXUOwsLJPo/vu7sFqKOhHBWtMCcnvkkbiBLrAmHS2vhKjl22zVez0lUiVxLUlhZT
 WcmfRkCtoBKu2rYbm85pt08fgF/CnHq9oO57yDBZ4j/Lv0HqQkp+/yZRzWqSSThw
 vw4z4Ur3l06ZMxsTH+Dd/xjqc41AlpedJNhuAgOf0URrbl4H48y5U6AG1vZWrpAk
 wUsTF1QGXL1SAam2pjI2cTpjRaCh3RK2wf0KPewxUpcvcRcGtGAbq+EFHHOFg2Lm
 AcxAuAEUXKcyJQnLtFiIOWJFttaRzAB6zq8sEL0kS1BfAEspqTk+ZdnDY1ajppqu
 7sb3/TGrxa+38Th5iVvUehHGQqrQYLORVn0w8PKUXunbUbv6AYoDJHKxiOUO4JsX
 L5jZEPjTeG0BjntTnvVYdgqPXAVbJr76LmlCPkPcmSruvXrfZP1OOi+ybepwbTpD
 8pw88nSTuA==
 =zOCJ
 -----END PGP SIGNATURE-----

Merge tag 'v3.8.0b1'

Python 3.8.0b1
2019-06-04 21:53:26 +02:00
Abhilash Raj aa79707262 bpo-30835: email: Fix AttributeError when parsing invalid CTE (GH-13598)
* bpo-30835: email: Fix AttributeError when parsing invalid Content-Transfer-Encoding

Parsing an email containing a multipart Content-Type, along with a
Content-Transfer-Encoding containing an invalid (non-ASCII-decodable) byte
will fail. email.feedparser.FeedParser._parsegen() gets the header and
attempts to convert it to lowercase before comparing it with the accepted
encodings, but as the header contains an invalid byte, it's returned as a
Header object rather than a str.

Cast the Content-Transfer-Encoding header to a str to avoid this.

Found using the AFL fuzzer.

Reported-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Andrew Donnellan <andrew@donnellan.id.au>

* Add email and NEWS entry for the bugfix.
2019-06-04 11:00:47 -07:00
Łukasz Langa 3b5deb0116
Python 3.8.0b1 2019-06-04 19:44:34 +02:00
Abhilash Raj 46d88a1131 bpo-35805: Add parser for Message-ID email header. (GH-13397)
* bpo-35805: Add parser for Message-ID header.

This parser is based on the definition of Identification Fields from RFC 5322
Sec 3.6.4.

This should also prevent folding of Message-ID header using RFC 2047 encoded
words and hence fix bpo-35805.

* Prevent folding of non-ascii message-id headers.
* Add fold method to MsgID token to prevent folding.
2019-06-04 10:41:34 -07:00
Victor Stinner bc6469f79c
bpo-37153: test_venv.test_mutiprocessing() calls pool.terminate() (GH-13816)
test_venv.test_mutiprocessing() now explicitly calls pool.terminate()
to wait until the pool completes.
2019-06-04 19:03:13 +02:00
Steve Dower 8d0ef0b5ed bpo-36742: Corrects fix to handle decomposition in usernames (#13812) 2019-06-04 17:55:29 +02:00
Boris Feld 800d786370 Fix extraneous whitespace in QueueListener.prepare (GH-13803) 2019-06-04 16:20:17 +01:00
Victor Stinner ca612a9728
bpo-36778: Remove outdated comment from CodePageTest (GH-13807)
CP65001Test has been removed.
2019-06-04 17:09:10 +02:00
Andrew Svetlov 8d561092d5 bpo-37142: Make asyncio stream tests more robust again (GH-13804)
Make test_stream_server_close() implementation following test_stream_server_abort().
 Add explicit timeout for tests that can hang.
2019-06-04 15:44:44 +02:00
Andrew Svetlov 35890abb8d Make StreamServer.close() tests more robust (GH-13790) 2019-06-04 13:37:10 +02:00
Łukasz Langa 7f9a2ae780
Revert "bpo-34037, asyncio: add BaseEventLoop.wait_executor_on_close (GH-13786)" (#13802)
This reverts commit 0f0a30f4da.
2019-06-04 13:03:20 +02:00
Pablo Galindo 4cdbc452ce
bpo-37148: Fix asyncio test that check for warning when running the test suite with huntleaks (GH-13800) 2019-06-04 11:26:20 +01:00
Raymond Hettinger 963eb0f473
bpo-35431: Drop the k <= n requirement (GH-13798) 2019-06-04 01:23:06 -07:00
Andrew Svetlov 9535aff942 Revert "bpo-35621: Support running subprocesses in asyncio when loop is executed in non-main thread (#13630)" (GH-13793)
https://bugs.python.org/issue35621
2019-06-03 17:09:19 -07:00
Victor Stinner 0f0a30f4da
bpo-34037, asyncio: add BaseEventLoop.wait_executor_on_close (GH-13786)
Add BaseEventLoop.wait_executor_on_close attribute: true by default.

loop.close() now waits for the default executor to finish by default.
Set loop.wait_executor_on_close attribute to False to not wait for
the executor.
2019-06-03 23:31:04 +02:00
Christian Heimes 78c7d52779
bpo-37120: Add SSLContext.num_tickets (GH-13719)
Signed-off-by: Christian Heimes <christian@python.org>
2019-06-03 21:00:10 +02:00
Christian Heimes e35d1ba9ea
bpo-34271: Fix compatibility with 1.0.2 (GH-13728)
Fix various compatibility issues with LibreSSL and OpenSSL 1.0.2
introduced by bpo-34271.

Signed-off-by: Christian Heimes <christian@python.org>
2019-06-03 20:40:15 +02:00
Victor Stinner e225bebc14
Revert "bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (gh-13714)" (GH-13780)
This reverts commit 6a150bcaeb.
2019-06-03 18:14:24 +02:00
Victor Stinner 49a7e34797
bpo-37137: Fix test_asyncio: use TestCase.set_event_loop() (GH-13779)
Replace asyncio.set_event_loop() with TestCase.set_event_loop() of
test_asyncio.utils: this method calls TestCase.close_loop() which
waits until the executor completes, to avoid leaking dangling
threads.

Inherit from test_asyncio.utils.TestCase rather than
unittest.TestCase.
2019-06-03 17:49:04 +02:00
Inada Naoki 91234a1636
bpo-26219: per opcode cache for LOAD_GLOBAL (GH-12884)
This patch implements per opcode cache mechanism, and use it in
only LOAD_GLOBAL opcode.

Based on Yury's opcache3.patch in bpo-26219.
2019-06-03 21:30:58 +09:00
Pablo Galindo 8565f6b6db
bpo-35814: Allow unpacking in r.h.s of annotated assignment expressions (GH-13760) 2019-06-03 08:34:20 +01:00
Xtreak d9677f36fe IDLE: Fix typos in docs and comments (GH-13749) 2019-06-03 00:21:15 -04:00
Raymond Hettinger cba9f84725
bpo-36546: Add design notes to aid future discussions (GH-13769) 2019-06-02 21:07:43 -07:00
Augusto Hack 01ee12ba35 bpo-33569 Preserve type information with dataclasses.InitVar (GH-8927) 2019-06-02 22:14:48 -04:00
Victor Stinner 0025350294
bpo-37069: tests use catch_unraisable_exception() (GH-13762)
Modify test_coroutines, test_cprofile, test_generators, test_raise,
test_ssl and test_yield_from to use
support.catch_unraisable_exception() rather than
support.captured_stderr().

test_thread: remove test_save_exception_state_on_error() which is now
updated. test_unraisable_exception() checks that sys.unraisablehook()
is called to handle _thread.start_new_thread() exception.

test_cprofile now rely on unittest for test discovery: replace
support.run_unittest() with unittest.main().
2019-06-03 03:51:43 +02:00
Victor Stinner 3cf7ea1272
bpo-37100: Fix test_coroutines with -Werror (GH-13756)
test_coroutines: test_unawaited_warning_when_module_broken() now uses
support.check_warnings() to catch expected RuntimeWarning.
2019-06-03 01:35:37 +02:00
Xtreak 0d70227e41 Fix typos in docs and docstrings (GH-13745) 2019-06-03 01:12:33 +02:00
Andrew Svetlov c6789d6c85 bpo-35621: Fix tests when SafeChildWatcher is expected instead of ThreadedChildWatcher (GH-13754)
https://bugs.python.org/issue35621
2019-06-02 15:45:54 -07:00
Petr Viktorin fb9423fd0a
bpo-36974: Make tp_call=PyVectorcall_Call work for inherited types (GH-13699)
When inheriting a heap subclass from a vectorcall class that sets
`.tp_call=PyVectorcall_Call` (as recommended in PEP 590), the subclass does
not inherit `_Py_TPFLAGS_HAVE_VECTORCALL`, and thus `PyVectorcall_Call` does
not work for it.

This attempts to solve the issue by:
* always inheriting `tp_vectorcall_offset` unless `tp_call` is overridden
  in the subclass
* inheriting _Py_TPFLAGS_HAVE_VECTORCALL for static types, unless `tp_call`
  is overridden
* making `PyVectorcall_Call` ignore `_Py_TPFLAGS_HAVE_VECTORCALL`

This means it'll be ever more important to only call `PyVectorcall_Call`
on classes that support vectorcall. In `PyVectorcall_Call`'s intended role
as `tp_call` filler, that's not a problem.
2019-06-02 23:52:20 +02:00
Petr Viktorin 64e2c64f7f
test_gdb.test_pycfunction: test more calling conventions (GH-13668)
As the code paths for various METH_* conventions are diverging due
to optimizations, we should check they continue to be covered by
GDB integration.
2019-06-02 23:11:24 +02:00
Victor Stinner cdce0574d0
bpo-36829: test_threading: Fix a ref cycle (GH-13752) 2019-06-02 23:08:41 +02:00
Michele Angrisano aca273e240 bpo-37014: Update docstring and Documentation of fileinput.FileInput(). (GH-13545)
* bpo-37014: Update docstring and Documentation of fileinput.FileInput()

* Explain the behavior of fileinput.FileInput() when reading stdin.

* Update blurb.

* bpo-37014: Fix typo in the docstring and documentation.
2019-06-02 23:01:49 +02:00
Pablo Galindo c0295dba25
bpo-37124: Fix reference leak in test_msilib (GH-13750) 2019-06-02 21:36:21 +01:00
Cheryl Sabella 6bdc4dee01 bpo-35610: IDLE - Replace .context_use_ps1 with .prompt_last_line (GH-11307)
Changes in bpo- 31858 made the less informative 'context_use_ps1' redundant.
2019-06-02 14:56:47 -04:00
Andrew Svetlov 13ed07998a
bpo-35621: Support running subprocesses in asyncio when loop is executed in non-main thread (#13630) 2019-06-02 13:56:38 +03:00
Mark Dickinson c52996785a
bpo-36027: Extend three-argument pow to negative second argument (GH-13266) 2019-06-02 10:24:06 +01:00
Serhiy Storchaka 5ae299ac78
bpo-37128: Add math.perm(). (GH-13731) 2019-06-02 11:16:49 +03:00
Serhiy Storchaka d71f3170ac
Add more tests for preserving identity in marshal. (GH-13736) 2019-06-02 09:03:59 +03:00
Eric Snow 6a150bcaeb
bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (gh-13714) 2019-06-01 15:39:46 -06:00
Serhiy Storchaka bdbad71b9d
bpo-20092. Use __index__ in constructors of int, float and complex. (GH-13108) 2019-06-02 00:05:48 +03:00
Cheryl Sabella 1a4d9ffa1a bpo-32411: IDLE: Remove line number sort in browser.py (#5011)
Insertion in line order makes sorting keys by line order unneeded.
2019-06-01 17:03:22 -04:00
Evan 56624a99a9 bpo-28595: Allow shlex whitespace_split with punctuation_chars (GH-2071) 2019-06-01 20:09:22 +01:00
Serhiy Storchaka 2b843ac0ae
bpo-35431: Refactor math.comb() implementation. (GH-13725)
* Fixed some bugs.
* Added support for index-likes objects.
* Improved error messages.
* Cleaned up and optimized the code.
* Added more tests.
2019-06-01 22:09:02 +03:00
Pablo Galindo cd74e66a8c
bpo-37122: Make co->co_argcount represent the total number of positonal arguments in the code object (GH-13726) 2019-06-01 18:08:04 +01:00
Bar Harel 6b282e1887 bpo-36813: Fix QueueListener to call task_done() upon termination. (GH-13113)
Fixed QueueListener in order to avoid random deadlocks.
Unable to add regression tests atm due to time constraints, will add it in a bit.
Regarding implementation, although it's nested, it does not cause performance issues whatsoever, and does not call task_done() in case of an exception (which is the right thing to do IMHO).


https://bugs.python.org/issue36813
2019-06-01 02:19:09 -07:00
Serhiy Storchaka 2085bd0877
bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700) 2019-06-01 11:00:15 +03:00
Yash Aggarwal 4a686504eb bpo-35431: Implemented math.comb (GH-11414) 2019-06-01 00:21:27 -07:00
Mario Corchero 354227a1e9 Add option to trace to run modules (GH-5134)
Adds a new option in trace that allows tracing runnable modules. It is
exposed as `--module module_name` as `-m` is already in use for another
argument.
2019-06-01 14:49:09 +10:00
Rob Day 664fe3996f bpo-29984: Improve 'heapq' test coverage (GH-992) 2019-05-31 21:13:57 -07:00
Zackery Spytz 549e55a308 bpo-12202: Properly check MsiSummaryInfoGetProperty() calls in msilib (GH-13711) 2019-06-01 03:16:20 +03:00
Ammar Askar a6ec1ce1ac bpo-33361: Fix bug with seeking in StreamRecoders (GH-8278) 2019-05-31 22:44:00 +03:00
Pablo Galindo aac4d0342c
bpo-26826: Expose copy_file_range in the os module (GH-7255) 2019-05-31 19:39:47 +01:00
Zackery Spytz c8d5bf6c3f bpo-12639: msilib.Directory.start_component() fails if *keyfile* is not None (GH-13688)
msilib.Directory.start_component() was passing an extra argument to CAB.gen_id().
2019-05-31 09:43:13 -07:00
Pablo Galindo a0c01bf136
bpo-37115: Support annotations in positional-only arguments (GH-13698) 2019-05-31 15:19:50 +01:00
Pablo Galindo 2f58a84104
bpo-37112: Allow compile to work on AST with positional only arguments with defaults (GH-13697) 2019-05-31 14:09:49 +01:00
Pablo Galindo 3a46d5c293
bpo-37108: Support super with methods that use positional-only arguments (GH-13695) 2019-05-31 12:07:56 +01:00
Zackery Spytz c7f803b08e bpo-36379: __ipow__ must be a ternaryfunc, not a binaryfunc (GH-13546)
If a type's __ipow__ method was implemented in C, attempting to use
the *modulo* parameter would cause crashes.


https://bugs.python.org/issue36379
2019-05-31 02:46:36 -07:00
Christian Heimes c7f7069e77
bpo-34271: Add ssl debugging helpers (GH-10031)
The ssl module now can dump key material to a keylog file and trace TLS
protocol messages with a tracing callback. The default and stdlib
contexts also support SSLKEYLOGFILE env var.

The msg_callback and related enums are private members. The feature
is designed for internal debugging and not for end users.

Signed-off-by: Christian Heimes <christian@python.org>
2019-05-31 11:44:05 +02:00
Serhiy Storchaka e9b51c0ad8
bpo-26660, bpo-35144: Fix permission errors in TemporaryDirectory cleanup. (GH-10320)
TemporaryDirectory.cleanup() failed when non-writeable or non-searchable
files or directories were created inside a temporary directory.
2019-05-31 11:30:37 +03:00
Serhiy Storchaka 38ab7d4721
bpo-31829: Make protocol 0 pickles be loadable in text mode in Python 2. (GH-11859)
Escape ``\r``, ``\0`` and ``\x1a`` (end-of-file on Windows) in Unicode strings.
2019-05-31 11:29:39 +03:00
Terry Jan Reedy ba0430211f
IDLE - Capitalize search dialogs' 'Close' button label. (#13691)
It seems to be the only widget label not capitalized.
2019-05-31 04:26:35 -04:00
Serhiy Storchaka 14a0e16c88
bpo-36548: Improve the repr of re flags. (GH-12715) 2019-05-31 10:39:47 +03:00
Ivan Levkivskyi 4c23aff065
bpo-29262: Add get_origin() and get_args() introspection helpers to typing (GH-13685)
This is an old feature request that appears from time to time. After a year of experimenting with various introspection capabilities in `typing_inspect` on PyPI, I propose to add these two most commonly used functions: `get_origin()` and `get_args()`. These are essentially thin public wrappers around private APIs: `__origin__` and `__args__`.

As discussed in the issue and on the typing tracker, exposing some public helpers instead of `__origin__` and `__args__` directly will give us more flexibility if we will decide to update the internal representation, while still maintaining backwards compatibility.

The implementation is very simple an is essentially a copy from `typing_inspect` with one exception: `ClassVar` was special-cased in `typing_inspect`, but I think this special-casing doesn't really help and only makes things more complicated.
2019-05-31 00:10:07 +01:00
Anthony Sottile 2a58b0636d bpo-5028: Fix up rest of documentation for tokenize documenting line (GH-13686)
https://bugs.python.org/issue5028
2019-05-30 15:06:32 -07:00
Matthias Bussonnier eea47e0939 bpo-36953: Delay removal of ABCs from collections. (GH-13409)
Bump the removal to 3.9, indicate collections.abc available since 3.3,
replace version-changed directive to deprecated-removed.


https://bugs.python.org/issue36953
2019-05-30 14:45:48 -07:00
xdegaye 5437ccca14 bpo-36342: Fix test_multiprocessing in test_venv (GH-12513)
when platform lacks a functioning sem_open implementation



https://bugs.python.org/issue36342
2019-05-30 14:42:29 -07:00
Andrew Carr 1e36f75d63 bpo-5028: fix doc bug for tokenize (GH-11683)
https://bugs.python.org/issue5028
2019-05-30 12:31:51 -07:00
Alex Grönholm 98ef92002e bpo-36999: Add asyncio.Task.get_coro() (GH-13680)
https://bugs.python.org/issue36999
2019-05-30 08:30:09 -07:00
Xtreak 6d0b7470a4 bpo-37099: Silence DeprecationWarning in test_inspect (GH-13679)
Fix DeprecationWarning introduced in aee19f54f6


https://bugs.python.org/issue37099
2019-05-30 05:01:39 -07:00
Zackery Spytz 249b7d59d8 bpo-20602: Do not clear sys.flags and sys.float_info during shutdown (GH-8096)
There is no need to clear these immutable objects during shutdown.
2019-05-30 13:08:24 +02:00
Jeroen Demeyer 735e8afa9e bpo-36974: inherit the vectorcall protocol (GH-13498) 2019-05-30 12:43:19 +02:00
Xtreak 0f39c2b191 bpo-37015: Ensure tasks created by _accept_connection2 due to AsyncMock are completed (GH-13661)
From 3.8 async functions used with mock.patch return an `AsyncMock`. `_accept_connection2` is an async function where create_task is also mocked. Don't mock `create_task` so that tasks are created out of coroutine returned by `AsyncMock` and the tasks are completed.


https://bugs.python.org/issue37015
2019-05-30 03:00:29 -07:00
Christian Heimes 6eb814b8ce
bpo-37098: Skip memfd_create test before Linux 3.17 (GH-13677) 2019-05-30 11:27:06 +02:00
Giampaolo Rodola 413d955f8e
bpo-36610: shutil.copyfile(): use sendfile() on Linux only (GH-13675)
...and avoid using it on Solaris as it can raise EINVAL if offset is equal or bigger than the size of the file
2019-05-30 14:05:41 +08:00
Ying Wang a16387ab2d bpo-24564: shutil.copystat(): ignore EINVAL on os.setxattr() (GH-13369) 2019-05-30 11:25:31 +08:00
Anthony Sottile 8087831231 Don't crash if there exists an EGG-INFO directory on sys.path (#13667)
* Don't crash if there exists an EGG-INFO directory on sys.path

cross-port of https://gitlab.com/python-devs/importlib_metadata/merge_requests/72

* Also catch PermissionError for windows
2019-05-29 17:13:11 -07:00
Pablo Galindo 29cb21ddb9
Regenerate topics file (GH-13642) 2019-05-29 22:59:00 +01:00
Zackery Spytz 8f96c9f8ed bpo-37007: Implement socket.if_nametoindex(), if_indextoname() and if_nameindex() on Windows (GH-13522) 2019-05-29 14:02:37 -07:00
Petr Viktorin fecb75c1bb
bpo-36974: Fix GDB integration (GH-13665)
As it changes the way functions are called, the PEP 590 implementation
skipped the functions that the GDB integration is looking for
(by name) to find function calls.

Looking for the new helper `cfunction_call_varargs` hopefully fixes the
tests, and thus buildbots.

The changed frame nuber in test_gdb is due to there being fewer
C calls when calling a built-in method.
2019-05-29 22:45:41 +02:00
Zackery Spytz 43fdbd2729 bpo-26836: Add os.memfd_create() (#13567)
* bpo-26836: Add os.memfd_create()

* Use the glibc wrapper for memfd_create()

Co-Authored-By: Christian Heimes <christian@python.org>

* Fix deletions caused by autoreconf.

* Use MFD_CLOEXEC as the default value for *flags*.

* Add memset_s to configure.ac.

* Revert memset_s changes.

* Apply the requested changes.

* Tweak the docs.
2019-05-29 21:57:03 +02:00
Gregory P. Smith 0c2f930564
bpo-22385: Support output separators in hex methods. (#13578)
* bpo-22385: Support output separators in hex methods.

Also in binascii.hexlify aka b2a_hex.

The underlying implementation behind all hex generation in CPython uses the
same pystrhex.c implementation.  This adds support to bytes, bytearray,
and memoryview objects.

The binascii module functions exist rather than being slated for deprecation
because they return bytes rather than requiring an intermediate step through a
str object.

This change was inspired by MicroPython which supports sep in its binascii
implementation (and does not yet support the .hex methods).

https://bugs.python.org/issue22385
2019-05-29 11:46:58 -07:00
Jeroen Demeyer aacc77fbd7 bpo-36974: implement PEP 590 (GH-13185)
Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
Co-authored-by: Mark Shannon <mark@hotpy.org>
2019-05-29 20:31:52 +02:00
Anthony Sottile d30da5dd9a bpo-36983: Fix typing.__all__ and add test for exported names (GH-13456)
https://bugs.python.org/issue36983
2019-05-29 11:19:37 -07:00
Steve Dower 9ddc416e9f
bpo-36842: Fix reference leak in tests by running out-of-proc (GH-13556) 2019-05-29 08:20:35 -07:00
Andrew Svetlov 4dd3e3f9bb bpo-32972: Async test case (GH-13386)
Add explicit `asyncSetUp` and `asyncTearDown` methods.
The rest is the same as for #13228

`AsyncTestCase` create a loop instance for every test for the sake of test isolation.
Sometimes a loop shared between all tests can speed up tests execution time a lot but it requires control of closed resources after every test finish. Basically, it requires nested supervisors support that was discussed with @1st1 many times. Sorry, asyncio supervisors have no chance to land on Python 3.8.

The PR intentionally does not provide API for changing the used event loop or getting the test loop: use `asyncio.set_event_loop_policy()` and `asyncio.get_event_loop()` instead.

The PR adds four overridable methods to base `unittest.TestCase` class:
```
    def _callSetUp(self):
        self.setUp()

    def _callTestMethod(self, method):
        method()

    def _callTearDown(self):
        self.tearDown()

    def _callCleanup(self, function, /, *args, **kwargs):
        function(*args, **kwargs)
```
It allows using asyncio facilities with minimal influence on the unittest code.

The last but not least: the PR respects contextvars. The context variable installed by `asyncSetUp` is available on test, `tearDown` and a coroutine scheduled by `addCleanup`.


https://bugs.python.org/issue32972
2019-05-29 02:33:59 -07:00
Bo Bayles ca80495592 bpo-22454: Add shlex.join() (the opposite of shlex.split()) (GH-7605) 2019-05-29 09:06:11 +01:00
Eric V. Smith f83d1dbd3b
bpo-37070: Cleanup fstring debug handling (GH-13607)
* Clean up some comments, fix potential memory leaks, clarify literal and expr_text.
2019-05-29 03:55:44 -04:00
Xtreak 0ae022c6a4 bpo-37075: Fix string concatenation in assert_has_awaits error message (GH-13616)
* Fix the implicit string concatenation in `assert_has_awaits` error message.
* Use "await" instead of "call" in `assert_awaited_with` error message.



https://bugs.python.org/issue37075
2019-05-29 00:02:25 -07:00
依云 744c08a9c7 bpo-35246: fix support for path-like args in asyncio subprocess (GH-13628)
Drop isinstance checks from create_subprocess_exec function and let
subprocess module do them.

https://bugs.python.org/issue35246


https://bugs.python.org/issue35246
2019-05-28 23:50:59 -07:00
Victor Stinner 8b09500345
bpo-37076: _thread.start_new_thread() calls _PyErr_WriteUnraisableMsg() (GH-13617)
_thread.start_new_thread() now logs uncaught exception raised by the
function using sys.unraisablehook(), rather than sys.excepthook(), so
the hook gets access to the function which raised the exception.
2019-05-29 02:57:56 +02:00
Dino Viehland 415406999d
bpo-37001: Makes symtable.symtable have parity with compile for input (#13483)
* Makes symtable.symtable have parity for accepted datatypes
for source code as compile()

* Add NEWS blurb
2019-05-28 16:21:17 -07:00
Francisco Facioni ab0716ed1e bpo-22102: Fixes zip files with disks set to 0 (GH-5985) 2019-05-28 19:15:11 -04:00
Serhiy Storchaka 9e3c452639
bpo-31961: Fix support of path-like executables in subprocess. (GH-5914) 2019-05-28 22:49:35 +03:00
Joannah Nanjekye 2e33ecd7c9 bpo-22640: Add silent mode to py_compile.compile() (GH-12976) 2019-05-28 19:29:04 +03:00
Victor Stinner 17a5588740
bpo-33725: multiprocessing uses spawn by default on macOS (GH-13603)
On macOS, the multiprocessing module now uses the "spawn" start
method by default.
2019-05-28 16:02:50 +02:00
Zackery Spytz 05f16416d9 bpo-26423: Fix possible overflow in wrap_lenfunc() (GH-13606)
Fix possible overflow in wrap_lenfunc() when
sizeof(long) < sizeof(Py_ssize_t) (e.g., 64-bit Windows).
2019-05-28 14:55:28 +02:00
Mario Corchero 04530812e9 bpo-32299: Return patched dict when using patch.dict as a context manager (GH-11062) 2019-05-28 08:53:30 -04:00
Jeroen Demeyer eb65e2443a bpo-36922: implement PEP-590 Py_TPFLAGS_METHOD_DESCRIPTOR (GH-13338)
Co-authored-by: Mark Shannon <mark@hotpy.org>
2019-05-28 14:42:53 +02:00
Inada Naoki 9a7e5b1b42
bpo-35279: reduce default max_workers of ThreadPoolExecutor (GH-13618) 2019-05-28 21:02:52 +09:00
Andrew Svetlov bafd4b5ac8 bpo-29883: Asyncio proactor udp (GH-13440)
Follow-up for #1067


https://bugs.python.org/issue29883
2019-05-28 02:52:15 -07:00
Ivan Levkivskyi 74d7f76e2c
bpo-37058: PEP 544: Add Protocol to typing module (GH-13585)
I tried to get rid of the `_ProtocolMeta`, but unfortunately it didn'y work. My idea to return a generic alias from `@runtime_checkable` made runtime protocols unpickleable. I am not sure what is worse (a custom metaclass or having some classes unpickleable), so I decided to stick with the status quo (since there were no complains so far). So essentially this is a copy of the implementation in `typing_extensions` with two modifications:
* Rename `@runtime` to `@runtime_checkable` (plus corresponding updates).
* Allow protocols that extend `collections.abc.Iterable` etc.
2019-05-28 08:40:15 +01:00
Matthias Bussonnier 3880f263d2 bpo-36933: Remove sys.set_coroutine_wrapper (marked for removal in 3.8) (GH-13577)
It has been documented as deprecated and to be removed in 3.8; 

From a comment on another thread – which I can't find ; leave get_coro_wrapper() for now, but always return `None`.


https://bugs.python.org/issue36933
2019-05-28 00:10:59 -07:00
Xtreak 436c2b0d67 bpo-36996: Handle async functions when mock.patch is used as a decorator (GH-13562)
Return a coroutine while patching async functions with a decorator. 

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>


https://bugs.python.org/issue36996
2019-05-28 00:07:38 -07:00
sbstp f0d4c64019 bpo-36686: Improve the documentation of the std* params in loop.subprocess_exec (GH-13586)
https://bugs.python.org/issue36686
2019-05-27 16:51:19 -07:00
Victor Stinner a3568417c4
bpo-37054, _pyio: Fix BytesIO and TextIOWrapper __del__() (GH-13601)
Fix destructor _pyio.BytesIO and _pyio.TextIOWrapper: initialize
their _buffer attribute as soon as possible (in the class body),
because it's used by __del__() which calls close().
2019-05-28 01:44:21 +02:00
Terry Jan Reedy df9b032f47
bpo-37039: IDLE - zoomheight fixes (GH-13576)
Move doc entry to match menu and refactor zoom function.
A followup patch will include a blurb.
2019-05-27 19:16:46 -04:00
Victor Stinner cd590a7ced
bpo-1230540: Add threading.excepthook() (GH-13515)
Add a new threading.excepthook() function which handles uncaught
Thread.run() exception. It can be overridden to control how uncaught
exceptions are handled.

threading.ExceptHookArgs is not documented on purpose: it should not
be used directly.

* threading.excepthook() and threading.ExceptHookArgs.
* Add _PyErr_Display(): similar to PyErr_Display(), but accept a
  'file' parameter.
* Add _thread._excepthook(): C implementation of the exception hook
  calling _PyErr_Display().
* Add _thread._ExceptHookArgs: structseq type.
* Add threading._invoke_excepthook_wrapper() which handles the gory
  details to ensure that everything remains alive during Python
  shutdown.
* Add unit tests.
2019-05-28 00:39:52 +02:00
Andrew Svetlov 23b4b697e5 bpo-36889: Merge asyncio streams (GH-13251)
https://bugs.python.org/issue36889
2019-05-27 12:56:22 -07:00
Eric V. Smith 6f6ff8a565
bpo-37050: Remove expr_text from FormattedValue ast node, use Constant node instead (GH-13597)
When using the "=" debug functionality of f-strings, use another Constant node (or a merged constant node) instead of adding expr_text to the FormattedValue node.
2019-05-27 15:31:52 -04:00
Antoine Pitrou 695b1dd8cb bpo-32941: Fix test_madvise failure when page size >= 8kiB (GH-13596)
https://bugs.python.org/issue32941
2019-05-27 10:57:23 -07:00
Zackery Spytz 02db696732 bpo-32941: Add madvise() for mmap objects (GH-6172)
Allow mmap objects to access the madvise() system call.
2019-05-27 18:48:16 +02:00
Victor Stinner 331a6a56e9
bpo-36763: Implement the PEP 587 (GH-13592)
* Add a whole new documentation page:
  "Python Initialization Configuration"
* PyWideStringList_Append() return type is now PyStatus,
  instead of int
* PyInterpreterState_New() now calls PyConfig_Clear() if
  PyConfig_InitPythonConfig() fails.
* Rename files:

  * Python/coreconfig.c => Python/initconfig.c
  * Include/cpython/coreconfig.h => Include/cpython/initconfig.h
  * Include/internal/: pycore_coreconfig.h => pycore_initconfig.h

* Rename structures

  * _PyCoreConfig => PyConfig
  * _PyPreConfig => PyPreConfig
  * _PyInitError => PyStatus
  * _PyWstrList => PyWideStringList

* Rename PyConfig fields:

  * use_module_search_paths => module_search_paths_set
  * module_search_path_env => pythonpath_env

* Rename PyStatus field: _func => func
* PyInterpreterState: rename core_config field to config
* Rename macros and functions:

  * _PyCoreConfig_SetArgv() => PyConfig_SetBytesArgv()
  * _PyCoreConfig_SetWideArgv() => PyConfig_SetArgv()
  * _PyCoreConfig_DecodeLocale() => PyConfig_SetBytesString()
  * _PyInitError_Failed() => PyStatus_Exception()
  * _Py_INIT_ERROR_TYPE_xxx enums => _PyStatus_TYPE_xxx
  * _Py_UnixMain() => Py_BytesMain()
  * _Py_ExitInitError() => Py_ExitStatusException()
  * _Py_PreInitializeFromArgs() => Py_PreInitializeFromBytesArgs()
  * _Py_PreInitializeFromWideArgs() => Py_PreInitializeFromArgs()
  * _Py_PreInitialize() => Py_PreInitialize()
  * _Py_RunMain() => Py_RunMain()
  * _Py_InitializeFromConfig() => Py_InitializeFromConfig()
  * _Py_INIT_XXX() => _PyStatus_XXX()
  * _Py_INIT_FAILED() => _PyStatus_EXCEPTION()

* Rename 'err' PyStatus variables to 'status'
* Convert RUN_CODE() macro to config_run_code() static inline function
* Remove functions:

  * _Py_InitializeFromArgs()
  * _Py_InitializeFromWideArgs()
  * _PyInterpreterState_GetCoreConfig()
2019-05-27 16:39:22 +02:00
Yury Selivanov 8cd5165ba0 bpo-37027: Return a proxy socket object from transp.get_extra_info('socket') (GH-13530)
Return a safe to use proxy socket object from `transport.get_extra_info('socket')`




https://bugs.python.org/issue37027
2019-05-27 06:57:19 -07:00
Rémi Lapeyre 674ee12600 bpo-35397: Remove deprecation and document urllib.parse.unwrap (GH-11481) 2019-05-27 09:43:45 -04:00
Andrew Svetlov 1f39c28e48 bpo-37035: Don't log OSError (GH-13548)
https://bugs.python.org/issue37035
2019-05-27 06:28:34 -07:00
Xtreak ff6b2e66b1 bpo-37047: Refactor AsyncMock setup logic for autospeccing (GH-13574)
Handle late binding and attribute access in unittest.mock.AsyncMock
setup for autospeccing.
2019-05-27 14:56:23 +02:00
Yury Selivanov 431b540bf7
bpo-32528: Make asyncio.CancelledError a BaseException. (GH-13528)
This will address the common mistake many asyncio users make:
an "except Exception" clause breaking Tasks cancellation.

In addition to this change, we stop inheriting asyncio.TimeoutError
and asyncio.InvalidStateError from their concurrent.futures.*
counterparts.  There's no point for these exceptions to share the
inheritance chain.

In 3.9 we'll focus on implementing supervisors and cancel scopes,
which should allow better handling of all exceptions, including
SystemExit and KeyboardInterrupt
2019-05-27 14:45:12 +02:00
Yury Selivanov 16cefb0bc7
bpo-37028: asyncio REPL; activated via 'python -m asyncio'. (GH-13472)
This makes it easy to play with asyncio APIs with simply
using async/await in the REPL.
2019-05-27 13:42:29 +02:00
Victor Stinner 71c52e3048
bpo-36829: Add _PyErr_WriteUnraisableMsg() (GH-13488)
* sys.unraisablehook: add 'err_msg' field to UnraisableHookArgs.
* Use _PyErr_WriteUnraisableMsg() in _ctypes _DictRemover_call()
  and gc delete_garbage().
2019-05-27 08:57:14 +02:00
Ivan Levkivskyi 2f0bfd27a5
Add one more test for typing.Final (GH-13588) 2019-05-27 00:54:13 +01:00
Raymond Hettinger b821868e6d
bpo-36772 Allow lru_cache to be used as decorator without making a function call (GH-13048) 2019-05-26 11:27:35 -07:00
Chih-Hsuan Yen aaf47caf35 bpo-37053: handle strings like u"bar" correctly in Tools/parser/unparse.py (GH-13583)
Constant.kind is added in https://bugs.python.org/issue36280.
Current possible values for Constant.kind are "u" or None.

For r'bar' and b'bar', Constant.kind value is None, so there's no need
for special handling.


https://bugs.python.org/issue37053
2019-05-26 10:08:19 -07:00
Antoine Pitrou 91f4380ced
bpo-36785: PEP 574 implementation (GH-7076) 2019-05-26 17:10:09 +02:00
Ivan Levkivskyi 135c6a56e5
bpo-37049: PEP 589: Add TypedDict to typing module (GH-13573)
The implementation is straightforward and essentially is just copied from `typing_extensions`.
2019-05-26 09:39:24 +01:00
Ivan Levkivskyi b891c465bb
bpo-37046: PEP 586: Add Literal to typing module (#13572)
The implementation is straightforward and essentially is just copied from `typing_extensions`.
2019-05-26 09:37:48 +01:00
Ivan Levkivskyi f367242d10
bpo-37045: PEP 591: Add final qualifiers to typing module (GH-13571)
The implementation is straightforward, it just mimics `ClassVar` (since the latter is also a name/access qualifier, not really a type). Also it is essentially copied from `typing_extensions`.
2019-05-26 09:37:07 +01:00
Terry Jan Reedy 81bb97df61
bpo-37038: Make idlelib.run runnable; add test clause (GH-13560) 2019-05-24 21:59:53 -04:00
Jason R. Coombs 1bbf7b661f bpo-34632: Add importlib.metadata (GH-12547)
Add importlib.metadata module as forward port of the standalone importlib_metadata.
2019-05-24 16:59:01 -07:00
Victor Stinner 6dbbe748e1
bpo-36829: Document test.support.catch_unraisable_exception() (GH-13554)
catch_unraisable_exception() now also removes its 'unraisable'
attribute at the context manager exit.
2019-05-25 00:09:38 +02:00
Victor Stinner a9f05d69cc
bpo-37032: Add CodeType.replace() method (GH-13542) 2019-05-24 23:57:23 +02:00
Rémi Lapeyre 458560347f bpo-36969: Make PDB args command display positional only arguments (GH-13459) 2019-05-24 21:44:31 +01:00
Steve Dower 6de4574c63
bpo-37023: Skip test_gdb under PGO (GH-13555) 2019-05-24 13:00:04 -07:00
Berker Peksag 14738ff83d
bpo-8138: Initialize wsgiref's SimpleServer as single-threaded (GH-12977) 2019-05-24 20:24:42 +03:00
E. M. Bray c994c8fc19 bpo-21536: On Cygwin, C extensions must be linked with libpython (GH-13549)
It is also possible to link against a library or executable with a
statically linked libpython, but not both with the same DLL.  In fact
building a statically linked python is currently broken on Cygwin
for other (related) reasons.

The same problem applies to other POSIX-like layers over Windows
(MinGW, MSYS) but Python's build system does not seem to attempt
to support those platforms at the moment.
2019-05-24 17:33:47 +02:00
Dan Rose 2a37f8f55b bpo-36045: builtins.help() now prefixes `async` for async functions (GH-12010)
Previously, it was hard to tell whether a function should be awaited. It was also incorrect (per PEP 484) to put this in the type hint for coroutine functions. Added this info to the output of builtins.help and pydoc.


https://bugs.python.org/issue36045
2019-05-24 04:38:01 -07:00
Cheryl Sabella c95c93d4eb
bpo-20285: Improve help docs for object (GH-4759) 2019-05-24 06:43:29 -04:00
Matěj Cepl 608876b6b1 bpo-23395: Fix PyErr_SetInterrupt if the SIGINT signal is ignored or not handled (GH-7778)
``_thread.interrupt_main()`` now avoids setting the Python error status if the ``SIGINT`` signal is ignored or not handled by Python.
2019-05-23 22:30:00 +02:00
Steve Dower b82e17e626
bpo-36842: Implement PEP 578 (GH-12613)
Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
2019-05-23 08:45:22 -07:00
Damien Nadé 394119afc6 bpo-37008: make mock_open handle able to honor next() (GH-13492)
I've reported the issue on https://bugs.python.org/issue37008 and now I'm trying to bring a solution to this minor issue.

I think it could be trivially backported to 3.7 branch.


https://bugs.python.org/issue37008
2019-05-23 03:03:25 -07:00
Victor Stinner 20e1e2582e
bpo-36763: Fix _PyPreConfig_InitCompatConfig() utf8_mode (GH-13518)
* _PyPreConfig_InitCompatConfig() sets utf8_mode to 0.
* Change Py_UTF8Mode default value to 0.
* Fix _PyPreConfig_Copy(): copy also _config_init attrbibute.
* _PyPreConfig_AsDict() exports _config_init
* Fix _PyPreConfig_GetGlobalConfig(): use Py_UTF8Mode if it's greater
  than 0, even if utf8_mode >= 0.
* Add unit tests on environment variables using Python API.
2019-05-23 04:12:27 +02:00
Victor Stinner bc2aa81662
bpo-18748: _pyio.IOBase emits unraisable exception (GH-13512)
In development (-X dev) mode and in a debug build, IOBase finalizer
of the _pyio module now logs the exception if the close() method
fails. The exception is ignored silently by default in release build.

test_io: test_error_through_destructor() now uses
support.catch_unraisable_exception() rather than capturing stderr.
2019-05-23 03:45:09 +02:00
Batuhan Taşkaya ef5bb25e2d bpo-27737: Allow whitespace only headers encoding (#13478) 2019-05-22 21:13:16 -04:00
Victor Stinner df22c03b93
bpo-36829: PyErr_WriteUnraisable() normalizes exception (GH-13507)
PyErr_WriteUnraisable() now creates a traceback object if there is no
current traceback. Moreover, call PyErr_NormalizeException() and
PyException_SetTraceback() to normalize the exception value. Ignore
silently any error.
2019-05-23 01:00:58 +02:00
Victor Stinner 5edcf26358
bpo-36763: Rename private Python initialization functions (GH-13511)
* Rename private C functions:

  * _Py_Initialize_ReconfigureCore => pyinit_core_reconfigure
  * _Py_InitializeCore_impl => pyinit_core_config
  * _Py_InitializeCore = > pyinit_core
  * _Py_InitializeMainInterpreter => pyinit_main
  * init_python => pyinit_python

* Rename _testembed.c commands: add "test_" prefix.
2019-05-23 00:57:57 +02:00
Victor Stinner 022be02dcf
bpo-36763: Add _PyPreConfig._config_init (GH-13481)
* _PyPreConfig_GetGlobalConfig() and  _PyCoreConfig_GetGlobalConfig()
  now do nothing if the configuration was not initialized with
  _PyPreConfig_InitCompatConfig() and _PyCoreConfig_InitCompatConfig()
* Remove utf8_mode=-2 special case: use utf8_mode=-1 instead.
* Fix _PyPreConfig_InitPythonConfig():

  * isolated = 0 instead of -1
  * use_environment = 1 instead of -1

* Rename _PyConfig_INIT to  _PyConfig_INIT_COMPAT
* Rename _PyPreConfig_Init() to _PyPreConfig_InitCompatConfig()
* Rename _PyCoreConfig_Init() to _PyCoreConfig_InitCompatConfig()
* PyInterpreterState_New() now uses _PyCoreConfig_InitPythonConfig()
  as default configuration, but it's very quickly overriden anyway.
* _freeze_importlib.c uses _PyCoreConfig_SetString() to set
  program_name.
* Cleanup preconfig_init_utf8_mode(): cmdline is always non-NULL.
2019-05-22 23:58:50 +02:00
Victor Stinner e4d300e07c
bpo-36829: Add test.support.catch_unraisable_exception() (GH-13490)
* Copy test_exceptions.test_unraisable() to
  test_sys.UnraisableHookTest().
* Use catch_unraisable_exception() in test_coroutines,
  test_exceptions, test_generators.
2019-05-22 23:44:02 +02:00
Sean 904e34d4e6 bpo-24882: Let ThreadPoolExecutor reuse idle threads before creating new thread (#6375)
* Fixes issue 24882

* Add news file entry for change.

* Change test_concurrent_futures.ThreadPoolShutdownTest

Adjust the shutdown test so that, after submitting three jobs
to the executor, the test checks for less than three threads,
instead of looking for exactly three threads.

If idle threads are being recycled properly, then we should have
less than three threads.

* Switched idle count to semaphor, Updated tests

As suggested by reviewer tomMoral, swapped lock-protected counter
with a semaphore to track the number of unused threads.

Adjusted test_threads_terminate to wait for completiton of the
previous future before submitting a new one (and checking the
number of threads used).

Also added a new test to confirm the thread pool can be saturated.

* Updates tests as requested by pitrou.

* Correct minor whitespace error.

* Make test_saturation faster
2019-05-22 23:29:58 +02:00
Sam Martin 2a3a2ece50 bpo-33110: Catch errors raised when running add_done_callback on already completed futures (GH-13141)
Wrap the callback call within the `add_done_callback` function within concurrent.futures, in order to behave in an identical manner to callbacks added to a running future are triggered once it has completed.
2019-05-22 23:29:02 +02:00
Michael J. Sullivan d8a82e2897 bpo-36878: Only allow text after `# type: ignore` if first character ASCII (GH-13504)
This disallows things like `# type: ignoreé`, which seems wrong.

Also switch to using Py_ISALNUM for the alnum check, for consistency
with other code (and maybe correctness re: locale issues?).


https://bugs.python.org/issue36878
2019-05-22 13:43:36 -07:00
Victor Stinner 0c2b6a3943
bpo-35907, CVE-2019-9948: urllib rejects local_file:// scheme (GH-13474)
CVE-2019-9948: Avoid file reading as disallowing the unnecessary URL
scheme in URLopener().open() and URLopener().retrieve()
of urllib.request.

Co-Authored-By: SH <push0ebp@gmail.com>
2019-05-22 22:15:01 +02:00
Jake Tesler b121f63155 bpo-36084: Add native thread ID (TID) to threading.Thread (GH-13463)
Add native thread ID (TID) to threading.Thread objects
(supported platforms: Windows, FreeBSD, Linux, macOS).
2019-05-22 17:43:16 +02:00
Jelle Zijlstra b3be407288 bpo-33482: fix codecs.StreamRecoder.writelines (GH-6779)
A very simple fix. I found this while writing typeshed stubs for StreamRecoder.


https://bugs.python.org/issue33482
2019-05-22 08:18:26 -07:00
Michael J. Sullivan 933e1509ec bpo-36878: Track extra text added to 'type: ignore' in the AST (GH-13479)
GH-13238 made extra text after a # type: ignore accepted by the parser.
This finishes the job and actually plumbs the extra text through the
parser and makes it available in the AST.
2019-05-22 15:54:20 +01:00
Paul Dagnelie 4c7a46eb3c bpo-36972: Add SupportsIndex (GH-13448)
In order to support typing checks calling hex(), oct() and bin() on user-defined classes, a SupportIndex protocol is required. The ability to check these at runtime would be good to add for completeness sake. This is pretty much just a copy of SupportsInt with the names tweaked.
2019-05-22 15:23:01 +01:00
Marcel Plch 33e71e01e9 bpo-31862: Port binascii to PEP 489 multiphase initialization (GH-4108) 2019-05-22 13:51:25 +02:00
Jeroen Demeyer 77aa396bb9 bpo-36907: fix refcount bug in _PyStack_UnpackDict() (GH-13381) 2019-05-22 13:09:35 +02:00
Jeroen Demeyer b892d3ea46 bpo-36994: add test for profiling method_descriptor with **kwargs (GH-13461)
It adds a missing testcase for bpo-34125. This is testing code which is
affected by PEP 590, so missing this test might accidentally break
CPython if we screw up with implementing PEP 590.
2019-05-22 22:05:02 +12:00
Victor Stinner ef9d9b6312
bpo-36829: Add sys.unraisablehook() (GH-13187)
Add new sys.unraisablehook() function which can be overridden to
control how "unraisable exceptions" are handled. It is called when an
exception has occurred but there is no way for Python to handle it.
For example, when a destructor raises an exception or during garbage
collection (gc.collect()).

Changes:

* Add an internal UnraisableHookArgs type used to pass arguments to
  sys.unraisablehook.
* Add _PyErr_WriteUnraisableDefaultHook().
* The default hook now ignores exception on writing the traceback.
* test_sys now uses unittest.main() to automatically discover tests:
  remove test_main().
* Add _PyErr_Init().
* Fix PyErr_WriteUnraisable(): hold a strong reference to sys.stderr
  while using it
2019-05-22 11:28:22 +02:00
Berker Peksag 2725cb01d7
bpo-36948: Fix test_urlopener_retrieve_file on Windows (GH-13476) 2019-05-22 02:00:35 +03:00
Yury Selivanov eca18aac7b bpo-34616: Fix code style and unbreak buildbots (GH-13473)
See also PR GH-13148.
2019-05-21 17:20:21 -04:00
Batuhan Taşkaya 7abf8c6081 bpo-25652: Fix __rmod__ of UserString (GH-13326)
The ``__rmod__`` method of ``collections.UserString`` class had a bug that made it unusable. 


https://bugs.python.org/issue25652
2019-05-21 13:27:36 -07:00
Matthias Bussonnier 565b4f1ac7 bpo-34616: Add PyCF_ALLOW_TOP_LEVEL_AWAIT to allow top-level await (GH-13148)
Co-Authored-By: Yury Selivanov <yury@magic.io>
2019-05-21 16:12:02 -04:00
Batuhan Taşkaya aa32a7e111 bpo-23378: Add an extend action to argparse (GH-13305)
Add an extend action to argparse


https://bugs.python.org/issue23378
2019-05-21 10:47:42 -07:00
Jörg Stucke d5c120f7eb bpo-36035: fix Path.rglob for broken links (GH-11988)
Links creating an infinite symlink loop would raise an exception.
2019-05-21 19:44:40 +02:00
Max Bernstein ccb7ca728e bpo-36929: Modify io/re tests to allow for missing mod name (#13392)
* bpo-36929: Modify io/re tests to allow for missing mod name

For a vanishingly small number of internal types, CPython sets the
tp_name slot to mod_name.type_name, either in the PyTypeObject or the
PyType_Spec. There are a few minor places where this surfaces:

* Custom repr functions for those types (some of which ignore the
  tp_name in favor of using a string literal, such as _io.TextIOWrapper)
* Pickling error messages

The test suite only tests the former. This commit modifies the test
suite to allow Python implementations to omit the module prefix.

https://bugs.python.org/issue36929
2019-05-21 10:09:21 -07:00
pxinwr f2d7ac7e5b bpo-31904: Add posix module support for VxWorks (GH-12118) 2019-05-21 12:46:37 +02:00
Victor Stinner d12e75734d
Revert "bpo-36084: Add native thread ID to threading.Thread objects (GH-11993)" (GH-13458)
This reverts commit 4959c33d25.
2019-05-21 12:44:57 +02:00
Xtreak e7cb23bf20 Fix RuntimeWarning in unittest.mock asyncio example (GH-13449)
* This PR fixes the `RuntimeWarning` in `inspect.isawaitable(mock())` where `mock()` was not awaited.
* Fix typo in asynctest project.
2019-05-21 01:47:17 -07:00
Matthias Bussonnier d0ebf13e50 bpo-36932: use proper deprecation-removed directive (GH-13349)
.. And update some deprecation warnings with version numbers.




https://bugs.python.org/issue36932
2019-05-20 23:20:10 -07:00
Rémi Lapeyre bf457c7d82 bpo-36969: Make PDB args command display keyword only arguments (GH-13452) 2019-05-20 23:17:30 +01:00
Matthias Bussonnier 1a3faf9d97 bpo-36952: Remove the bufsize parameter in fileinput.input(). (GH-13400)
This parameter is marked as deprecated since 3.6 and for removal in 3.8.
It already had no effects.
2019-05-20 23:44:11 +03:00
Batuhan Taşkaya 4011d865d0 bpo-23896: Add a grammar where exec isn't a stmt (#13272)
https://bugs.python.org/issue23896
2019-05-20 13:27:10 -07:00
Thomas Moreau c09a9f56c0 bpo-36888: Add multiprocessing.parent_process() (GH-13247) 2019-05-20 21:37:05 +02:00
Batuhan Taşkaya 5ae1c84bcd bpo-36949: Implement __repr__ on WeakSet (GH-13415) 2019-05-20 10:01:07 -07:00
Lisa Roach 77b3b7701a
bpo-26467: Adds AsyncMock for asyncio Mock library support (GH-9296) 2019-05-20 09:19:53 -07:00
Andrew Svetlov 45a24b85f3
Pass _asyncio_internal=True into stream tests on windows (#13442) 2019-05-20 17:38:57 +03:00
Victor Stinner 425717fee1
bpo-36763: Fix encoding/locale tests in test_embed (GH-13443)
* Fix encoding and locale tests in test_embed.InitConfigTests.
* InitConfigTests now only computes EXPECTED_CONFIG once.
* Add tests for PYTHONWARNINGS and PYTHONPATH env vars
2019-05-20 16:38:48 +02:00
Niklas Fiekas 9932fd91e8 bpo-35721: Close socket pair if Popen in _UnixSubprocessTransport fails (GH-11553)
This slightly expands an existing test case `test_popen_error` to trigger a `ResourceWarning` and fixes it.


https://bugs.python.org/issue35721
2019-05-20 05:02:16 -07:00
Victor Stinner 6d1c46746e
bpo-36763: Fix Python preinitialization (GH-13432)
* Add _PyPreConfig.parse_argv
* Add _PyCoreConfig._config_init field and _PyCoreConfigInitEnum enum
  type
* Initialization functions: reject preconfig=NULL and config=NULL
* Add config parameter to _PyCoreConfig_DecodeLocaleErr(): pass
  config->argv to _Py_PreInitializeFromPyArgv(), to parse config
  command line arguments in preinitialization.
* Add config parameter to _PyCoreConfig_SetString(). It now
  preinitializes Python.
* _PyCoreConfig_SetPyArgv() now also preinitializes Python for wide
  argv
* Fix _Py_PreInitializeFromCoreConfig(): don't pass args to
  _Py_PreInitializeFromPyArgv() if config.parse_argv=0.
* Use "char * const *" and "wchar_t * const *" types for 'argv'
  parameters and _PyArgv.argv.
* Add unit test on preinitialization from argv.
* _PyPreConfig.allocator type becomes int
* Add _PyPreConfig_InitFromPreConfig() and
  _PyPreConfig_InitFromCoreConfig() helper functions
2019-05-20 11:02:00 +02:00
Terry Jan Reedy 6d965b39b7
bpo-36958: In IDLE, print exit message (GH-13435)
Print any argument other than None or int passed to SystemExit
or sys.exit().
2019-05-19 22:52:22 -04:00
Lysandros Nikolaou d673810b9d bpo-35252: Remove FIXME from test_functools (GH-10551) 2019-05-19 15:11:20 -07:00
Mark Dickinson 5c08ce9bf7
bpo-36957: Speed up math.isqrt (#13405)
* Add math.isqrt function computing the integer square root.

* Code cleanup: remove redundant comments, rename some variables.

* Tighten up code a bit more; use Py_XDECREF to simplify error handling.

* Update Modules/mathmodule.c

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>

* Update Modules/mathmodule.c

Use real argument clinic type instead of an alias

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>

* Add proof sketch

* Updates from review.

* Correct and expand documentation.

* Fix bad reference handling on error; make some variables block-local; other tidying.

* Style and consistency fixes.

* Add missing error check; don't try to DECREF a NULL a

* Simplify some error returns.

* Another two test cases:

- clarify that floats are rejected even if they happen to be
  squares of small integers
- TypeError beats ValueError for a negative float

* Add fast path for small inputs. Needs tests.

* Speed up isqrt for n >= 2**64 as well; add extra tests.

* Reduce number of test-cases to avoid dominating the run-time of test_math.

* Don't perform unnecessary extra iterations when computing c_bit_length.

* Abstract common uint64_t code out into a separate function.

* Cleanup.

* Add a missing Py_DECREF in an error branch. More cleanup.

* Update Modules/mathmodule.c

Add missing `static` declaration to helper function.

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>

* Add missing backtick.
2019-05-19 17:51:56 +01:00
Berker Peksag 7c59362a15
bpo-29183: Fix double exceptions in wsgiref.handlers.BaseHandler (GH-12914) 2019-05-19 18:56:15 +03:00
Bar Harel f4e1babf44 bpo-27141: Fix collections.UserList and UserDict shallow copy. (GH-4094) 2019-05-19 16:57:13 +03:00
Xtreak c661b30f89 bpo-36948: Fix NameError in urllib.request.URLopener.retrieve (GH-13389) 2019-05-19 16:40:05 +03:00
Ashwin Ramaswami f665b96e92 Fix typo in test comment (GH-11442) 2019-05-18 21:17:47 -04:00
Pablo Galindo da6129e821
bpo-36961: Handle positional-only arguments in uparse.c (GH-13412) 2019-05-18 23:40:22 +01:00
Batuhan Taşkaya fa19a25c23 Add support for PEP572 in ast_unparse.c (GH-13337) 2019-05-18 23:10:20 +01:00
Anthony Sottile abea73bf4a bpo-2180: Treat line continuation at EOF as a `SyntaxError` (GH-13401)
This makes the parser consistent with the tokenize module (already the case
in `pypy`).

sample
------

```python
x = 5\
```

before
------

```console
$ python3 t.py
$ python3 -mtokenize t.py
t.py:2:0: error: EOF in multi-line statement
```

after
-----

```console
$ ./python t.py
  File "t.py", line 3
    x = 5\

         ^
SyntaxError: unexpected EOF while parsing
$ ./python -m tokenize t.py
t.py:2:0: error: EOF in multi-line statement
```



https://bugs.python.org/issue2180
2019-05-18 11:27:16 -07:00
Raymond Hettinger e917f2ed9a
bpo-36546: Add more tests and expand docs (#13406) 2019-05-18 10:18:29 -07:00
Mark Dickinson 73934b9da0
bpo-36887: add math.isqrt (GH-13244)
* Add math.isqrt function computing the integer square root.

* Code cleanup: remove redundant comments, rename some variables.

* Tighten up code a bit more; use Py_XDECREF to simplify error handling.

* Update Modules/mathmodule.c

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>

* Update Modules/mathmodule.c

Use real argument clinic type instead of an alias

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>

* Add proof sketch

* Updates from review.

* Correct and expand documentation.

* Fix bad reference handling on error; make some variables block-local; other tidying.

* Style and consistency fixes.

* Add missing error check; don't try to DECREF a NULL a

* Simplify some error returns.

* Another two test cases:

- clarify that floats are rejected even if they happen to be
  squares of small integers
- TypeError beats ValueError for a negative float

* Documentation and markup improvements; thanks Serhiy for the suggestions!

* Cleaner Misc/NEWS entry wording.

* Clean up (with one fix) to the algorithm explanation and proof.
2019-05-18 12:29:50 +01:00
Victor Stinner 410759fba8
bpo-36763: Remove _PyCoreConfig.dll_path (GH-13402) 2019-05-18 04:17:01 +02:00
Victor Stinner bab0db6076
bpo-36763: Use _PyCoreConfig_InitPythonConfig() (GH-13398)
_PyPreConfig_InitPythonConfig() and _PyCoreConfig_InitPythonConfig()
no longer inherit their values from global configuration variables.

Changes:

* _PyPreCmdline_Read() now ignores -X dev and PYTHONDEVMODE
  if dev_mode is already set.
* Inline _PyPreConfig_INIT macro into _PyPreConfig_Init() function.
* Inline _PyCoreConfig_INIT macro into _PyCoreConfig_Init() function.
* Replace _PyCoreConfig_Init() with _PyCoreConfig_InitPythonConfig()
  in most tests of _testembed.c.
* Replace _PyCoreConfig_Init() with _PyCoreConfig_InitIsolatedConfig()
  in _freeze_importlib.c.
* Move some initialization functions from the internal
  to the private API.
2019-05-18 03:21:27 +02:00
Victor Stinner bcfbbd7046
bpo-36945: Add _PyPreConfig.configure_locale (GH-13368)
_PyPreConfig_InitIsolatedConfig() sets configure_locale to 0 to
prevent Python to modify the LC_CTYPE locale. In that case,
coerce_c_locale an coerce_c_locale_warn are set to 0 as well.
2019-05-17 22:44:16 +02:00
Edison A 98ff4d5fb6 bpo-36782: Created C API wrappers and added missing tests for functions in the PyDateTimeAPI. (#13088)
* created a c API wrapper for pyDate_FromDate and added the test

* 📜🤖 Added by blurb_it.

* fixed auto-alignment by vscode

* made changes as per PEP7

* Update 2019-05-04-21-25-19.bpo-36782.h3oPIb.rst

* Refactored code as per requested changes

* Remove Whitespace to Fix failed travis build

* Update 2019-05-04-21-25-19.bpo-36782.h3oPIb.rst

* Add a new line at end of ACKS

* Added C API function for PyDateTime_FromDateAndTime

* Added a test for the C API wrapper of PyDateTime_FromDateAndTime

* Added C API function for PyDateTime_FromDateAndTime

* Added a test for the C API wrapper of PyDateTime_FromDateAndTimeAndFold

* Remove Whitespace using patchcheck

* Added a C API function for PyTime_FromTime

* Added a test for the C API wrapper of PyTime_FromTime

* Added a C API function for PyTime_FromTimeAndFold

* Added a test for the C API wrapper of PyTime_FromTimeAndFold

* Added a C API function for PyDelta_FromDSU

* Added a test for the C API wrapper of PyDelta_FromDSU

* Refactor code, re-edit lines longer than 80 chars

* Fix Whitespace issues in DatetimeTester

* List all tests that were added in this PR

* Update 2019-05-04-21-25-19.bpo-36782.h3oPIb.rst

* Reformat code as per PEP7 guidelines

* Remove unused varibles from another function

* Added specific tests for the Fold Attribute

* Update 2019-05-04-21-25-19.bpo-36782.h3oPIb.rst

* Reformat code according to requested changes

* Reformat code to PEP7 Guidelines

* Reformat code to PEP7 Guidelines

* Re-add name to blurb

* Added a backtick to blurb file

* Update 2019-05-04-21-25-19.bpo-36782.h3oPIb.rst

* Remove the need to initialize mandatory parameters

* Make the macro parameter mandatory

* Re-arrange the order of unit-test args

* Removed the need to initialize macro

change all the int macro = 0 to int macro; now that macro is required

Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>

* Removed the need to initialize macro

change all the `int macro = 0` to `int macro`; now that macro is required

Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>

* Removed the need to initialize macro

change all the `int macro = 0` to `int macro`; now that macro is required

Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>

* Removed the need to initialize macro

change all the `int macro = 0` to `int macro`; now that macro is required

Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>

* Removed the need to initialize macro

change all the `int macro = 0` to `int macro`; now that macro is required

Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>

* Removed the need to initialize macro

change all the `int macro = 0` to `int macro`; now that macro is required

Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>
2019-05-17 22:28:42 +02:00
Abhilash Raj feac6cd775 bpo-33524: Fix the folding of email header when max_line_length is 0 or None (#13391)
and there are non-ascii characters in the header.
2019-05-17 15:28:44 -04:00
Pierre Glaser cbe72d8426 bpo-36867: _test_multiprocessing: avoid weak sync primitive (GH-13292)
Avoid weak sync primitive in multiprocessing resource_tracker test.
2019-05-17 20:20:07 +02:00
Victor Stinner cab5d0741e
bpo-36763: Add _PyCoreConfig_InitPythonConfig() (GH-13388)
Add new functions to get the Python interpreter behavior:

* _PyPreConfig_InitPythonConfig()
* _PyCoreConfig_InitPythonConfig()

Add new functions to get an isolated configuration:

* _PyPreConfig_InitIsolatedConfig()
* _PyCoreConfig_InitIsolatedConfig()

Replace _PyPreConfig_INIT and _PyCoreConfig_INIT with new functions
_PyPreConfig_Init() and _PyCoreConfig_Init().

_PyCoreConfig: set configure_c_stdio and parse_argv to 0 by default
to behave as Python 3.6 in the default configuration.

_PyCoreConfig_Read() no longer sets coerce_c_locale_warn to 1 if it's
equal to 0. coerce_c_locale_warn must now be set to -1 (ex: using
_PyCoreConfig_InitPythonConfig()) to enable C locale coercion
warning.

Add unit tests for _PyCoreConfig_InitPythonConfig()
and _PyCoreConfig_InitIsolatedConfig().

Changes:

* Rename _PyCoreConfig_GetCoreConfig() to _PyPreConfig_GetCoreConfig()
* Fix core_read_precmdline(): handle parse_argv=0
* Fix _Py_PreInitializeFromCoreConfig(): pass coreconfig.argv
  to _Py_PreInitializeFromPyArgv(), except if parse_argv=0
2019-05-17 19:01:14 +02:00
Victor Stinner b16b4e4592
bpo-36763: Add PyMemAllocatorName (GH-13387)
* Add PyMemAllocatorName enum
* _PyPreConfig.allocator type becomes PyMemAllocatorName, instead of
  char*
* Remove _PyPreConfig_Clear()
* Add _PyMem_GetAllocatorName()
* Rename _PyMem_GetAllocatorsName() to
  _PyMem_GetCurrentAllocatorName()
* Remove _PyPreConfig_SetAllocator(): just call
  _PyMem_SetupAllocators() directly, we don't have do reallocate the
  configuration with the new allocator anymore!
* _PyPreConfig_Write() parameter becomes const, as it should be in
  the first place!
2019-05-17 15:20:52 +02:00
Christian Heimes 80ed353329 Simplify SSLSocket / SSLObject doc string (GH-9972)
Instead of maintaining the same doc string two times, let's copy common
doc strings from SSLObject methods and properties to SSLSocket.

Signed-off-by: Christian Heimes <christian@python.org>
2019-05-17 13:08:14 +02:00
Pablo Galindo af8646c805
bpo-1875: Raise SyntaxError in invalid blocks that will be optimised away (GH-13332)
Move the check for dead conditionals (if 0) to the peephole optimizer
and make sure that the code block is still compiled to report any
existing syntax errors within.
2019-05-17 11:37:08 +01:00
Victor Stinner fed02e15b3
bpo-36763: Remove _PyCoreConfig.program (GH-13373)
Use _PyCoreConfig.program_name instead.
2019-05-17 11:12:09 +02:00
Erwan Le Pape ac8eb8f36b bpo-35545: Fix asyncio discarding IPv6 scopes (GH-11271)
This PR proposes a solution to [bpo-35545](https://bugs.python.org/issue35545) by adding an optional `flowinfo` and `scopeid` to `asyncio.base_events._ipaddr_info` to carry the full address information into `_ipaddr_info` and avoid discarding IPv6 specific information.

Changelog entry & regression tests to come.


https://bugs.python.org/issue35545
2019-05-17 01:28:39 -07:00
Zackery Spytz 14514d9084 bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375)
The final addition (cur += step) may overflow, so use size_t for "cur".
"cur" is always positive (even for negative steps), so it is safe to use
size_t here.

Co-Authored-By: Martin Panter <vadmium+py@gmail.com>
2019-05-17 10:13:03 +03:00
Pablo Galindo aee19f54f6
bpo-36751: Undeprecate getfullargspec (GH-13245) 2019-05-16 21:08:15 +01:00
Victor Stinner 54b43bb3bb
bpo-36763: Add _PyCoreConfig.configure_c_stdio (GH-13363)
Add tests for configure_c_stdio and pathconfig_warnings parameters.
2019-05-16 18:30:15 +02:00
Victor Stinner 9ef5dcaa0b
bpo-36763: Add _Py_InitializeMain() (GH-13362)
* Add a private _Py_InitializeMain() function.
* Add again _PyCoreConfig._init_main.
* _Py_InitializeFromConfig() now uses _init_main to decide
  if _Py_InitializeMainInterpreter() should be called.
* _PyCoreConfig: rename _frozen to pathconfig_warnings, its value is
  now the opposite of Py_FrozenFlag.
* Add an unit test for _init_main=0 and _Py_InitializeMain().
2019-05-16 17:38:16 +02:00
Victor Stinner ae239f6b06
bpo-36763: Add _PyCoreConfig.parse_argv (GH-13361)
* _PyCoreConfig_Read() doesn't parse nor update argv
  if parse_argv is 0.
* Move path configuration fields in _PyCoreConfig.
* Add an unit test for parse_argv=0.
* Remove unused "done": label in _Py_RunMain().
2019-05-16 17:02:56 +02:00
Andrew Svetlov 68b34a7204 bpo-36921: Deprecate @coroutine for sake of async def (GH-13346)
The second attempt. Now deprecate `@coroutine` only, keep `yield from fut` as is.


https://bugs.python.org/issue36921
2019-05-16 07:52:10 -07:00
Andrew Svetlov 6e78900282 bpo-35589: Prevent buffer copy in sock_sendall() (GH-11418)
No NEWs is needed since the problem was introduced on master only and never released.


https://bugs.python.org/issue35589
2019-05-16 06:30:16 -07:00
Terry Jan Reedy 8a533ffb49
Fix typos in documentation. Patch by tirkarthi. (GH-13354) 2019-05-16 01:20:37 -04:00
Paul Monson fb7e7505ed bpo-35926: Add support for OpenSSL 1.1.1b on Windows (GH-11779) 2019-05-15 15:38:55 -07:00
‮zlohhcuB treboR d9e006bcef bpo-33123: pathlib: Add missing_ok parameter to Path.unlink (GH-6191)
Similarly to how several pathlib file creation functions have an "exists_ok" parameter, we should introduce "missing_ok" that makes removal functions not raise an exception when a file or directory is already absent.  IMHO, this should cover Path.unlink and Path.rmdir.  Note, Path.resolve() has a "strict" parameter since 3.6 that does the same thing. Naming this of this new parameter tries to be consistent with the "exists_ok" parameter as that is more explicit about what it does (as opposed to "strict").


https://bugs.python.org/issue33123
2019-05-15 15:02:11 -07:00
Antoine Pitrou 1a2dd82f56
bpo-36786: Run compileall in parallel during "make install" (GH-13078) 2019-05-15 23:45:18 +02:00
Jon Janzen c981ad16b0 bpo-26707: Enable plistlib to read UID keys. (GH-12153)
Plistlib currently throws an exception when asked to decode a valid
.plist file that was generated by Apple's NSKeyedArchiver. Specifically,
this is caused by a byte 0x80 (signifying a UID) not being understood.

This fixes the problem by enabling the binary plist reader and writer
to read and write plistlib.UID objects.
2019-05-15 23:14:38 +03:00
Victor Stinner 5eb8b07f87
bpo-36763: InitConfigTests tests all core config (GH-13331)
Remove UNTESTED_CORE_CONFIG from test_embed.InitConfigTests: all core
config fields are now tested!

Changes:

* Test also dll_path on Windows
* Add run_main_config unit test: test config using _Py_RunMain().
2019-05-15 02:12:48 +02:00
Andrew Svetlov 54b74fe9df
bpo-36801: Temporarily fix regression in writer.drain() (#13330) 2019-05-15 00:39:13 +03:00
Victor Stinner 91c99873d1
bpo-36763: Add test for _PyCoreConfig_SetString() (GH-13275)
test_embed: add test_init_read_set() to test newly added APIs: test
module_search_paths and executable.
2019-05-14 22:01:51 +02:00
Krzysztof Wojcik c1f5667be1 bpo-33529, email: Fix infinite loop in email header encoding (GH-12020) 2019-05-14 18:55:23 +02:00
Hervé Beraud 4d45a3b110 json.tool: use stdin and stdout in default cmdlne arguments (GH-11992)
Argparse can handle default value as stdin and stdout for parameters
as file type (infile, outfile).
2019-05-14 18:52:42 +02:00
Andrew Svetlov f12ba7cd0a bpo-36916: asyncio: Swallow unhandled write() exception (GH-13313) 2019-05-14 18:09:44 +02:00
Victor Stinner 3c93153f7d
bpo-36915: regrtest always remove tempdir of worker processes (GH-13312)
When using multiprocessing (-jN option), worker processes now create
their temporary directory inside the temporary directory of the
main process. So the main process is able to remove temporary
directories of worker processes even if they crash or when they are
killed by regrtest on KeyboardInterrupt (CTRL+c).

Rework also how multiprocessing arguments are parsed in main.py.
2019-05-14 15:49:16 +02:00
Nicolai Moore 5e48e3db6f bpo-36845: validate integer network prefix when constructing IP networks (GH-13298) 2019-05-14 19:32:59 +09:00
Victor Stinner c923c3449f
bpo-36719: Fix regrtest MultiprocessThread (GH-13301)
MultiprocessThread.kill() now closes stdout and stderr to prevent
popen.communicate() to hang.
2019-05-14 03:47:32 +02:00
Jens Troeger 45b2f8893c bpo-34424: Handle different policy.linesep lengths correctly. (#8803) 2019-05-13 21:07:39 -04:00
Pierre Glaser b1dfcad6f0 bpo-36867: Create the resource_tracker before launching SharedMemoryManagers (GH-13276) 2019-05-13 21:15:32 +02:00
Antoine Pitrou 95da83d9ba
bpo-36894: Fix regression in test_multiprocessing_spawn (no tests run on Windows) (GH-13290) 2019-05-13 20:02:46 +02:00
Victor Stinner b0917df329
bpo-36719: regrtest -jN no longer stops on crash (GH-13231)
"python3 -m test -jN ..." now continues the execution of next tests
when a worker process crash (CHILD_ERROR state). Previously, the test
suite stopped immediately. Use --failfast to stop at the first error.

Moreover, --forever now also implies --failfast.
2019-05-13 19:17:54 +02:00
Xtreak 2c10538d11 bpo-36903: Fix ResourceWarning in test_logging (GH-13283) 2019-05-13 16:48:51 +02:00
Guido van Rossum 4f098b35f5 bpo-36807: When saving a file in IDLE, call flush and fsync (#13102) 2019-05-13 08:31:29 -04:00
Zackery Spytz cf599f6f6f bpo-6584: Add a BadGzipFile exception to the gzip module. (GH-13022)
Co-Authored-By: Filip Gruszczyński <gruszczy@gmail.com>
Co-Authored-By: Michele Orrù <maker@tumbolandia.net>
2019-05-13 10:50:52 +03:00
Matthias Bussonnier e2500610c6 bpo-36895: remove time.clock() as per removal notice. (GH-13270)
`time.clock()` was deprecated in 3.3, and marked for removal removal in
3.8; this thus remove it from the time module.
2019-05-12 18:34:44 -07:00
Jake Tesler 4959c33d25 bpo-36084: Add native thread ID to threading.Thread objects (GH-11993) 2019-05-12 19:08:24 +02:00
Pablo Galindo 26f55c29f2
bpo-36817: Do not decrement reference for expr_text on fstring = parsing failure (GH-13256) 2019-05-12 01:43:04 +01:00
Michael J. Sullivan d8320ecb86 bpo-36878: Allow extra text after `# type: ignore` comments (GH-13238)
In the parser, when using the type_comments=True option, recognize
a TYPE_IGNORE as anything containing `# type: ignore` followed by
a non-alphanumeric character. This is to allow ignores such as
`# type: ignore[E1000]`.
2019-05-11 19:17:24 +01:00
Xtreak 79972f1fad bpo-36884: Fix DeprecationWarning in test_asyncio StreamReader instantiation (GH-13243)
https://bugs.python.org/issue36884
2019-05-11 01:45:16 -07:00
Pierre Glaser f22cc69b01 bpo-36867: Make semaphore_tracker track other system resources (GH-13222)
The multiprocessing.resource_tracker replaces the multiprocessing.semaphore_tracker module. Other than semaphores, resource_tracker also tracks shared_memory segments. Patch by Pierre Glaser.
2019-05-10 22:59:08 +02:00
Pierre Glaser d0d64ad1f5 bpo-36368: Ignore SIGINT in SharedMemoryManager servers. (GH-12483)
Fix a bug crashing SharedMemoryManager instances in interactive sessions after
a Ctrl-C (KeyboardInterrupt) was sent.
2019-05-10 20:42:35 +02:00
Jeroen Demeyer 351c67416b bpo-35983: skip trashcan for subclasses (GH-11841)
Add new trashcan macros to deal with a double deallocation that could occur when the `tp_dealloc` of a subclass calls the `tp_dealloc` of a base class and that base class uses the trashcan mechanism.

Patch by Jeroen Demeyer.
2019-05-10 19:21:10 +02:00
Olexa Bilaniuk 79efbb7193 bpo-24538: Fix bug in shutil involving the copying of xattrs to read-only files. (PR-13212)
Extended attributes can only be set on user-writeable files, but shutil previously
first chmod()ed the destination file to the source's permissions and then tried to
copy xattrs. This will cause failures if attempting to copy read-only files with
xattrs, as occurs with Git clones on Lustre FS.
2019-05-10 11:22:06 +08:00
Anthony Shaw 948ed8c96b bpo-36814: ensure os.posix_spawn() handles None (GH-13144)
Fix an issue where os.posix_spawn() would incorrectly raise a TypeError
when file_actions is None.
2019-05-10 04:00:06 +02:00
Rémi Lapeyre fce5ff1e18 bpo-27497: Add return value to csv.DictWriter.writeheader (GH-12306)
csv.DictWriter.writeheader() now returns the return value of the
underlying csv.Writer.writerow() method.

Patch contributed by Ashish Nitin Patil.
2019-05-10 03:50:11 +02:00
Victor Stinner d267ac20c3
bpo-36778: cp65001 encoding becomes an alias to utf_8 (GH-13230) 2019-05-10 03:19:54 +02:00
Andrew Svetlov a076e4f5e4
bpo-36802: Drop awrite()/aclose(), support await write() and await close() instead (#13099) 2019-05-09 15:14:58 -04:00
Pablo Galindo f00828a742
bpo-36851: Clean the frame stack if the execution ends with a return and the stack is not empty (GH-13191) 2019-05-09 16:52:02 +01:00
Jason R. Coombs 33e067d6a2 Add support for .parent and .joinpath in zipfile.Path (#13213) 2019-05-09 11:34:35 -04:00
Julien Palard afd1e6d2f0
bpo-36239: Skip comments in gettext infos (GH-12255) 2019-05-09 16:22:15 +02:00
Stefan Behnel 88db8bd064
bpo-36831: Do not apply default namespace to unprefixed attributes in ElementPath. (#13201)
Also provide better grouping of the tokenizer tests.
2019-05-09 07:22:47 +02:00
Benjamin Peterson 3aca40d3cb
closes bpo-36861: Update Unicode database to 12.1.0. (GH-13214)
Adds ㋿.
2019-05-08 20:59:35 -07:00
Pierre Glaser 289f1f80ee bpo-35900: Enable custom reduction callback registration in _pickle (GH-12499)
Enable custom reduction callback registration for functions and classes in
_pickle.c, using the new Pickler's attribute ``reducer_override``.
2019-05-08 23:08:25 +02:00
Eric V. Smith 9a4135e939
bpo-36817: Add f-string debugging using '='. (GH-13123)
If a "=" is specified a the end of an f-string expression, the f-string will evaluate to the text of the expression, followed by '=', followed by the repr of the value of the expression.
2019-05-08 16:28:48 -04:00
Pierre Glaser 65d98d0f53 bpo-35900: Add a state_setter arg to save_reduce (GH-12588)
Allow reduction methods to return a 6-item tuple where the 6th item specifies a
custom state-setting method that's called instead of the regular
``__setstate__`` method.
2019-05-08 21:40:25 +02:00
Brian Quinlan 39889864c0 bpo-26903: Limit ProcessPoolExecutor to 61 workers on Windows (GH-13132)
Co-Authored-By: brianquinlan <brian@sweetapp.com>
2019-05-08 14:04:53 -04:00
Zackery Spytz b9b08cd948 bpo-24758: Improve the error msg for unittest.mock.Mock()'s unsafe mode (#12991)
* bpo-24758: Improve the error msg for unittest.mock.Mock()'s unsafe mode

* Make the requested changes.
2019-05-08 23:02:23 +05:30
Gregory P. Smith 6bd81734de bpo-36816: Update the self-signed.pythontest.net cert (GH-13192)
We updated the server, our testsuite must match.


https://bugs.python.org/issue36816


✈️ CLE -> DEN ✈️ #pycon2019
2019-05-08 09:35:09 -07:00
Jason R. Coombs b2758ff955 bpo-36832: add zipfile.Path (#13153)
* bpo-36832: add zipfile.Path

* bpo-36832: add documentation for zipfile.Path

* 📜🤖 Added by blurb_it.

* Remove module reference from blurb.

* Sort the imports

* Update docstrings and docs per recommendations.

* Rely on test.support.temp_dir

* Signal that 'root' is the parameter.

* Correct spelling of 'mod'

* Convert docstring to comment for brevity.

* Fix more errors in the docs
2019-05-08 09:45:05 -04:00
Michael Blahay b1c3167c23 bpo-27639: Correct return type for UserList slicing operation (#13169)
* BPO-27639: Correct return type for UserList slicing operation

Added logic to __getitem__ magic method for UserList to ensure that the return
type matches that of self.
2019-05-07 17:41:06 -04:00
Riccardo Magliocchetti ca87eebb22 bpo-36015: Handle StreamHandler representaton of stream with an integer name (GH-11908) 2019-05-07 22:36:39 +01:00
Andrew Svetlov 1cc0ee7d9f bpo-36801: Fix waiting in StreamWriter.drain for closing SSL transport (GH-13098)
https://bugs.python.org/issue36801
2019-05-07 13:53:19 -07:00
Romain Picard b35acc5b3a bpo-35125: remove inner callback on outer cancellation in asyncio shield (GH-10340)
When the future returned by shield is cancelled, its completion callback of the
inner future is not removed. This makes the callback list of inner inner future
grow each time a shield is created and cancelled.

This change unregisters the callback from the inner future when the outer
future is cancelled.



https://bugs.python.org/issue35125
2019-05-07 11:58:24 -07:00
Brian Quinlan f7bda5c572 Don't import wait from connection, it shadows a name (GH-13112)
(lint cleanup) This import causes an argument parameter to shadow the global import name.
2019-05-07 13:31:11 -04:00
Vincent Michel 63deaa5b70 bpo-31922: Do not connect UDP sockets when broadcast is allowed (GH-423)
*Moved from python/asyncio#493.*

This PR fixes issue python/asyncio#480, as explained in [this comment](https://github.com/python/asyncio/issues/480#issuecomment-278703828).

The `_SelectorDatagramTransport.sendto` method has to be modified ~~so `_sock.sendto` is used in all cases (because it is tricky to reliably tell if the socket is connected or not). Could that be an issue for connected sockets?~~ *EDIT* ... so `_sock.send` is used only if `_sock` is connected.

It also protects `socket.getsockname` against `OSError` in `_SelectorTransport`. This might happen on Windows if the socket is not connected (e.g. for UDP broadcasting).


https://bugs.python.org/issue31922
2019-05-07 10:18:49 -07:00
Gregory P. Smith 64aa6d2000
bpo-36533: Reinit logging.Handler locks on fork(). (GH-12704)
Instead of attempting to acquire and release them all across fork
which was leading to deadlocks in some applications that had chained
their own handlers while holding multiple locks.
2019-05-07 12:18:20 -04:00
Łukasz Langa bbbdc2bb65 Python 3.8.0a4
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAlzQfXsACgkQsmmV4xAl
 BWhB8g/+P+lbqKLZKb9X1W1deSMAoEt9fdHwRK4SXdSYiVAypMURR5qsexAuXILn
 VunaphcHniUq/LTMfyA6LAX8HjKPqwKPfHi7hKfwaoYKw/SCKi50tXgbuCGj/ZKK
 ix5HO76Jh4YFf6KV64c8Mkxas8Lk59ybLqAaI1D2maL9olYxvmmsEGpaXliEexfI
 heItUk5sGaz5ARXPaC5PlQEL3lgRE16dC1t1/vHCU1sseN2tf2XkIszsb9wF1ei/
 Wlg1gkDL6JetdUwxAyH4J/nZunSEeZ0MwJjzBGfWxc1fVhGzXDvyeWg2VQ3/OB46
 mH68RKOuVWLy+jQKbBuPDMOgyuTtM2L+bOmuGxKYkotL5EOIz6BmaRvH9VTJNoJ6
 xoUVHOSaOZDSVwA4EUBPNbYIVHj7E/11SJQKzBxDO15Pn/T9Zw8yz689yRDoFj42
 zCQK/a+2xvjm+WpvNZO4pwyoTOtvT7phirk7C9lV4KM3xH6jkGr6tHYkTFFRXfc0
 uXgIeq70jgb/qESojuBNQziVqhhHFhS6tZ/485jDYCkLytImZKRLhzOe9Xd+7WiI
 Vi1tUHbwgRmvimqNHFA7sFME3LI5ryDcDV7DLUL7sLK13m0iWQ4tSOT4TrERhGBG
 TL4KyAzspL5bC56Vt8DFuI/N4Byy5dN7tnFj7+5N7qgK1+Oshk0=
 =1r7h
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAlzRnIkQHGx1a2FzekBs
 YW5nYS5wbAAKCRCyaZXjECUFaGzeD/9im9jmefZiVy+5GU4wSkfD4YEOCoh+Mrln
 KvQPO6h0d8Py/u2UBmwaWCpg4yeB2lc39oTyU6EPvbe3e10fsb0pfdInXqPNomt0
 PiMWviLe31TWBb4uw1664rhcHSpmfDpKEtAmWO/fOnl2gQqWCYVY+GHdpYI9h65o
 XYcm8PUZ2Knl/x0XZnnmTSZGkyf8GdbBpNFfe3V3twH7uirkxXV7KTxjyH93D8DO
 z8tCOtBncCMWsiHPCJ+Al5Q/c5Ymu6/D6MzmGeQuNWAl5saaudUJVXz0lKiixkVP
 zJDdCSBavMijmAK4sjr0PGT+fQCTVAJOvO5gWW79PfIbZJCIEV+QriCpIa0wXmQ3
 OXBQgdAAK1M+BE2TLUm5LUw5eWhjzbUbrNU0vchluy+UGbgw0hT10J0hATAlZaIM
 Y0BCnZl7qkBVrbrX+Dm+qoMRawgqt7DmK5OxBgH9LEErm8ryTEg0wtOANr5DDwMF
 TretjFwAnMhuz1kguvCAePd3JF0LRoEaf5dW/h4hz/sX1ldGMK1zm2B4nU6Yst8v
 RaEzDvBbxYAvRtWQO1i8wDOv8/VTpAGXfTskwofmxUZ5g0bqhiCgEw0PpMyN82Rw
 E2nsdrzV06zeSQrOPUGuy2vypuDMiqdguLsjKJQb6igHl1ThhXU1Nr3UHit1HCVL
 p0awZnaRyw==
 =i7by
 -----END PGP SIGNATURE-----

Merge tag 'v3.8.0a4'

Python 3.8.0a4
2019-05-07 16:56:06 +02:00
Rémi Lapeyre 11a8832c98 bpo-31855: unittest.mock.mock_open() results now respects the argument of read([size]) (GH-11521)
unittest.mock.mock_open() results now respects the argument of read([size])

Co-Authored-By: remilapeyre <remi.lapeyre@henki.fr>
2019-05-07 11:48:36 +01:00
Andrew Svetlov ad4ed87241
Forbid creating of stream objects outside of asyncio (#13101) 2019-05-06 22:52:11 -04:00
Gregory P. Smith 2cc0223f43
bpo-35925: Skip SSL tests that fail due to weak external certs. (GH-13124)
Modern Linux distros such as Debian Buster have default OpenSSL system
configurations that reject connections to servers with weak certificates
by default.  This causes our test suite run with external networking
resources enabled to skip these tests when they encounter such a failure.

Fixing the network servers is a separate issue.
2019-05-06 17:54:06 -04:00
Serhiy Storchaka d53cf99dca
bpo-36542: Allow to overwrite the signature for Python functions. (GH-12705) 2019-05-06 22:40:27 +03:00
Serhiy Storchaka 96aeaec647
bpo-36793: Remove unneeded __str__ definitions. (GH-13081)
Classes that define __str__ the same as __repr__ can
just inherit it from object.
2019-05-06 22:29:40 +03:00
penguindustin 9646630895 bpo-36766: Typos in docs and code comments (GH-13116) 2019-05-06 14:57:17 -04:00
Łukasz Langa c1004b8546
Python 3.8.0a4 2019-05-06 20:30:25 +02:00
twisteroid ambassador 88f07a804a bpo-33530: Implement Happy Eyeballs in asyncio, v2 (GH-7237)
Added two keyword arguments, `delay` and `interleave`, to
`BaseEventLoop.create_connection`. Happy eyeballs is activated if
`delay` is specified.

We now have documentation for the new arguments. `staggered_race()` is in its own module, but not exported to the main asyncio package.


https://bugs.python.org/issue33530
2019-05-05 04:14:35 -07:00
Inada Naoki c4d92c8ada
simplify StartupImportTests (GH-13096)
_osx_support and copyreg are not imported from site on macOS for now.
2019-05-05 18:06:30 +09:00
Joannah Nanjekye 6b5b013bcc bpo-26978: Implement pathlib.Path.link_to (Using os.link) (GH-12990) 2019-05-04 17:27:10 +02:00
Stefan Behnel 47541689cc
bpo-28238: Implement "{*}tag" and "{ns}*" wildcard tag selection support for ElementPath, and extend the surrounding tests and docs. (GH-12997) 2019-05-03 20:58:16 +02:00
Zackery Spytz 4737b923df bpo-24638: Improve the error message in asyncio.ensure_future() (#12848) 2019-05-03 11:35:25 -04:00
gescheit c1964e9e21 bpo-36613: call remove_done_callback if exception (GH-12800)
Call remove_done_callback() in finally block.


https://bugs.python.org/issue36613
2019-05-03 08:18:02 -07:00
xdegaye 4461d704e2 bpo-36341: Fix tests calling bind() on AF_UNIX sockets (GH-12399)
Those tests may fail with PermissionError.



https://bugs.python.org/issue36341
2019-05-03 08:09:17 -07:00
Stefan Behnel 45e92fc02d
Add correct license for C14N test suite to license docs. (GH-13055) 2019-05-02 22:11:04 +02:00
Victor Stinner 4631da1242
bpo-36763: Remove _PyCoreConfig._init_main (GH-13066) 2019-05-02 15:30:21 -04:00
Zackery Spytz 6ae2bbbdfc bpo-36776: Add @support.skip_unless_symlink to test_lll.py (GH-13058) 2019-05-02 14:54:59 -04:00
Xtreak 874ad1b3b4 Fix typo: quaatile to quantile (GH=13001) 2019-05-02 14:20:58 -04:00
Zackery Spytz c4e78b116f bpo-14546: Fix the argument handling in Tools/scripts/lll.py (GH-13026) 2019-05-02 18:03:43 +03:00
Stefan Behnel 0d5864fa07
bpo-13611: Include C14N 2.0 test data in installation (GH-13053)
* Include C14N 2.0 test data in installation.
* Add README file to the C14N test data directory to reference the original source and licensing conditions.
2019-05-02 10:35:02 +02:00
Victor Stinner cb9fbd3588
bpo-36763: Make _PyCoreConfig.check_hash_pycs_mode public (GH-13052)
_PyCoreConfig: Rename _check_hash_pycs_mode field to
check_hash_pycs_mode (make it public) and change its type from "const
char*" to "wchar_t*".
2019-05-01 23:51:56 -04:00
Xtreak 11e4a941e9 Change bisect to bisect_cmd in docstring (#13040) 2019-05-01 22:49:49 -04:00
Chris Withers adbf178e49
Mock 100% coverage (GH-13045)
This was achieved by:
* moving many pass statements in tests onto their own lines, so they pass line coverage and can match an easy ignore pattern if branch coverage is added later.
* removing code that cannot be reached.
* removing long-disabled tests.
* removing unused code.
* adding tests for uncovered code

It turned out that removing `if __name__ == '__main__'` blocks that run unittest.main() at the bottom of test files was surprisingly contentious, so they remain and can be filtered out with an appropriate .coveragerc.
2019-05-01 23:04:04 +01:00
Gregory P. Smith b7378d7728
bpo-30458: Use InvalidURL instead of ValueError. (GH-13044)
Use http.client.InvalidURL instead of ValueError as the new error case's exception.
2019-05-01 16:39:21 -04:00
Stefan Behnel e1d5dd645d
bpo-13611: C14N 2.0 implementation for ElementTree (GH-12966)
* Implement C14N 2.0 as a new canonicalize() function in ElementTree.

Missing features:
- prefix renaming in XPath expressions (tag and attribute text is supported)
- preservation of original prefixes given redundant namespace declarations
2019-05-01 22:34:13 +02:00
Stefan Behnel dde3eebdaa
bpo-36676: Namespace prefix aware parsing support for the ET.XMLParser target (GH-12885)
* bpo-36676: Implement namespace prefix aware parsing support for the XMLParser target in ElementTree.
2019-05-01 21:49:58 +02:00
Stefan Behnel 43851a202c
bpo-36673: Implement comment/PI parsing support for the TreeBuilder in ElementTree. (#12883)
* bpo-36673: Implement comment/PI parsing support for the TreeBuilder in ElementTree.

* bpo-36673: Rewrite the comment/PI factory handling for the TreeBuilder in "_elementtree" to make it use the same factories as the ElementTree module, and to make it explicit when the comments/PIs are inserted into the tree and when they are not (which is the default).
2019-05-01 21:20:38 +02:00
Petter Strandmark 3d37ea25dc bpo-27682: Handle client connection terminations in wsgiref (GH-9713) 2019-05-01 20:32:15 +03:00
Thomas A Caswell 18029d80bd MNT: set stacklevel in the getfullargspec deprecation warning to 2 (GH-13029)
This is consistent with the rest of the `warnings.warn` usage in the
inspect.py module and aids identifying code that needs to be fixed.

This warning came in via d5d2b45469
2019-05-01 11:12:34 -04:00
Xtreak 2fc936ed24 bpo-30458: Disable https related urllib tests on a build without ssl (GH-13032)
These tests require an SSL enabled build. Skip these tests when python is built without SSL to fix test failures.


https://bugs.python.org/issue30458
2019-05-01 04:59:48 -07:00
Chris Withers 49e27f0afb
remove jython support from unittest.mock (GH#13033) 2019-05-01 08:48:44 +01:00
Gregory P. Smith c4e671eec2
bpo-30458: Disallow control chars in http URLs. (GH-12755)
Disallow control chars in http URLs in urllib.urlopen.  This addresses a potential security problem for applications that do not sanity check their URLs where http request headers could be injected.
2019-04-30 19:12:21 -07:00
Victor Stinner 5f38b8407b
bpo-36763: Add _PyCoreConfig_SetArgv() (GH-13030)
* Add 2 new config methods:

  * _PyCoreConfig_SetArgv()
  * _PyCoreConfig_SetWideArgv()

* Add also an internal _PyCoreConfig_SetPyArgv() method.
* Remove 'args' parameter from _PyCoreConfig_Read().
2019-05-01 02:30:12 +02:00
Mario Corchero 0df635c7f8 Don't report deleted attributes in __dir__ (GH#10148)
When an attribute is deleted from a Mock, a sentinel is added rather
than just deleting the attribute. This commit checks for such sentinels
when returning the child mocks in the __dir__ method as users won't
expect deleted attributes to appear when performing dir(mock).
2019-04-30 19:56:36 +01:00
Steve Dower d537ab0ff9
bpo-36742: Fixes handling of pre-normalization characters in urlsplit() (GH-13017) 2019-04-30 12:03:02 +00:00
gescheit 3bbcc92577 bpo-25430: improve performance of IPNetwork.__contains__ (GH-1785)
make a compare in bit-operation manner.
2019-04-30 16:54:30 +09:00
Raymond Hettinger b0a2c0fa83
bpo-36018: Test idempotence. Test two methods against one-another. (GH-13021) 2019-04-29 23:47:33 -07:00
Pablo Galindo d5d2b45469
bpo-36751: Deprecate getfullargspec and report positional-only args as regular args (GH-13016)
* bpo-36751: Deprecate getfullargspec and report positional-only args as regular args

* Use inspect.signature in testhelpers
2019-04-30 02:01:14 +01:00
Marco Rougeth 81c5a90595 bpo-36232: Improve error message on dbm.open() when the db doesn't exist (GH-12060) 2019-04-29 16:23:28 -07:00
Berker Peksag be6dbfb43b
bpo-1613500: Don't hardcode output file mode in fileinput.FileInput (GH-12986) 2019-04-29 17:55:39 +03:00
Paul Ganssle 88c0937056 bpo-36004: Add date.fromisocalendar (GH-11888)
This commit implements the first version of date.fromisocalendar, the
inverse function for date.isocalendar.
2019-04-29 15:22:03 +02:00
xdegaye a86e06433a bpo-35952: Fix test.pythoninfo when the compiler is missing (GH-13007) 2019-04-29 14:53:30 +02:00
Pablo Galindo 8c77b8cb91
bpo-36540: PEP 570 -- Implementation (GH-12701)
This commit contains the implementation of PEP570: Python positional-only parameters.

* Update Grammar/Grammar with new typedarglist and varargslist

* Regenerate grammar files

* Update and regenerate AST related files

* Update code object

* Update marshal.c

* Update compiler and symtable

* Regenerate importlib files

* Update callable objects

* Implement positional-only args logic in ceval.c

* Regenerate frozen data

* Update standard library to account for positional-only args

* Add test file for positional-only args

* Update other test files to account for positional-only args

* Add News entry

* Update inspect module and related tests
2019-04-29 13:36:57 +01:00
xdegaye 254b309c80 bpo-21536: On Android, C extensions are linked to libpython (GH-12989) 2019-04-29 09:27:40 +02:00
Raymond Hettinger db81ba1393
bpo-36546: More tests: type preservation and equal inputs (#13000) 2019-04-28 21:31:55 -07:00
Emmanuel Arias 86f0c8215c bpo-36729: Delete unused text variable on tests. (GH-12959) 2019-04-29 05:24:24 +03:00
Gordon P. Hemsley 50fed0b64f bpo-32424: Improve test coverage for xml.etree.ElementTree (GH-12891)
* Fix typo in test_cyclic_gc subtest
* Improve test coverage for xml.etree.ElementTree
2019-04-28 06:41:43 +02:00
Paul Ganssle 4d8c8c0ad6 bpo-36025: Fix PyDate_FromTimestamp API (GH-11922)
In the process of converting the date.fromtimestamp function to use
argument clinic in GH-8535, the C API for PyDate_FromTimestamp was
inadvertently changed to expect a timestamp object rather than an
argument tuple.

This PR fixes this backwards-incompatible change by adding a new wrapper
function for the C API function that unwraps the argument tuple and
passes it to the underlying function.

This PR also adds tests for both PyDate_FromTimestamp and
PyDateTime_FromTimestamp to prevent any further regressions.
2019-04-27 22:39:40 +03:00
Terry Jan Reedy 55d035113d
Syntax highlight IDLE html doc code example. (GH-12981)
The new markup is currently ignored by IDLE's tk doc display.
2019-04-26 23:22:36 -04:00
Victor Stinner 00db7c73af
bpo-36719: regrtest closes explicitly WindowsLoadTracker (GH-12965)
Regrtest.finalize() now closes explicitly the WindowsLoadTracker
instance.
2019-04-26 11:12:26 +02:00
Victor Stinner 837acc1957
bpo-36719: Fix regrtest re-run (GH-12964)
Properly handle a test which fail but then pass.

Add test_rerun_success() unit test.
2019-04-26 09:56:37 +02:00
Victor Stinner 75120d2205
bpo-36719: regrtest always detect uncollectable objects (GH-12951)
regrtest now always detects uncollectable objects. Previously, the
check was only enabled by --findleaks. The check now also works with
-jN/--multiprocess N.

--findleaks becomes a deprecated alias to --fail-env-changed.
2019-04-26 09:28:53 +02:00
Mark Dickinson 7abb6c05af
bpo-36669: add matmul support to weakref.proxy (GH-12932) 2019-04-26 15:56:15 +09:00
Victor Stinner 3cde440f20
bpo-36725: Refactor regrtest multiprocessing code (GH-12961)
Rewrite run_tests_multiprocess() function as a new MultiprocessRunner
class with multiple methods to better report errors and stop
immediately when needed.

Changes:

* Worker processes are now killed immediately if tests are
  interrupted or if a test does crash (CHILD_ERROR): worker
  processes are killed.
* Rewrite how errors in a worker thread are reported to
  the main thread. No longer ignore BaseException or parsing errors
  silently.
* Remove 'finished' variable: use worker.is_alive() instead
* Always compute omitted tests. Add Regrtest.get_executed() method.
2019-04-26 08:40:25 +02:00
Victor Stinner 4d29983185
bpo-36725: regrtest: add TestResult type (GH-12960)
* Add TestResult and MultiprocessResult types to ensure that results
  always have the same fields.
* runtest() now handles KeyboardInterrupt
* accumulate_result() and format_test_result() now takes a TestResult
* cleanup_test_droppings() is now called by runtest() and mark the
  test as ENV_CHANGED if the test leaks support.TESTFN file.
* runtest() now includes code "around" the test in the test timing
* Add print_warning() in test.libregrtest.utils to standardize how
  libregrtest logs warnings to ease parsing the test output.
* support.unload() is now called with abstest rather than test_name
* Rename 'test' variable/parameter to 'test_name'
* dash_R(): remove unused the_module parameter
* Remove unused imports
2019-04-26 04:08:53 +02:00
Paul Monson 62dfd7d6fe bpo-35920: Windows 10 ARM32 platform support (GH-11774) 2019-04-25 18:36:45 +00:00
Victor Stinner 8c3ecc6bac
bpo-21536: C extensions are no longer linked to libpython (GH-12946)
On Unix, C extensions are no longer linked to libpython.

It is now possible to load a C extension built using a shared library
Python with a statically linked Python.

When Python is embedded, libpython must not be loaded with
RTLD_LOCAL, but RTLD_GLOBAL instead. Previously, using RTLD_LOCAL, it
was already not possible to load C extensions which were not linked
to libpython, like C extensions of the standard library built by the
"*shared*" section of Modules/Setup.

distutils, python-config and python-config.py have been modified.
2019-04-25 20:13:10 +02:00
Victor Stinner 0ef8c157e9
bpo-28552: Fix distutils.sysconfig for empty sys.executable (GH-12875)
bpo-28552, bpo-7774: Fix distutils.sysconfig if sys.executable is
None or an empty string: use os.getcwd() to initialize project_base.

Fix also the distutils build command: don't use sys.executable if
it's evaluated as false (None or empty string).
2019-04-25 11:59:34 +02:00
Victor Stinner 235e7b2b0d
bpo-36465: Fix test_regrtest on Windows (GH-12945)
Fix Py_DEBUG constant: check for sys.gettotalrefcount attribute
rather than sys.getobjects.

Update also SpecialBuilds.txt documentation.
2019-04-25 01:46:31 +02:00
Victor Stinner f4e4703e74
bpo-36465: Make release and debug ABI compatible (GH-12615)
Release build and debug build are now ABI compatible: the Py_DEBUG
define no longer implies Py_TRACE_REFS define which introduces the
only ABI incompatibility.

A new "./configure --with-trace-refs" build option is now required to
get Py_TRACE_REFS define which adds sys.getobjects() function and
PYTHONDUMPREFS environment variable.

Changes:

* Add ./configure --with-trace-refs
* Py_DEBUG no longer implies Py_TRACE_REFS
2019-04-25 00:56:28 +02:00
Thomas Moreau 004b93ea89 bpo-36668: FIX reuse semaphore tracker for child processes (#5172)
Fix the multiprocessing.semaphore_tracker so it is reused by child processes.
2019-04-24 21:45:52 +02:00
Maximilian Nöthe 4f5a3493b5 fix typo in gzip.py (GH-12928) 2019-04-24 18:21:02 +09:00
Victor Stinner d246a6766b
bpo-36454: Fix test_time.test_monotonic() (GH-12929)
Change test_time.test_monotonic() to test only the lower bound of elapsed time
after a sleep command rather than the upper bound. This prevents unnecessary
test failures on slow buildbots. Patch by Victor Stinner.
2019-04-24 00:15:12 +02:00
Raymond Hettinger fb8c7d5332
bpo-36018: Make "seed" into a keyword only argument (GH-12921) 2019-04-23 01:46:18 -07:00
Raymond Hettinger 7280048690
bpo-35904: Add missing fmean() entry to the summary table (GH-12919) 2019-04-23 01:35:16 -07:00
jkleint 39baace622 Document that TestCase.assertCountEqual() can take iterables (GH-686) 2019-04-23 01:34:29 -07:00
Raymond Hettinger 9013ccf6d8
bpo-36546: Add statistics.quantiles() (#12710) 2019-04-23 00:06:35 -07:00
Windson yang d437012cdd bpo-36679: Rename duplicate test_class_getitem function (GH-12892) 2019-04-22 11:51:06 -07:00
Windson yang c442b1c486 bpo-36680: Rename duplicate test_source_from_cache_path_like_arg function (GH-12893) 2019-04-22 11:50:24 -07:00
Windson yang 3d6f61edb8 bpo-36681: Remove duplicate test_regression_29220 function (GH-12894) 2019-04-22 11:49:11 -07:00
Windson yang 007d0b0188 bpo-36682: Rename duplicate tests in test_sys_setprofile (GH-12895) 2019-04-22 11:48:12 -07:00
Windson yang f51dd4feb0 bpo-36683: Rename duplicate test_io_encoding to test_pyio_encoding (GH-12896) 2019-04-22 11:46:27 -07:00
Windson yang be372d73b4 bpo-36678: Rename duplicate tests in test_dataclasses (GH-12899) 2019-04-22 11:45:34 -07:00
Steve Dower d307d05350
Fixes platform.win32_ver on non-Windows platforms (GH-12912) 2019-04-22 11:40:12 -07:00
Berker Peksag 6ef726af3e
bpo-29734: Cleanup test_getfinalpathname_handles test (GH-12908) 2019-04-22 18:46:28 +03:00
Marcin Niemira ab86521a9d bpo-36523: Add docstring to io.IOBase.writelines (GH-12683) 2019-04-22 20:13:51 +09:00
Xtreak 9b21856b0f bpo-23078: Add support for {class,static}method to mock.create_autospec() (GH-11613)
Co-authored-by: Felipe <felipe.nospam.ochoa@gmail.com>
2019-04-22 05:30:23 +03:00
Raymond Hettinger 14adbd4598
bpo-36650: Fix handling of empty keyword args in C version of lru_cache. (GH-12881) 2019-04-20 07:20:44 -10:00
Stefan Behnel e8113f51a8
bpo-30485: Change the prefix for defining the default namespace in ElementPath from None to '' since there is existing code that uses that and it's more convenient to have an all-string-keys dict (e.g. when sorting items etc.). (#12860) 2019-04-18 19:05:03 +02:00
Victor Stinner 23bace26ec
bpo-36635: Add _testinternalcapi module (GH-12841)
Add a new _testinternalcapi module to test the internal C API.

Move _Py_GetConfigsAsDict() function to the internal C API:
_testembed now uses _testinternalcapi to access the function.
2019-04-18 11:37:26 +02:00
Paul Monson 264a0b40b0 bpo-36638: Fix WindowsLoadTracker exception on some Windows versions (GH-12849) 2019-04-17 18:06:06 -07:00
Victor Stinner 197f0447e3
bpo-35755: Don't say "to mimick Unix which command behavior" (GH-12861) 2019-04-17 17:44:06 +02:00
Lihua Zhao 693c104ae7 bpo-31904: Port test_resource to VxWorks (GH-12719)
Skip tests cases setting RLIMIT_FSIZE and RLIMIT_CPU on VxWorks.
2019-04-17 17:41:33 +02:00
Lihua Zhao 2954550818 bpo-31904: Port test_cmd_line to VxWorks (#12648)
subprocess.Popen doesn't support preexec on VxWorks.
2019-04-17 17:33:25 +02:00
Victor Stinner 2c4c02f8a8
bpo-35755: Remove current directory from posixpath.defpath (GH-11586)
Document the change in a NEWS entry of the Security category.
2019-04-17 17:05:30 +02:00
Victor Stinner 228a3c99bd
bpo-35755: shutil.which() uses os.confstr("CS_PATH") (GH-12858)
shutil.which() and distutils.spawn.find_executable() now use
os.confstr("CS_PATH") if available instead of os.defpath, if the PATH
environment variable is not set.

Don't use os.confstr("CS_PATH") nor os.defpath if the PATH
environment variable is set to an empty string to mimick Unix 'which'
command behavior.

Changes:

* find_executable() now starts by checking for the executable in the
  current working directly case. Add an explicit
  "if not path: return None".
* Add tests for PATH='' (empty string), PATH=':' and for PATHEXT.
2019-04-17 16:26:36 +02:00
Lihua Zhao 36c41bc201 bpo-31904: Fix test_tabnanny on VxWorks (GH-12646)
Fix test_tabnanny on VxWorks: adjust ENOENT error message,
use os.strerror().
2019-04-17 11:46:50 +02:00
Inada Naoki 6fa84bd12c
bpo-27860: ipaddress: fix Interface missed some attributes (GH-12836)
IPv4Interface and IPv6Interface did not has netmask and hostmask
attributes when its argument is bytes or int.

This commit extracts method for constructors of Network and Interface,
and ensure Interface class always provides them.
2019-04-16 08:32:28 +09:00
Victor Stinner 74125a60b7
bpo-36348: IMAP4.logout() doesn't ignore exc (GH-12411)
The imap.IMAP4.logout() method no longer ignores silently arbitrary
exceptions.

Changes:

* The IMAP4.logout() method now expects a "BYE" untagged response,
  rather than relying on _check_bye() which raises a self.abort()
  exception.
* IMAP4.__exit__() now does nothing if the client already logged out.
* Add more debug info if test_logout() tests fail.
2019-04-15 18:23:20 +02:00
Jakub Molinski a9a28808e5 bpo-36625: Remove obsolete comments from docstrings in fractions module (GH-12822)
Remove left-over references to Python 3.0 as the future in Fraction class docstrings.
2019-04-15 13:37:04 +01:00
Victor Stinner 3c7931e514
bpo-36629: Add support.get_socket_conn_refused_errs() (GH-12834)
Fix test_imap4_host_default_value() of test_imaplib: catch also
errno.ENETUNREACH error.
2019-04-15 12:34:53 +02:00
pxinwr f1464f4d2e bpo-31904: Port the time module on VxWorks (GH-12305)
time.clock() is not available on VxWorks.
2019-04-15 11:06:21 +02:00
Inada Naoki 2430d532e2
bpo-27860: use cached_property (GH-12832)
* cached_property is more efficient than hand crafted cache.
* In IPv[46]Network, `self.network.prefixlen` is same to `self._prefixlen`.
2019-04-15 16:01:00 +09:00
Stefan Behnel 3c5a858ec6
bpo-30485: Re-allow empty strings in ElementPath namespace mappings since they might actually be harmless and unused (and thus went undetected previously). (#12830) 2019-04-14 21:12:34 +02:00
Gregory P. Smith cd466559c4
bpo-16079: fix duplicate test method name in test_gzip. (GH-12827) 2019-04-14 10:32:07 -07:00
Mickaël Schoentgen 929b704738 bpo-31658: Make xml.sax.parse accepting Path objects (GH-8564) 2019-04-14 11:16:54 +02:00
Stefan Behnel e9927e1820
bpo-30485: support a default prefix mapping in ElementPath by passing None as prefix (#1823) 2019-04-14 10:09:09 +02:00
Bernt Røskar Brenna ffca16e25a bpo-36227: ElementTree.tostring() default_namespace and xml_declaration arguments (GH-12225)
Add new keyword arguments "default_namespace" and "xml_declaration" to functions ET.tostring() and ET.tostringlist(), as known from ElementTree.write().
2019-04-14 10:07:02 +02:00
Xtreak 830b43d03c bpo-36593: Fix isinstance check for Mock objects with spec executed under tracing (GH-12790)
In Python having a trace function in effect while mock is imported causes isinstance to be wrong for MagicMocks. This is due to the usage of super() in some class methods, as this sets the __class__ attribute. To avoid this, as a workaround, alias the usage of super .
2019-04-13 20:12:33 +01:00
Pablo Galindo 46544f69bf
Skip test_preadv_flags if RWF_HIPRI is not supported by the system (GH-12762) 2019-04-13 17:06:03 +01:00
Cheryl Sabella f8716c88f1
bpo-18610: Update wsgiref.validate docstring for wsgi.input read() (GH-11663) 2019-04-13 08:01:15 -04:00
Rémi Lapeyre e59ec1b05d bpo-35734: ipaddress: remove unused methods (GH-11591) 2019-04-13 17:49:34 +09:00
Victor Stinner 472f794a33
bpo-18748: test_io: silence destructor errors (GH-12805) 2019-04-12 21:58:24 +02:00
Victor Stinner e8f9acf034
bpo-36611: Disable serialno field of debug memory allocators (#12796)
Omit serialno field from debug hooks on Python memory allocators to
reduce the memory footprint by 5%.

Enable tracemalloc to get the traceback where a memory block has been
allocated when a fatal memory error is logged to decide where to put
a breakpoint.

Compile Python with PYMEM_DEBUG_SERIALNO defined to get back the
field.
2019-04-12 21:54:06 +02:00
Eric Snow b75b1a3504
bpo-33608: Revert "Factor out a private, per-interpreter _Py_AddPendingCall()." (gh-12806)
This reverts commit f13c5c8b94 (gh-12360).
2019-04-12 10:20:10 -06:00