Commit Graph

46288 Commits

Author SHA1 Message Date
Victor Stinner fabd7bb8e0
bpo-41521: Replace whitelist/blacklist with allowlist/denylist (GH-21822)
Automerge-Triggered-By: @tiran
2020-08-11 06:26:59 -07:00
Hai Shi 490c5426b1
bpo-40275: Fix failed test cases by using test helpers (GH-21811) 2020-08-10 23:24:02 +02:00
Filipe Laíns 4ce6faa6c9
bpo-16995: add support for base32 extended hex (base32hex) (GH-20441)
cc @pganssle

Automerge-Triggered-By: @pganssle
2020-08-10 07:48:20 -07:00
Stefan Krah 39042e00ab
bpo-41324 Add a minimal decimal capsule API (#21519) 2020-08-10 16:32:21 +02:00
Terry Jan Reedy 416f0b71ba
bpo-41514: Fix buggy IDLE test (GH-21808)
test_run method test_fatal_error failed when run twice, as with
python -m test -m test_fatal_error test_idle test_idle
because func.called was not reinitialized to 0.
This bug caused a failure on a refleak buildbot.
2020-08-10 06:43:56 -07:00
Terry Jan Reedy f2e161c279
bpo-41468: Improve and test IDLE run error exit (GH-21798)
A message box pops up when an unexpected error stops the run process.  Tell users it is likely a random glitch, but report it if not.
2020-08-09 16:08:30 -04:00
Terry Jan Reedy 8b67bf907c
Improve renamed test_run.RecursionLimitTest (GH-21794)
PEP 8 style and new comments.
2020-08-09 13:08:19 -04:00
Zackery Spytz e28b8c9387
bpo-35018: Sax parser should provide user access to lexical handlers (GH-20958)
Co-Authored-By: Jonathan Gossage <jgossage@gmail.com>
2020-08-09 12:50:53 +02:00
Hai Shi c6f282f3b1
bpo-40275: Use new test.support helper submodules in tests (GH-21785) 2020-08-08 13:05:24 +02:00
Hai Shi d94af3f7ed
bpo-40275: Remove test helpers aliases in test.support (GH-21771) 2020-08-08 11:32:41 +02:00
Konge a4084b9d1e
bpo-41497: Fix potential UnicodeDecodeError in dis CLI (GH-21757) 2020-08-08 12:03:09 +09:00
Hai Shi fcce8c649a
bpo-40275: Use new test.support helper submodules in tests (GH-21772) 2020-08-07 23:55:35 +02:00
Victor Stinner e27a51c11e
bpo-41473: Skip test_gdb with gdb 9.2 to work around gdb bug (GH-21768)
gdb 9.2 on Fedora Rawhide is not reliable, see:

* https://bugs.python.org/issue41473
* https://bugzilla.redhat.com/show_bug.cgi?id=1866884
2020-08-07 17:57:56 +02:00
Victor Stinner f44693eaed
bpo-41477: Make ctypes optional in test_genericalias (GH-21766) 2020-08-07 17:56:42 +02:00
Hai Shi 598a951844
bpo-40275: Use new test.support helper submodules in tests (GH-21764) 2020-08-07 17:18:38 +02:00
Nathan M 5f0769a752
bpo-41371: Handle lzma lib import error in test_zoneinfo.py (GH-21734) 2020-08-06 15:09:40 -07:00
Hai Shi 79bb2c93f2
bpo-40275: Use new test.support helper submodules in tests (GH-21743) 2020-08-06 13:51:29 +02:00
Eric L. Frederich 52f98424a5
bpo-41482: Fix error in ipaddress.IPv4Network docstring (GH-21736) 2020-08-05 14:44:53 -04:00
Batuhan Taskaya 8f4380d2f5
bpo-40726: handle uninitalized end_lineno on ast.increment_lineno (GH-20312) 2020-08-05 14:32:32 +01:00
Hai Shi c7decc27d5
bpo-40275: Use new test.support helper submodules in tests (GH-21727) 2020-08-04 17:53:12 +02:00
Hai Shi 604bba1f8f
bpo-40275: Use new test.support helper submodules in tests (GH-21452) 2020-08-04 17:51:43 +02:00
Hans Petter Jansson da4e09fff6
bpo-36982: Add support for extended color functions in ncurses 6.1 (GH-17536)
Co-authored-by: Jeffrey Kintscher <websurfer@surf2c.net>
2020-08-03 23:51:33 -04:00
Inada Naoki db6d9a50ce
bpo-41431: Optimize dict_merge for copy (GH-21674) 2020-08-04 11:08:06 +09:00
Victor Stinner 602a971a2a
bpo-41467: Fix asyncio recv_into() on Windows (GH-21720)
On Windows, fix asyncio recv_into() return value when the socket/pipe
is closed (BrokenPipeError): return 0 rather than an empty byte
string (b'').
2020-08-04 02:40:10 +02:00
Victor Stinner 701b63894f
bpo-38912: regrtest logs unraisable exception into sys.__stderr__ (GH-21718)
regrtest_unraisable_hook() temporarily replaces sys.stderr with
sys.__stderr__ to help to display errors when a test captures stderr.
2020-08-03 22:51:23 +02:00
Hai Shi 4660597b51
bpo-40275: Use new test.support helper submodules in tests (GH-21448) 2020-08-03 18:49:18 +02:00
Hai Shi bb0424b122
bpo-40275: Use new test.support helper submodules in tests (GH-21451) 2020-08-03 18:47:42 +02:00
Hai Shi a7f5d93bb6
bpo-40275: Use new test.support helper submodules in tests (GH-21449) 2020-08-03 18:41:24 +02:00
Raymond Hettinger 6a613f90bf
random module: Convert a "while 1" to "while True (GH-21700) 2020-08-02 12:03:32 -07:00
Raymond Hettinger 5c3270939c
bpo-41421: Algebraic simplification for random.paretovariate() (GH-21695) 2020-08-01 01:18:26 -07:00
Karthikeyan Singaravelan cadda52d97
bpo-40360: Handle PendingDeprecationWarning in test_lib2to3. (GH-21694) 2020-07-31 16:20:48 +05:30
Mark Shannon 6e8128f02e
bpo-41323: Perform 'peephole' optimizations directly on the CFG. (GH-21517)
* Move 'peephole' optimizations into compile.c and perform them directly on the CFG.
2020-07-30 10:03:00 +01:00
Zackery Spytz c82dda1e08
bpo-35328: Set VIRTUAL_ENV_PROMPT at venv activation (GH-21587)
Co-Authored-By: Baptiste Darthenay <baptiste.darthenay@gmail.com>
2020-07-28 09:41:57 +01:00
Serhiy Storchaka 67987acd5d
bpo-41401: Fix test_fspath_support in test_io. (GH-21640)
The error is exposed on non-UTF-8 locales.
2020-07-27 20:58:35 +03:00
pxinwr 855e68855e
bpo-31904: Fix test_ftplib failures for VxWorks RTOS (GH-19447) 2020-07-27 15:17:47 +09:00
Akuli f1d40f941a
bpo-41384: Raise TclError in tkinter.OptionMenu (GH-21601)
... when an unknown option is passed.  TypeError was being raised because a 2to3 fix was missing.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-07-26 21:48:17 -04:00
Guido van Rossum 508ed2d912
Delete remaining references to Grammar/Grammar from docs (#21624)
(Ironically, the file itself remains, see https://github.com/we-like-parsers/cpython/issues/135.)
2020-07-26 08:27:52 -07:00
Serhiy Storchaka b1a87300a0
bpo-41385: Fix test_executable_without_cwd on Windows (GH-21608) 2020-07-26 10:21:39 +03:00
YoSTEALTH 0028c14073
bpo-41314: fixed annotations __future__ version (GH-21616)
PEP 563 was updated to change the release where `from __future__ import annotations` becomes the default (and only) behavior from 4.0 to 3.10. Update `__future__.py` and its docs to reflect this.
2020-07-25 14:42:49 -07:00
Gregory Schevchenko daff39070e
bpo-38731: Add --quiet option to py_compile CLI (GH-17134) 2020-07-25 22:58:45 +03:00
Terry Jan Reedy af08db7bac
bpo-37309: NEWS for #41373 (GH-21612) 2020-07-25 00:30:57 -04:00
Serhiy Storchaka 0dd463c8a4
bpo-41373: IDLE: Fix saving files loaded with no newlines or mixed newlines (GH-21597)
Fixes regression in 3.8.4 and 3.9.0b4.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-07-24 23:21:30 -04:00
Alex Grönholm 0dd98c2d00
bpo-41317: Remove reader on cancellation in asyncio.loop.sock_accept() (#21595) 2020-07-23 12:45:08 -07:00
Zackery Spytz 592527f3ee
bpo-4630: Fix errors in Lib/idlelib/NEWS.txt (GH-21594)
Also one in news log.
2020-07-23 02:06:26 -04:00
Abhijeet Kasurde bcd47837a9
bpo-41182 selector: use DefaultSelector based upon implementation (GH-21257)
On some platform such as VMware ESXi, DefaultSelector fails
to detect selector due to default value.
This fix adds a check and uses the correct selector depending upon
select implementation and actual call.

Fixes: [bpo-41182]()

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-07-22 20:13:37 -07:00
wyfo 653f420b53
bpo-41341: Recursive evaluation of ForwardRef in get_type_hints (#21553)
The issue raised by recursive evaluation is infinite recursion with
recursive types. In that case, only the first recursive ForwardRef is
evaluated.
2020-07-22 12:47:28 -07:00
Steve Dower bf2f76ec09
bpo-41364: Reduce import overhead of uuid module (GH-21586) 2020-07-22 00:15:47 +01:00
Serhiy Storchaka 12f433411b
bpo-41334: Convert constructors of str, bytes and bytearray to Argument Clinic (GH-21535) 2020-07-20 15:53:55 +03:00
Vinay Sharma d42528a3a2
bpo-37703: improve asyncio.gather documentation regarding cancellation (GH-15312)
These changes updates the doc to comprehensively mention the behaviour of gather.cancel()

Automerge-Triggered-By: @asvetlov
2020-07-20 01:42:57 -07:00
Inada Naoki 902356a7b0
bpo-41338: Fix DeprecationWarning in tests (GH-21542) 2020-07-20 12:02:50 +09:00
Vinay Sharma bfd0fbdc13
bpo-38169: Increase code coverage for SharedMemory and ShareableList (GH-16139) 2020-07-19 22:35:52 +09:00
scoder c53b310e59
bpo-41295: Reimplement the Carlo Verre "hackcheck" (GH-21528)
Walk down the MRO backwards to find the type that originally defined the final `tp_setattro`, then make sure we are not jumping over intermediate C-level bases with the Python-level call.

Automerge-Triggered-By: @gvanrossum
2020-07-18 14:19:50 -07:00
AMIR 8ca8a2e8fb
bpo-39603: Prevent header injection in http methods (GH-18485)
reject control chars in http method in http.client.putrequest to prevent http header injection
2020-07-18 13:16:10 -07:00
Mark Shannon cb9879b948
bpo-40941: Unify implicit and explicit state in the frame and generator objects into a single value. (GH-20803)
* Merge gen and frame state variables into one.

* Replace stack pointer with depth in PyFrameObject. Makes code easier to read and saves a word of memory.
2020-07-17 11:44:23 +01:00
matthewhughes934 8e836bb21c
bpo-41195: Add getter for Openssl security level (GH-21282)
Add an accessor under SSLContext.security_level as a wrapper around
SSL_CTX_get_security_level, see:
https://www.openssl.org/docs/manmaster/man3/SSL_CTX_get_security_level.html


------
This is my first time contributing, so please pull me up on all the things I missed or did incorrectly.

Automerge-Triggered-By: @tiran
2020-07-17 01:59:15 -07:00
Terry Jan Reedy 38d3864efe
bpo-41300: IDLE - save files with non-ascii chars (GH-21512)
Fix regression released in 3.9.0b4 and 3.8.4.
2020-07-16 18:24:49 -04:00
Berker Peksag e34bbfd61f
bpo-31844: Remove _markupbase.ParserBase.error() (GH-8562) 2020-07-16 09:13:05 +03:00
Steve Dower 936a660945
bpo-41304: Ensure python3x._pth is loaded on Windows (GH-21495) 2020-07-15 22:56:49 +01:00
Rishi 5a8d121a1f
bpo-39017: Avoid infinite loop in the tarfile module (GH-21454)
Avoid infinite loop when reading specially crafted TAR files using the tarfile module
(CVE-2019-20907).
2020-07-15 13:51:00 +02:00
Tony Solomonik 568fb0ff4a
bpo-41273: asyncio's proactor read transport's better performance by using recv_into instead of recv (#21442)
* bpo-41273: Proactor transport read loop to use recv_into

By using recv_into instead of recv we do not allocate a new buffer each
time _loop_reading calls recv.

This betters performance for any stream using proactor (basically any
asyncio stream on windows).

* bpo-41273: Double proactor read transport buffer size

By doubling the read buffer size we get better performance.
2020-07-14 12:41:24 -07:00
Serhiy Storchaka 4f309abf55
bpo-41288: Fix a crash in unpickling invalid NEWOBJ_EX. (GH-21458)
Automerge-Triggered-By: @tiran
2020-07-13 05:49:26 -07:00
Sergey Golitsynskiy 6a1e9c2673
Fix error in docstrings in bisect module (GH-21422)
The docstrings for `bisect_right()` and `bisect_left()` contain sample
code that has a bug: `a.insert(x)` should be `a.insert(i, x)`.
2020-07-11 20:18:31 -03:00
Serhiy Storchaka 4c8f09d7ce
bpo-36346: Make using the legacy Unicode C API optional (GH-21437)
Add compile time option USE_UNICODE_WCHAR_CACHE. Setting it to 0
makes the interpreter not using the wchar_t cache and the legacy Unicode C API.
2020-07-10 23:26:06 +03:00
Terry Jan Reedy bce2eb4646
bpo-37765: Add keywords to IDLE tab completions (GH-15138)
Keywords are present in the main module tab completion lists generated by rlcompleter, which is used by REPLs on *nix. Add all keywords to IDLE's main module name list except those already added from builtins (True, False, and None) . This list may also be used by Show Completions on the Edit menu, and its hot key.

Rewrite Completions doc.

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2020-07-09 18:08:33 -04:00
Steve Dower af56c4fc76
bpo-41172: Fix check for compiler in test suite (GH-21400) 2020-07-09 18:52:43 +01:00
Chris Jerdonek 8b33961e4b
bpo-29590: fix stack trace for gen.throw() with yield from (#19896)
* Add failing test.

* bpo-29590: fix stack trace for gen.throw() with yield from (GH-NNNN)

When gen.throw() is called on a generator after a "yield from", the
intermediate stack trace entries are lost.  This commit fixes that.
2020-07-09 14:27:23 +01:00
Hai Shi 96a6a6d42b
bpo-40275: Use new test.support helper submodules in tests (GH-21412) 2020-07-09 15:25:10 +02:00
Mark Sapiro 4fa61a7732
bpo-40597: Allow email.contextmanager set_content() to set a null string. (GH-20542) 2020-07-08 14:00:35 -07:00
Joannah Nanjekye 6f13adf59e
Add a test for get_id() (GH-21370) 2020-07-07 21:45:45 -03:00
Joannah Nanjekye a95ac779e6
bpo-41224: Document is_annotated() in symtable module and update doc strings (GH-21369)
* Document is_annotate() and update doc strings

* Move quotes to the next line.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-07-07 20:09:56 -03:00
Victor Stinner 8f42748ded
bpo-29778: test_embed tests the path configuration (GH-21306) 2020-07-08 00:20:37 +02:00
Jason R. Coombs 6ae2780be0
bpo-41207 In distutils.spawn, rewrite FileNotFound (GH-21359)
Automerge-Triggered-By: @jaraco
2020-07-07 04:11:28 -07:00
Pablo Galindo c2c1f1f906
bpo-41218: Improve the test cases for test_compile_top_level_await_no_coro (GH-21363) 2020-07-06 23:30:14 +01:00
Matthias Bussonnier bd46174a5a
bpo-41218: Only mark async code with CO_COROUTINE. (#21357)
3.8.3 had a regression where compiling with
ast.PyCF_ALLOW_TOP_LEVEL_AWAIT woudl agressively mark things are
coroutine even if there were not.
2020-07-06 23:26:52 +02:00
Steve Dower dcbaa1b49c
bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297)
Also enables using debug build of `python3_d.dll`
Reference: CVE-2020-15523
2020-07-06 17:32:00 +01:00
Hai Shi deb016224c
bpo-40275: Use new test.support helper submodules in tests (GH-21317) 2020-07-06 14:29:49 +02:00
Hai Shi a089d21df1
bpo-40275: Use new test.support helper submodules in tests (GH-21315) 2020-07-06 11:15:08 +02:00
Hai Shi 883bc63833
bpo-40275: Use new test.support helper submodules in tests (GH-21314) 2020-07-06 11:12:49 +02:00
Pablo Galindo e51dd9dad6
bpo-29727: Register array.array as a MutableSequence (GH-21338) 2020-07-05 22:43:14 +01:00
Zackery Spytz 7fed75597f
bpo-39168: Remove the __new__ method of typing.Generic (GH-21327)
Automerge-Triggered-By: @gvanrossum
2020-07-04 22:07:43 -07:00
Konge daa0fe03a5
bpo-41162: Clear audit hooks later during finalization (GH-21222) 2020-07-03 22:06:46 +01:00
scoder 148f329135
bpo-39960: Allow heap types in the "Carlo Verre" hack check that override "tp_setattro()" (GH-21092)
Automerge-Triggered-By: @gvanrossum
2020-07-02 17:09:28 -07:00
Victor Stinner 0ab917e07e
bpo-41193: Ignore OSError in readline write_history() (GH-21279)
The write_history() atexit function of the readline completer now
ignores any OSError to ignore error if the filesystem is read-only,
instead of only ignoring FileNotFoundError and PermissionError.
2020-07-02 12:43:25 +02:00
Rémi Lapeyre 004e64e805
bpo-40967: Remove deprecated asyncio.Task.current_task() and asyncio.Task.all_tasks() (GH-20874) 2020-07-01 20:41:21 -07:00
Kit Choi 6b34d7b51e
bpo-39385: Add an assertNoLogs context manager to unittest.TestCase (GH-18067)
Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2020-07-01 22:08:38 +01:00
Rémi Lapeyre bd4a3f2145
bpo-39314: Closes parenthesis when autocompleting for functions that take no arguments (GH-20562) 2020-06-30 22:48:15 +09:00
Hai Shi 0c4f0f3b29
bpo-40275: Use new test.support helper submodules in tests (GH-21169) 2020-06-30 15:46:31 +02:00
Hai Shi 3ddc634cd5
bpo-40275: Use new test.support helper submodules in tests (GH-21219) 2020-06-30 15:46:06 +02:00
Serhiy Storchaka ba67d7386e
bpo-41142: Add support of non-ASCII paths for CAB files. (GH-21195)
* The path to the CAB file can be non-ASCII.
* Paths of added files can be non-ASCII.
2020-06-30 11:56:03 +03:00
Serhiy Storchaka 694d31e714
bpo-41158: IDLE: rewrite the code for handling file encoding (GH-21215) 2020-06-30 09:33:22 +03:00
Inada Naoki 038dd0f79d
bpo-36346: Raise DeprecationWarning when creating legacy Unicode (GH-20933) 2020-06-30 15:26:56 +09:00
Serhiy Storchaka 349f76c6aa
bpo-36346: Prepare for removing the legacy Unicode C API (AC only). (GH-21223) 2020-06-30 09:03:15 +03:00
Serhiy Storchaka 2515a28230
bpo-41152: IDLE: always use UTF-8 for standard IO streams (GH-21214) 2020-06-29 20:18:22 -04:00
Victor Stinner dd8a93e23b
bpo-23427: Add sys.orig_argv attribute (GH-20729)
Add sys.orig_argv attribute: the list of the original command line
arguments passed to the Python executable.

Rename also PyConfig._orig_argv to PyConfig.orig_argv and
document it.
2020-06-30 00:49:03 +02:00
Jason R. Coombs 2fb5f038f2
bpo-40924: Ensure importlib.resources.path returns an extant path (GH-20857) 2020-06-29 22:59:22 +02:00
Ravi Teja P b30ee26e36
bpo-41004: Resolve hash collisions for IPv4Interface and IPv6Interface (GH-21033)
The __hash__() methods of classes IPv4Interface and IPv6Interface had issue
of generating constant hash values of 32 and 128 respectively causing hash collisions.
The fix uses the hash() function to generate hash values for the objects
instead of XOR operation
2020-06-29 13:39:29 -04:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 7f569c9bc0
bpo-41048: mimetypes should read the rule file using UTF-8, not the locale encoding (GH-20998) 2020-06-29 11:36:48 +03:00
Serhiy Storchaka 04cdeb7a56
bpo-41138: Fix trace CLI for non-UTF-8 files. (GH-21177)
Fix also a resource warning when store counts and module info.
2020-06-28 13:34:22 +03:00
Zackery Spytz cd3c2bdd5d
bpo-31082: Use "iterable" in the docstring for functools.reduce() (GH-20796) 2020-06-28 15:40:54 +09:00
E-Paine 8ab77c6f9f
bpo-41144: Fix IDLE open module error (#21182)
Could not open os.path.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-06-28 02:02:47 -04:00
Guido van Rossum 9d197c7d48
bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags (#21021) 2020-06-27 17:33:49 -07:00
Batuhan Taskaya c8f29ad986
bpo-40769: Allow extra surrounding parentheses for invalid annotated assignment rule (GH-20387) 2020-06-27 19:33:08 +01:00
Lysandros Nikolaou 2e0a920e9e
bpo-41084: Adjust message when an f-string expression causes a SyntaxError (GH-21084)
Prefix the error message with `fstring: `, when parsing an f-string expression throws a `SyntaxError`.
2020-06-26 12:24:05 +01:00
Raymond Hettinger ef19bad7d6
Improve code organization for the random module (GH-21161) 2020-06-25 17:03:50 -07:00
Hai Shi 847f94f47b
bpo-40275: Use new test.support helper submodules in tests (GH-21151)
Use new test.support helper submodules in tests:

* distutils tests
* test_buffer
* test_compile
* test_filecmp
* test_fileinput
* test_readline
* test_smtpnet
* test_structmembers
* test_tools
2020-06-25 19:17:57 +02:00
Serhiy Storchaka 700cfa8c90
bpo-41069: Make TESTFN and the CWD for tests containing non-ascii characters. (GH-21035) 2020-06-25 17:56:31 +03:00
Hai Shi 06a40d7359
bpo-40275: Use new test.support helper submodules in tests (GH-20824) 2020-06-25 14:15:40 +02:00
Serhiy Storchaka 0f8ec1fff0
bpo-41113: Fix test_warnings on non-Western locales. (GH-21143) 2020-06-25 14:43:33 +03:00
Serhiy Storchaka aad8f0eeca
bpo-41112: Fix test_peg_generator on non-UTF-8 locales. (GH-21138) 2020-06-25 14:31:30 +03:00
Serhiy Storchaka 94eee69e9b
bpo-35773: Fix test_bdb on non-UTF-8 locales. (GH-21136) 2020-06-25 14:21:25 +03:00
Hai Shi f7ba40b505
bpo-40275: Use new test.support helper submodules in tests (GH-20849) 2020-06-25 12:38:51 +02:00
Serhiy Storchaka 55939b1708
bpo-41074: Fix support of non-ASCII names and SQL in msilib. (GH-21126)
* Fix support of non-ASCII names in functions OpenDatabase()
  and init_database().
* Fix support of non-ASCII SQL in method Database.OpenView().
2020-06-25 11:37:12 +03:00
Bruce Merry 152f0b8bee
bpo-41002: Optimize HTTPResponse.read with a given amount (GH-20943)
I've done the implementation for both non-chunked and chunked reads. I haven't benchmarked chunked reads because I don't currently have a convenient way to generate a high-bandwidth chunked stream, but I don't see any reason that it shouldn't enjoy the same benefits that the non-chunked case does. I've used the benchmark attached to the bpo bug to verify that performance now matches the unsized read case.

Automerge-Triggered-By: @methane
2020-06-24 23:30:21 -07:00
Serhiy Storchaka a7dc714701
bpo-41094: Additional fix for PYTHONSTARTUP. (GH-21119) 2020-06-24 19:46:30 +03:00
Jürgen Gmach 80526f6841
Fix typo in dataclasses module (GH-21109)
Automerge-Triggered-By: @matrixise
2020-06-24 03:46:52 -07:00
Serhiy Storchaka 6c6810d989
bpo-41094: Fix decoding errors with audit when open files. (GH-21095) 2020-06-24 08:46:05 +03:00
Raymond Hettinger f9bd05e83e
bpo-40521: Empty frozenset is no longer a singleton (GH-21085)
* Revert "bpo-40521: Make the empty frozenset per interpreter (GH-21068)"

This reverts commit 261cfedf76.

* bpo-40521: Empty frozensets are no longer singletons

* Complete the removal of the frozenset singleton
2020-06-23 17:42:55 +02:00
Ram Rachum bc43f6e212
bpo-41065: Use zip-strict in zoneinfo (GH-21031) 2020-06-23 10:21:26 -04:00
Raymond Hettinger 26a1ad1c24
Small clean-ups for the random module (GH-21038) 2020-06-22 19:38:59 -07:00
Krishna Chivukula 9e27bc0c1e
bpo-41005: Fixed perrmission error (GH-20936)
* fixed issue 41005: webbrowser fails when xdg-settings cannot be executed

Co-authored-by: KrishnaSai2020 <krishnasai.chivukula@gmal.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-06-22 11:06:07 +02:00
Serhiy Storchaka 36ff513f82
bpo-41068: Fix read after write in zipfile for non-ASCII files names. (GH-21040) 2020-06-22 11:24:11 +03:00
Serhiy Storchaka c88239f864
bpo-26407: Do not mask errors in csv. (GH-20536)
Unexpected errors in calling the __iter__ method are no longer
masked by TypeError in csv.reader(), csv.writer.writerow() and
csv.writer.writerows().
2020-06-22 11:21:59 +03:00
Serhiy Storchaka cafe1b6e9d
bpo-40824: Do not mask errors in __iter__ in "in" and the operator module. (GH-20537)
Unexpected errors in calling the __iter__ method are no longer
masked by TypeError in the "in" operator and functions
operator.contains(), operator.indexOf() and operator.countOf().
2020-06-22 10:43:35 +03:00
Joannah Nanjekye 6f79838fc1
Skip tests to fix bot (GH-20777)
Co-authored-by: nanjekyejoannah <joannah.nanjekye@ibm.com>
2020-06-21 20:59:43 -03:00
Dong-hee Na 6989af0bc7
bpo-41052: Opt out serialization/deserialization for _random.Random (GH-21002) 2020-06-21 18:44:58 +09:00
Serhiy Storchaka f9bab74d5b
bpo-41055: Remove outdated tests for the tp_print slot. (GH-21006) 2020-06-21 11:11:17 +03:00
Serhiy Storchaka 19fcffa927
bpo-41058: Use source file encoding in pdb.find_function(). (GH-21010) 2020-06-21 11:07:50 +03:00
Lysandros Nikolaou 6c4e0bd974
bpo-41060: Avoid SEGFAULT when calling GET_INVALID_TARGET in the grammar (GH-21020)
`GET_INVALID_TARGET` might unexpectedly return `NULL`, which if not
caught will cause a SEGFAULT. Therefore, this commit introduces a new
inline function `RAISE_SYNTAX_ERROR_INVALID_TARGET` that always
checks for `GET_INVALID_TARGET` returning NULL and can be used in
the grammar, replacing the long C ternary operation used till now.
2020-06-21 03:18:01 +01:00
Lysandros Nikolaou 314858e276
bpo-40939: Remove the old parser (Part 2) (GH-21005)
Remove some remaining files and Makefile targets for the old parser
2020-06-20 19:07:25 +01:00
Batuhan Taskaya 55460ee6dc
bpo-41044: Generate valid PEG python parsers for opt+seq rules (GH-20995)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-06-20 18:40:06 +01:00
Serhiy Storchaka 9355868458
bpo-41043: Escape literal part of the path for glob(). (GH-20994) 2020-06-20 11:10:31 +03:00
Serhiy Storchaka a041e116db
bpo-41040: Fix test_modulefinder. (GH-20991) 2020-06-20 00:06:07 +03:00
Victor Stinner 3358da4054
bpo-38377: Fix skip_if_broken_multiprocessing_synchronize() on macOS (GH-20984)
skip_if_broken_multiprocessing_synchronize() only attempts for create
a semaphore on Linux to fix multiprocessing
test_resource_tracker_reused() on macOS.
2020-06-19 18:01:20 +02:00
Christian Heimes 8a0fe7b454
Improve blake2 comment for Victor (GH-20981)
Signed-off-by: Christian Heimes <christian@python.org>

Automerge-Triggered-By: @tiran
2020-06-19 07:11:02 -07:00
Jürgen Gmach 66a65ba43c
Improve readability of `formataddr` docstring (GH-20963)
For me as a non native English speaker, the sentence with its embedded clause was very hard to understand.

modified:   Lib/email/utils.py

Automerge-Triggered-By: @csabella
2020-06-19 04:57:30 -07:00
Guido van Rossum 310f6aa7db
bpo-40636: PEP 618: add strict parameter to zip() (GH-20921)
zip() now supports PEP 618's strict parameter, which raises a
ValueError if the arguments are exhausted at different lengths.
Patch by Brandt Bucher.

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Co-authored-by: Ram Rachum <ram@rachum.com>
2020-06-19 12:16:57 +02:00
Lysandros Nikolaou 01ece63d42
bpo-40334: Produce better error messages on invalid targets (GH-20106)
The following error messages get produced:
- `cannot delete ...` for invalid `del` targets
- `... is an illegal 'for' target` for invalid targets in for
  statements
- `... is an illegal 'with' target` for invalid targets in
  with statements

Additionally, a few `cut`s were added in various places before the
invocation of the `invalid_*` rule, in order to speed things
up.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-06-19 00:10:43 +01:00
Serhiy Storchaka 8a64ceaf98
bpo-38144: Add the root_dir and dir_fd parameters in glob.glob(). (GH-16075) 2020-06-18 22:08:27 +03:00
Bar Harel 8f192d12af
bpo-40884: Added defaults parameter for logging.Formatter (GH-20668)
Docs and tests are underway.

Automerge-Triggered-By: @vsajip
2020-06-18 07:18:58 -07:00
Victor Stinner ddbeb2f3e0
bpo-38377: Add support.skip_if_broken_multiprocessing_synchronize() (GH-20944)
On Linux, skip tests using multiprocessing if the current user cannot
create a file in /dev/shm/ directory. Add the
skip_if_broken_multiprocessing_synchronize() function to the
test.support module.
2020-06-18 14:53:19 +02:00
Victor Stinner 9e09849d20
bpo-41006: importlib.util no longer imports typing (GH-20938)
Create importlib._abc submodule to avoid importing typing when
importlib.util is imported. Move Loader ABC into importlib._abc.
2020-06-17 23:15:59 +02:00
stratakis 236a0f5cf0
bpo-40637: Do not emit warnings for disabled builtin hashes (GH-20937)
test_hashlib emits some warnings when it cannot find some hashes
as it assumes they failed to compile. Since we can disable hashes
through configure, we emit the warnings only in the case that we
did not intentionaly disable them.

Automerge-Triggered-By: @tiran
2020-06-17 10:26:08 -07:00
Victor Stinner 98ce7b107e
bpo-41006: pkgutil imports lazily re (GH-20939)
The pkgutil module now imports lazily the re module to speedup Python
startup time.
2020-06-17 19:11:50 +02:00
Victor Stinner 7824cc05bf
bpo-41006: collections imports lazily heap (GH-20940)
The collections module now imports lazily the heapq modules in the
Counter.most_common() method to speedup Python startup time.
2020-06-17 19:10:47 +02:00
Christian Heimes bb6ec14479
bpo-41009: fix requires_OS_version() class decorator (GH-20942)
Signed-off-by: Christian Heimes <christian@python.org>

Automerge-Triggered-By: @tiran
2020-06-17 10:09:10 -07:00
Victor Stinner 8362893e3f
bpo-41003: Fix test_copyreg when numpy is installed (GH-20935)
Fix test_copyreg when numpy is installed: test.pickletester now
saves/restores warnings.filters when importing numpy, to ignore
filters installed by numpy.

Add the save_restore_warnings_filters() function to the
test.support.warnings_helper module.
2020-06-17 18:07:13 +02:00
Eric Snow 818f5b597a
bpo-32604: Clean up test.support.interpreters. (gh-20926)
There were some minor adjustments needed and a few tests were missing.

https://bugs.python.org/issue32604
2020-06-16 18:24:40 -06:00
Lysandros Nikolaou 113e2b0a07
bpo-40985: Show correct SyntaxError text when last line has a LINECONT (GH-20888)
When a file ends with a line that contains a line continuation character
the text of the emitted SyntaxError is empty, contrary to the old
parser, where the error text contained the text of the last line.
2020-06-16 01:27:33 +01:00
David Szotten 8666356280
closes bpo-28557: error message for bad raw readinto (GH-7496)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-06-15 18:53:57 -05:00
Xavier Fernandez 5f79f46612
bpo-38488: Upgrade bundled versions of pip & setuptools (GH-20491) 2020-06-15 15:16:48 -04:00
Krzysztof Konopko 4a3a682b12
bpo-40448: ensurepip: Do not use cache (GH-19812)
ensurepip optionally installs or upgrades 'pip' and 'setuptools' using
the version of those modules bundled with Python.  The internal PIP
installation routine by default temporarily uses its cache, if it
exists.  This is undesirable as Python builds and installations may be
independent of the user running the build, whilst PIP cache location
is dependent on the user's environment and outside of the build
environment.

At the same time, there's no value in using the cache while installing
bundled modules.

This change disables PIP caching when used in ensurepip.
2020-06-15 13:28:46 -04:00
roger d8cf3514dd
bpo-34226: fix cgi.parse_multipart without content_length (GH-8530)
In Python 3.7 the behavior of parse_multipart changed requiring CONTENT-LENGTH
header, this fix remove this header as required and fix FieldStorage
read_lines_to_outerboundary, by not using limit when it's negative,
since by default it's -1 if not content-length and keeps substracting what
was read from the file object.

Also added a test case for this problem.
2020-06-15 07:58:54 -07:00
Rémi Lapeyre 25f38d7044
bpo-40836: Add docstring to logging.fatal() and logging.Logger.fatal() (GH-20563)
Automerge-Triggered-By: @vsajip
2020-06-15 01:03:07 -07:00
Pablo Galindo 78319e373d
Include soft keywords in keyword.py (GH-20877) 2020-06-15 03:55:15 +01:00
Fantix King 8f04a84755
bpo-30064: Fix slow asyncio sock test (GH-20868)
Using a log2n way to fill a much smaller buffer, and receiving in a cleaner way with EOF.

The failing test was reproducible using the following command thanks to @aeros :

```bash
./python -m test test_asyncio.test_sock_lowlevel --match test_sock_client_racing -j100 -F -v
```

According to test results, we may still need to bump the timeout:

5aad027db9/Lib/test/test_asyncio/test_sock_lowlevel.py (L256-L257)
2020-06-14 00:43:57 -07:00
Raymond Hettinger 5aad027db9
Some reformatting (suggested by Black) and minor factoring. (GH-20865) 2020-06-13 19:17:28 -07:00
Raymond Hettinger d71ab4f738
bpo-40855: Fix ignored mu and xbar parameters (GH-20835) 2020-06-13 15:55:52 -07:00
Raymond Hettinger 9db5b8d448
Minor code clean-ups (GH-20838) 2020-06-13 09:46:47 -07:00
An Long 29c117202e
bpo-40834: Fix truncate when sending str object with channel (GH-20555) 2020-06-13 05:26:01 -07:00
Christian Heimes 08b1bbab6b
bpo-40964: disable remote IMAP tests (GH-20836)
Remote host cyrus.andrew.cmu.edu is blocking incoming connections and is
causing test suite to fail.

Signed-off-by: Christian Heimes <christian@python.org>
2020-06-12 14:54:03 -04:00
Dennis Sweeney 3ee0e48b03
bpo-40890: Add `mapping` property to dict views (GH-20749) 2020-06-12 10:19:25 -07:00
native-api 2145c8c972
bpo-33944: site: Add site-packages tracing in verbose mode (GH-12110) 2020-06-12 15:20:11 +09:00
MARK SCHWAB 60c2a810e3
bpo-40626: Support HDF5 in mimetypes (GH-20042)
Add hdf5 with .h5 file extension

See 'Recommendations' section for mime types from the HDF group:  https://www.hdfgroup.org/2018/06/citations-for-hdf-data-and-software/

Patch by Mark Schwab.
2020-06-11 15:04:13 -04:00
kernc 46398fba4d
bpo-29620: iterate over a copy of sys.modules (GH-4800)
unittest.TestCase.assertWarns no longer raises a RuntimeException
when accessing a module's ``__warningregistry__`` causes importation of a new
module, or when a new module is imported in another thread. 

Patch by Kernc.
2020-06-11 14:03:29 -04:00
Pablo Galindo 1ed83adb0e
bpo-40939: Remove the old parser (GH-20768)
This commit removes the old parser, the deprecated parser module, the old parser compatibility flags and environment variables and all associated support code and documentation.
2020-06-11 17:30:46 +01:00
Victor Stinner 311110abcd
bpo-40275: Move TransientResource to test_urllib2net (GH-20812)
Move TransientResource, time_out, socket_peer_reset and
ioerror_peer_reset from test.support to test_urllib2net.

Remove "import errno" from test.support.
2020-06-11 18:26:23 +02:00
Lysandros Nikolaou bcd7deed91
bpo-40939: Remove PEG parser easter egg (__new_parser__) (#20802)
It no longer serves a purpose (there's only one parser) and having "new" in any name will eventually look odd. Also, it impinges on a potential sub-namespace, `__new_...__`.
2020-06-11 09:09:21 -07:00
Hai Shi 10e6506aa8
bpo-40275: Add warnings_helper submodule in test.support (GH-20797) 2020-06-11 17:36:06 +02:00
Victor Stinner bdfe9b633a
bpo-40275: test.supports imports lazily fnmatch, glob, struct (GH-20810) 2020-06-11 17:30:57 +02:00
Victor Stinner d72b9644a3
bpo-40947: getpath.c uses PyConfig.platlibdir (GH-20807)
Followup of bpo-40854, there is one remaining usage of PLATLIBDIR
which should be replaced by config->platlibdir.

test_sys checks that sys.platlibdir attribute exists and is a string.

Update Makefile: getpath.c and sysmodule.c no longer need PLATLIBDIR
macro, PyConfig.platlibdir member is used instead.

Co-authored-by: Sandro Mani <manisandro@gmail.com>
2020-06-11 17:28:52 +02:00
Victor Stinner b2dca49ca3
bpo-34401: Fix test_gdb for HP GDB version string (GH-20804)
The GDB provided by HPE on HP-UX contains a modified version string. Therefore
the tests fail. Adapt the regex to match that string.

Patch by Michael Osipov.

Co-Authored-by: Michael Osipov <michael.osipov@siemens.com>
2020-06-11 15:48:03 +02:00
Lysandros Nikolaou 9727694f08
bpo-40939: Generate keyword.py using the new parser (GH-20800) 2020-06-11 13:45:15 +01:00
Raymond Hettinger 31d17798d6
Collections module reformatting and minor code refactoring (GH-20772) 2020-06-10 23:17:58 -07:00
Lysandros Nikolaou 896f4cf63f
bpo-40847: Consider a line with only a LINECONT a blank line (GH-20769)
A line with only a line continuation character should be considered
a blank line at tokenizer level so that only a single NEWLINE token
gets emitted. The old parser was working around the issue, but the
new parser threw a `SyntaxError` for valid input. For example,
an empty line following a line continuation character was interpreted
as a `SyntaxError`.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-06-11 00:56:08 +01:00
Hai Shi 7f888c7ef9
bpo-40275: Add import_helper submodule in test.support (GH-20794) 2020-06-11 01:51:18 +02:00
Victor Stinner 9c24e2e4c1
bpo-40927: Fix test_binhex when run twice (GH-20764)
test_binhex now uses import_fresh_module() to ensure that it raises
DeprecationWarning each time.
2020-06-10 19:54:29 +02:00
Victor Stinner f6e58aefde
bpo-40826: Fix test_repl.test_close_stdin() on Windows (GH-20779)
test_repl.test_close_stdin() now calls
support.suppress_msvcrt_asserts() to fix the test on Windows.

* Move suppress_msvcrt_asserts() from test.libregrtest.setup to
  test.support. Make its verbose parameter optional: verbose=False by
  default.
* Add msvcrt.GetErrorMode().
* SuppressCrashReport now uses GetErrorMode() and SetErrorMode() of
  the msvcrt module, rather than using ctypes.
* Remove also an unused variable (deadline) in wait_process().
2020-06-10 18:49:23 +02:00
Serhiy Storchaka ec88e1bca8
bpo-36543: Revert "bpo-36543: Remove the xml.etree.cElementTree module." (GH-20117)
* Revert "bpo-36543: Remove the xml.etree.cElementTree module. (GH-19108)"

This reverts commit b33e52511a.
2020-06-10 17:39:12 +02:00
Pablo Galindo c6483c9896
Raise specialised syntax error for invalid lambda parameters (GH-20776) 2020-06-10 14:07:06 +01:00
Hai Shi 0d00b2a5d7
bpo-40275: Add os_helper submodule in test.support (GH-20765) 2020-06-10 14:29:02 +02:00
Dennis Sweeney 07d8112812
bpo-40889: Optimize dict.items() ^ dict.items() (GH-20718) 2020-06-10 14:56:56 +09:00
Joannah Nanjekye bae872f1fe
bpo-32604: Recommit "bpo-32604: PEP 554 for use in test suite (GH-19985)" (GH-20611)
* PEP 554 for use in test suite

* 📜🤖 Added by blurb_it.

* Fix space

* Add doc to doc tree

* Move to modules doc tree

* Fix suspicious doc errors

* Fix test__all

* Docs docs docs

* Support isolated and fix wait

* Fix white space

* Remove undefined from __all__

* Fix recv and add exceptions

* Remove unused exceptions, fix pep 8 formatting errors and fix _NOT_SET in recv_nowait()

* Update Lib/test/support/interpreters.py

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>

* Remove documentation (module is for internal use)

Co-authored-by: nanjekyejoannah <joannah.nanjekye@ibm.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-06-10 00:53:23 -03:00
Raymond Hettinger 0a40849eb9
Minor improvement to the namedtuple implementation (GH-20741)
* Cleaner way to build the arg list with a trailing comma when required

* Fix appearance of __new__ in help()
2020-06-08 12:38:41 -07:00
Victor Stinner e81f6e687d
bpo-40910: Export Py_GetArgcArgv() function (GH-20721)
Export explicitly the Py_GetArgcArgv() function to the C API and
document the function. Previously, it was exported implicitly which
no longer works since Python is built with -fvisibility=hidden.

* Add PyConfig._orig_argv member.
* Py_InitializeFromConfig() no longer calls _PyConfig_Write() twice.
* PyConfig_Read() no longer initializes Py_GetArgcArgv(): it is now
  _PyConfig_Write() responsibility.
* _PyConfig_Write() result type becomes PyStatus instead of void.
* Write an unit test on Py_GetArgcArgv().
2020-06-08 18:12:59 +02:00
Sandro Mani 8f023a2f66
bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var (GH-20605) 2020-06-08 17:28:11 +02:00
Raymond Hettinger 3ff51d425e
Deny eval() direct access to builtins (GH-20713) 2020-06-07 23:51:40 -07:00
Pablo Galindo 9f495908c5
bpo-40903: Handle multiple '=' in invalid assignment rules in the PEG parser (GH-20697)
Automerge-Triggered-By: @pablogsal
2020-06-07 18:57:00 -07:00
Jason R. Coombs 843c277656
bpo-39791 native hooks for importlib.resources.files (GH-20576)
* Provide native .files support on SourceFileLoader.

* Add native importlib.resources.files() support to zipimporter. Remove fallback support.

* make regen-all

* 📜🤖 Added by blurb_it.

* Move 'files' into the ResourceReader so it can carry the relevant module name context.

* Create 'importlib.readers' module and add FileReader to it.

* Add zip reader and rely on it for a TraversableResources object on zipimporter.

* Remove TraversableAdapter, no longer needed.

* Update blurb.

* Replace backslashes with forward slashes.

* Incorporate changes from importlib_metadata 2.0, finalizing the interface for extension via get_resource_reader.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-06-07 21:00:51 -04:00
Pablo Galindo 972ab03276
bpo-40904: Fix segfault in the new parser with f-string containing yield statements with no value (GH-20701) 2020-06-08 01:47:37 +01:00
Jason R. Coombs 2efe18bf27
bpo-39791: Support file systems that cannot support non-ascii filenames (skipping tests in that case). (#20681) 2020-06-07 10:57:45 -04:00
Raymond Hettinger 0e96c419d7
Update comments to reflect the current API (GH-20682) 2020-06-06 12:42:54 -07:00
scoder f7c4e23642
bpo-40724: Support setting buffer slots from type specs (GH-20648)
This is not part of the limited API but makes the buffer slots available for type specs.
2020-06-06 21:35:10 +02:00
Batuhan Taskaya 68874a8502
bpo-40870: Invalidate usage of some constants with ast.Name (GH-20649) 2020-06-06 05:44:16 -07:00
Rémi Lapeyre b084d1b97e
bpo-40862: Raise TypeError when const is given to argparse.BooleanOptionalAction (GH-20623) 2020-06-05 15:00:42 -07:00
Jason R. Coombs 161541ab45
bpo-39791: Refresh importlib.metadata from importlib_metadata 1.6.1. (GH-20659)
* Refresh importlib.metadata from importlib_metadata 1.6.1.

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-06-05 16:34:16 -04:00
Stefan Krah 5fe1df1886
Fix missing FloatOperation in EXTRA_FUNCTIONALITY path. (#20655) 2020-06-05 22:01:18 +02:00
Furkan Önder fef1fae9df
bpo-19468: delete unnecessary instance check in importlib.reload() (GH-19424)
Automerge-Triggered-By: @brettcannon
2020-06-05 12:56:32 -07:00
Cheryl Sabella 052d3fc090
bpo-40807: Show warnings once from codeop._maybe_compile (#20486)
* bpo-40807: Show warnings once from codeop._maybe_compile

* Move catch_warnings

* news

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-06-04 19:40:24 -04:00
Christian Heimes b022e5cffb
bpo-17258: Add requires_hashdigest to multiprocessing tests (GH-20412)
Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked.

Signed-off-by: Christian Heimes <christian@python.org>
2020-06-04 05:48:17 -07:00
aboddie 5b9fbbabac
Update error message in _zoneinfo.py to use f-string (GH-20577)
Inline with the rest of the file, updated error message to use f-string.
2020-06-03 07:18:19 -07:00
Jeremy Attali c822efeda9
bpo-40767: Allow pure Wayland to get default XDG web browser (GH-20382)
Would be nice to backport to python 3.7+. I don't think it's worth the hassle to backport this all the way down to 3.10. But I'll let the maintainers decide.

This is hard to test because the test setup already includes this [environment variable](https://github.com/python/cpython/blob/master/Lib/test/pythoninfo.py#L292)

Let me know if something doesn't match the PR guidelines. This is my first PR in the python source code.
2020-06-03 05:42:33 -07:00
Victor Stinner fa7ab6aa0f
bpo-40826: Add _PyOS_InterruptOccurred(tstate) function (GH-20599)
my_fgets() now calls _PyOS_InterruptOccurred(tstate) to check for
pending signals, rather calling PyOS_InterruptOccurred().

my_fgets() is called with the GIL released, whereas
PyOS_InterruptOccurred() must be called with the GIL held.

test_repl: use text=True and avoid SuppressCrashReport in
test_multiline_string_parsing().

Fix my_fgets() on Windows: fgets(fp) does crash if fileno(fp) is closed.
2020-06-03 14:39:59 +02:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 85339f5c22
bpo-35078: Allow customization of CSS class name of a month in calendar module (gh-10137)
Refactor formatweekday(), formatmonthname() methods in LocaleHTMLCalendar and LocaleTextCalendar classes in calendar module to call the base class methods. This enables customizable CSS classes for LocaleHTMLCalendar and LocaleTextCalendar.

Patch by Srinivas Reddy Thatiparthy
2020-06-02 13:33:09 +02:00
Sanyam Khurana 8a3d2af997
bpo-26543: Fix IMAP4.noop when debug mode is enabled (GH-15206) 2020-06-02 03:17:45 +02:00
Hai Shi a97011b9b8
bpo-39593: Add test on ctypes cfield.c s_set() (GH-18424) 2020-06-01 18:54:18 +02:00
Victor Stinner 3026cad59b
bpo-40826: Add _Py_EnsureTstateNotNULL() macro (GH-20571)
Add _Py_EnsureTstateNotNULL(tstate) macro: call Py_FatalError() if
tstate is NULL, the error message contains the current function name.
2020-06-01 16:02:40 +02:00
Mark Shannon db64f12e4d
Make sure that keyword arguments are merged into the arguments dictionary when dict unpacking and keyword arguments are interleaved. (GH-20553) 2020-06-01 10:42:42 +01:00
Pablo Galindo 2f172d8f15
bpo-17005: Move topological sort functionality to its own module (GH-20558)
The topological sort functionality that was introduced initially in the
functools module has been moved to a new graphlib module to
better accommodate the new tools and keep the original scope of the
functools module.
2020-06-01 00:41:14 +01:00
Batuhan Taskaya cf88871d6a
bpo-40759: Deprecate the symbol module (GH-20364)
Automerge-Triggered-By: @pablogsal
2020-05-31 15:01:50 -07:00
Raymond Hettinger b7d79b4f36
bpo-40755: Add rich comparisons to Counter (GH-20548) 2020-05-31 14:57:42 -07:00
Kyle Stanley 2b201369b4
Fix asyncio.to_thread() documented return type (GH-20547)
When I wrote the documentation for `asyncio.to_thread()`, I mistakenly assumed that `return await loop.run_in_executor(...)` within an async def function would return a Future. In reality, it returns a coroutine.

This likely won't affect typical usage of `asyncio.to_thread()`, but it's important for the documentation to be correct here. In general, we also tend to avoid returning futures from high-level APIs in asyncio.
2020-05-31 00:07:04 -07:00
Terry Jan Reedy 97e4e0f53d
bpo-39885: Make IDLE context menu cut and copy work again (GH-18951)
Leave selection when right click within.  This exception to clearing selections when right-clicking was omitted from the previous commit, 4ca060d.  I did not realize that this completely disabled the context menu entries, and  I should have merged a minimal fix immediately.  An automated test should follow.
2020-05-29 18:54:14 -04:00
Niklas Fiekas 8bd216dfed
bpo-29882: Add an efficient popcount method for integers (#771)
* bpo-29882: Add an efficient popcount method for integers

* Update 'sign bit' and versionadded in docs

* Add entry to whatsnew document

* Doc: use positive example, mention population count

* Minor cleanups of the core code

* Move popcount_digit closer to where it's used

* Use z instead of self after conversion

* Add 'absolute value' and 'population count' to docstring

* Fix clinic error about missing summary line

* Ensure popcount_digit is portable with 64-bit ints

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2020-05-29 17:28:02 +01:00
Paul Ganssle 364b5ead15
Further de-linting of zoneinfo module (#20499)
* Remove unused imports in zoneinfo

* Remove unused variables in zoneinfo

* Remove else after raise
2020-05-29 09:34:30 -04:00
Mark Dickinson 895c9c1d43
bpo-40780: Fix failure of _Py_dg_dtoa to remove trailing zeros (GH-20435)
* Fix failure of _Py_dg_dtoa to remove trailing zeros

* Add regression test and news entry

* Add explanation about why it's safe to strip trailing zeros

* Make code safer, clean up comments, add change note at top of file

* Nitpick: avoid implicit int-to-float conversion in tests
2020-05-29 14:23:57 +01:00
Abhilash Raj 21017ed904
bpo-39040: Fix parsing of email mime headers with whitespace between encoded-words. (gh-17620)
* bpo-39040: Fix parsing of email headers with encoded-words inside a quoted string.

It is fairly common to find malformed mime headers (especially content-disposition
headers) where the parameter values, instead of being encoded to RFC
standards, are "encoded" by doing RFC 2047 "encoded word" encoding, and
then enclosing the whole thing in quotes.  The processing of these malformed
headers was incorrectly leaving the spaces between encoded words in the decoded
text (whitespace between adjacent encoded words is supposed to be stripped on
decoding).  This changeset fixes the encoded word processing inside quoted strings
(bare-quoted-string) to do correct RFC 2047 decoding by stripping that
whitespace.
2020-05-28 20:04:59 -04:00
Erlend Egeberg Aasland c610d970f5
bpo-40784: Fix sqlite3 deterministic test (GH-20448) 2020-05-29 02:27:31 +03:00
Fantix King dc4eee9e26
bpo-30064: Properly skip unstable loop.sock_connect() racing test (GH-20494) 2020-05-28 14:56:42 -07:00
Raymond Hettinger 60398512c8
bpo-40755: Add missing multiset operations to Counter() (GH-20339) 2020-05-28 08:35:46 -07:00
Victor Stinner 753643205a
bpo-40275: Fix test.support.threading_helper (GH-20488)
* Add missing sys import
* Get verbose and gc_collect() from test.support
* Remove unused starttime variable.

Issues spotted by pyflakes.
2020-05-28 16:37:37 +02:00
Hai Shi 24bddc1b3b
bpo-40275: Remove test.support.TESTFN_ENCODING (GH-20482)
Replace test.support.TESTFN_ENCODING with sys.getfilesystemencoding().
2020-05-28 16:24:39 +02:00
Victor Stinner 84ee7e1573
bpo-30064: Fix unstable asyncio "racing" socket tests (GH-20485)
Skip new "racing" socket tests which fail randomly until someone fix
them, to ease analysis of buildbot failures (skip tests which are
known to be broken/unstable).
2020-05-28 16:08:50 +02:00
Victor Stinner 4fd4963ccc
Revert "Upgrade bundled versions of pip & setuptools (#16782)" (GH-20484)
This reverts commit feb0846c3a.
2020-05-28 15:57:49 +02:00
Serhiy Storchaka 5f4b229df7
bpo-40792: Make the result of PyNumber_Index() always having exact type int. (GH-20443)
Previously, the result could have been an instance of a subclass of int.

Also revert bpo-26202 and make attributes start, stop and step of the range
object having exact type int.

Add private function _PyNumber_Index() which preserves the old behavior
of PyNumber_Index() for performance to use it in the conversion functions
like PyLong_AsLong().
2020-05-28 10:33:45 +03:00
Victor Stinner aa890630bc
bpo-40275: test.support imports subprocess lazily (GH-20471)
test.support module now imports the platform and subprocess modules
lazily to reduce the number of modules imported by
"import test.support".

With this change, the threading module is no longer imported
indirectly by "import test.support".

Use sys.version rather than platform.machine() to detect the Windows
ARM32 buildbot.
2020-05-28 01:56:29 +02:00
Victor Stinner b0461e19b5
bpo-40275: test.support.check_impl_detail() uses sys.implementation (GH-20468)
check_impl_detail() of test.support now uses sys.implementation.name,
instead of platform.python_implementation().lower(). This change
prepares test.support to import the platform module lazily.
2020-05-28 00:44:23 +02:00
Victor Stinner 10228bad04
bpo-40795: ctypes calls unraisablehook with an exception (GH-20452)
If ctypes fails to convert the result of a callback or if a ctypes
callback function raises an exception, sys.unraisablehook is now
called with an exception set. Previously, the error was logged into
stderr by PyErr_Print().
2020-05-28 00:38:12 +02:00
Hai Shi e80697d687
bpo-40275: Adding threading_helper submodule in test.support (GH-20263) 2020-05-28 00:10:27 +02:00
Pablo Galindo 7d80b35af1
Revert "bpo-32604: PEP 554 for use in test suite (GH-19985)" (#20465)
This reverts commit 9d17cbf33d.
2020-05-27 23:33:13 +02:00
Shantanu c116c94ff1
bpo-40614: Respect feature version for f-string debug expressions (GH-20196)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2020-05-27 21:30:38 +01:00
Christian Heimes db5aed931f
bpo-40791: Use CRYPTO_memcmp() for compare_digest (#20456)
hashlib.compare_digest uses OpenSSL's CRYPTO_memcmp() function
when OpenSSL is available.

Note: The _operator module is a builtin module. I don't want to add
libcrypto dependency to libpython. Therefore I duplicated the wrapper
function and added a copy to _hashopenssl.c.
2020-05-27 21:50:06 +02:00
Fantix King 210a137396
bpo-30064: Fix asyncio loop.sock_* race condition issue (#20369) 2020-05-27 12:47:30 -07:00
Sean Gillespie 29a1384c04
bpo-13097: ctypes: limit callback to 1024 arguments (GH-19914)
ctypes now raises an ArgumentError when a callback
is invoked with more than 1024 arguments.

The ctypes module allocates arguments on the stack in
ctypes_callproc() using alloca(), which is problematic
when large numbers of arguments are passed. Instead
of a stack overflow, this commit raises an ArgumentError
if more than 1024 parameters are passed.
2020-05-27 17:22:07 +02:00
Xavier Fernandez feb0846c3a
Upgrade bundled versions of pip & setuptools (#16782) 2020-05-27 20:49:34 +10:00
Pablo Galindo 404b23b85b
Fix lookahead of soft keywords in the PEG parser (GH-20436)
Automerge-Triggered-By: @gvanrossum
2020-05-26 16:15:52 -07:00
Guido van Rossum b45af1a569
Add soft keywords (GH-20370)
These are like keywords but they only work in context; they are not reserved except when there is an exact match.

This would enable things like match statements without reserving `match` (which would be bad for the `re.match()` function and probably lots of other places).

Automerge-Triggered-By: @gvanrossum
2020-05-26 10:58:44 -07:00
Serhiy Storchaka 578c3955e0
bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)
Only __index__ should be used to make integer conversions lossless.
2020-05-26 18:43:38 +03:00
Arturo Escaip 8ad052464a
bpo-40756: Default second argument of LoggerAdapter.__init__ to None (GH-20362)
The 'extra' argument is not always used by custom logger adapters. For
example:

```python
class IndentAdapter(logging.LoggerAdapter):
    def process(self, msg, kwargs):
        indent = kwargs.pop(indent, 1)
        return ' ' * indent + msg, kwargs
```

It is cleaner and friendlier to default the 'extra' argument to None
instead of either forcing the subclasses of LoggerAdapter to pass a None
value directly or to override the constructor.

This change is backward compatible because existing calls to
`LoggerAdapter.__init__` are already passing a value for the second
argument.

Automerge-Triggered-By: @vsajip
2020-05-26 07:55:21 -07:00
idomic db098bc1f0
bpo-39244: multiprocessing return default start method first on macOS (GH-18625) 2020-05-26 17:54:21 +03:00
Christian Heimes be63019ed7
bpo-40637: Fix test_pbkdf2_hmac_py for missing sha1 (#20422) 2020-05-26 12:26:29 +02:00
Serhiy Storchaka 1c5d1d7304
Remove duplicated words words (GH-20413) 2020-05-26 01:04:14 -07:00
Raymond Hettinger 3cfe5b7b8f
Simplify creation of the __new__ method in namedtuple() (GH-20361) 2020-05-25 21:39:00 -07:00
Lysandros Nikolaou f7b1e46156
bpo-38964: Print correct filename on a SyntaxError in an fstring (GH-20399)
When a `SyntaxError` in the expression part of a fstring is found,
the filename attribute of the `SyntaxError` is always `<fstring>`.
With this commit, it gets changed to always have the name of the file
the fstring resides in.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-05-26 01:32:18 +01:00
Rotuna 448325369f
bpo-23082: Better error message for PurePath.relative_to() from pathlib (GH-19611)
Co-authored-by: Sadhana Srinivasan <rotuna@Sadhanas-MBP.fritz.box>
2020-05-25 20:42:28 +01:00
Miro Hrončok ef16958d17
bpo-38972: Fix typos in PowerShell Execution Policies links (GH-20383) 2020-05-25 16:54:14 +02:00
Christian Heimes 4cc2f9348c
bpo-40695: Limit hashlib builtin hash fallback (GH-20259)
:mod:`hashlib` no longer falls back to builtin hash implementations when
OpenSSL provides a hash digest and the algorithm is blocked by security
policy.

Signed-off-by: Christian Heimes <christian@python.org>
2020-05-25 01:43:10 -07:00
Zackery Spytz 3f59b55316
bpo-35714: Reject null characters in struct format strings (GH-16928)
struct.error is now raised if there is a null character in a struct
format string.
2020-05-25 10:55:09 +03:00
Rémi Lapeyre c73914a562
bpo-36290: Fix keytword collision handling in AST node constructors (GH-12382) 2020-05-24 22:12:57 +01:00
Dong-hee Na 3436f5f899
bpo-40443: Remove unused imports in the zoneinfo (GH-20354) 2020-05-24 23:37:08 +09:00
Terry Jan Reedy 16ef324193
bpo-37309: Update IDLE NEWS.txt (GH-20356) 2020-05-24 09:57:55 -04:00