Commit graph

109302 commits

Author SHA1 Message Date
Victor Stinner e0bf70d08c
bpo-43244: Fix test_peg_generator for PyAST_Validate() (GH-24912)
test_peg_generator now defines _Py_TEST_PEGEN macro when building C
code to not call PyAST_Validate() in Parser/pegen.c. Moreover, it
defines Py_BUILD_CORE_MODULE macro to get access to the internal
C API.

Remove "global_ast_state" from Python-ast.c when it's built by
test_peg_generator: always get the AST state from the current interpreter.
2021-03-18 02:46:06 +01:00
Pablo Galindo 08fb8ac99a
bpo-42128: Add 'missing :' syntax error message to match statements (GH-24733) 2021-03-18 01:03:11 +00:00
Victor Stinner 526fdeb227
bpo-43244: Add pycore_ast.h header file (GH-24908)
Move _PyAST_GetDocString() and _PyAST_ExprAsUnicode() functions the
internal C API: from Include/ast.h to a new
Include/internal/pycore_ast.h header file. Don't export these
functions anymore: replace PyAPI_FUNC() with extern.

Remove also unused includes.
2021-03-17 23:50:50 +01:00
Victor Stinner b4536e1c6a
bpo-43244: Rename pycore_ast.h to pycore_ast_state.h (GH-24907) 2021-03-17 23:11:03 +01:00
Elisha Hollander e272528bbd
Remove unnecessary imports in the grammar parser (GH-24904) 2021-03-17 22:07:17 +00:00
Victor Stinner 9976834f80
bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)
Python no longer fails at startup with a fatal error if a command
line argument contains an invalid Unicode character.

The Py_DecodeLocale() function now escapes byte sequences which would
be decoded as Unicode characters outside the [U+0000; U+10ffff]
range.

Use MAX_UNICODE constant in unicodeobject.c.
2021-03-17 21:46:53 +01:00
Mark Shannon 6086ae7fd4
Add PEP 626 to what's new in 3.10. (#24892) 2021-03-16 13:43:58 +00:00
tsukasa-au a8ef4572a6
bpo-43497: Emit SyntaxWarnings for assertions with tuple constants. (GH-24867)
* bpo-43497: Emit SyntaxWarnings for assertions with tuple constants.

Add a test that shows that a tuple constant (a tuple, where all of its
members are also compile-time constants) produces a SyntaxWarning. Then
fix this failure.

* Make SyntaxWarnings also work when "optimized".

* Split tests for SyntaxWarning to SyntaxError conversion

SyntaxWarnings emitted by the compiler when configured to be errors are
actually raised as SyntaxError exceptions.

Move these tests into their own method and add a test to ensure they are
raised. Previously we only tested that they were not raised for a
"valid" assertion statement.
2021-03-16 11:14:41 +00:00
Inada Naoki 1330338583
bpo-43506: Doc: Update removal schedule for Py_UNICODE encoder APIs (GH-24885)
See PEP 624.
2021-03-16 13:24:27 +09:00
Dennis Sweeney 448801da96
bpo-41361: Optimized argument parsing for deque_rotate (GH-24796) 2021-03-15 21:02:25 -07:00
Raymond Hettinger d69ae758a0
Minor updates to the vector demo (GH-24853) 2021-03-15 19:53:58 -07:00
Chavdar Yotov 0269ce87c9
bpo-41933: Clarify wording for s * n in Common Sequence Operations (GH-22570) 2021-03-15 23:50:49 +01:00
Gregory P. Smith 0ab152c6b5
bpo-43285 Make ftplib not trust the PASV response. (GH-24838)
bpo-43285: Make ftplib not trust the PASV response.

The IPv4 address value returned from the server in response to the PASV command
should not be trusted.  This prevents a malicious FTP server from using the
response to probe IPv4 address and port combinations on the client network.

Instead of using the returned address, we use the IP address we're
already connected to.  This is the strategy other ftp clients adopted,
and matches the only strategy available for the modern IPv6 EPSV command
where the server response must return a port number and nothing else.

For the rare user who _wants_ this ugly behavior, set a `trust_server_pasv_ipv4_address`
attribute on your `ftplib.FTP` instance to True.
2021-03-15 11:39:31 -07:00
Kazantcev Andrey 93d33b47af
Fix typo in the word "spaghetti" (GH-24866)
Automerge-Triggered-By: GH:Mariatta
2021-03-15 10:23:03 -07:00
Mark Shannon c5440937ef
Mark POP_TOP at end of expression statement as artificial, to conform to PEP 626. (GH-24860) 2021-03-15 14:24:25 +00:00
Jason R. Coombs 35d5068928
bpo-43428: Improve documentation for importlib.metadata changes. (GH-24858)
* bpo-43428: Sync with importlib_metadata 3.7.3 (16ac3a95)

* Add 'versionadded' for importlib.metadata.packages_distributions

* Add section in what's new for Python 3.10 highlighting most salient changes and relevant backport.
2021-03-14 22:20:49 -04:00
Terry Jan Reedy 5e29021a5e
bpo-43199: Briefly explain why no goto (GH-24852)
Answer "Why is there no goto?" in the Design and History FAQ.
2021-03-14 18:12:04 -04:00
CAM Gerlach bd2fa3c416
bpo-29982: Add "ignore_cleanup_errors" param to tempfile.TemporaryDirectory() (GH-24793) 2021-03-14 11:06:56 -07:00
Mark Shannon d48848c83e
bpo-39316: Make sure that attribute accesses and stores, including method calls, conform to PEP 626. (GH-24859) 2021-03-14 18:01:30 +00:00
Pablo Galindo cd8dcbc851
bpo-43410: Fix crash in the parser when producing syntax errors when reading from stdin (GH-24763) 2021-03-14 04:38:40 +01:00
Kamil Turek 9923df9641
bpo-43245: Add keyword argument support to ChainMap.new_child() (GH-24788) 2021-03-13 19:15:44 -08:00
Pablo Galindo 9c376bc1c4
bpo-43439: Wrapt the tuple in the audit events for the gc module (GH-24836) 2021-03-14 04:04:47 +01:00
Zackery Spytz f2b45367f1
Fix some minor errors in the docs (GH-24834) 2021-03-13 17:00:28 -08:00
Raymond Hettinger f00e82f8b8
bpo-43427: Separte the method overview from the static method specifics. (GH-24787) 2021-03-13 13:46:32 -08:00
Jason R. Coombs f917efccf8
bpo-43428: Sync with importlib_metadata 3.7. (GH-24782)
* bpo-43428: Sync with importlib_metadata 3.7.2 (67234b6)

* Add blurb

* Reformat blurb to create separate paragraphs for each change included.
2021-03-13 11:31:45 -05:00
Erlend Egeberg Aasland 2256a2876b
bpo-43444: Move sqlite3 MODULE_NAME from setup.py to module.h (GH-24801) 2021-03-13 17:33:39 +02:00
junyixie 75048c8a38
bpo-43441: Fix _PyType_ClearCache() for subinterpreters (GH-24822)
_PyType_ClearCache() now only resets next_version_tag in the main interpreter.

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-03-13 14:38:36 +01:00
junyixie 5bd1059184
bpo-40521: Make dtoa bigint free list per-interpreter (GH-24821) 2021-03-13 14:25:14 +01:00
Mariusz Felisiak d0a445490e
Update link to Django's Context class. (#24805)
* Update link to Django's Context class.
* Update link to get-pip.py.
2021-03-13 04:26:11 -08:00
Géry Ogam b6884ad268
Update client.py (GH-24827) 2021-03-13 04:22:03 -08:00
Pandu E POLUAN 7591d9455e
bpo-27820: Fix AUTH LOGIN logic in smtplib.SMTP (GH-24118)
* Fix auth_login logic (bpo-27820)

* Also fix a longstanding bug in the SimSMTPChannel.found_terminator() method that causes inability to test
SMTP AUTH with initial_response_ok=False.
2021-03-12 15:25:49 -08:00
Antoine Pitrou ba251c2ae6
bpo-43356: Allow passing a signal number to interrupt_main() (GH-24755)
Also introduce a new C API ``PyErr_SetInterruptEx(int signum)``.
2021-03-11 23:35:45 +01:00
Chris Griffith b4fc44bb2d
bpo-43423 Fix IndexError in subprocess _communicate function (GH-24777)
Check to make sure stdout and stderr are not empty before selecting an item from them in Windows subprocess._communicate.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2021-03-11 11:43:29 -08:00
Victor Stinner 87f649a409
bpo-43311: Create GIL autoTSSkey ealier (GH-24819)
At Python startup, call _PyGILState_Init() before
PyInterpreterState_New() which calls _PyThreadState_GET(). When
Python is built using --with-experimental-isolated-subinterpreters,
_PyThreadState_GET() uses autoTSSkey.
2021-03-10 20:00:46 +01:00
Dong-hee Na 9a9c11ad41
bpo-43287: Use PEP 590 vectorcall to speed up filter() (GH-24611) 2021-03-11 01:39:52 +09:00
Adrian Freund 0a30f0e934
Fix error in documentation for ast.match_case (GH-24807) 2021-03-10 07:58:31 -08:00
Victor Stinner 1fa17e8cc6
bpo-43406: Fix test_signal.test_stress_modifying_handlers() (GH-24815)
Fix a race condition of test_stress_modifying_handlers() of
test_signal: only raise signals while we are in the
catch_unraisable_exception() context manager.
Moreover, don't check if we received at least one
signal if at least one signal got ignored.
2021-03-10 15:26:45 +01:00
Victor Stinner a9c03d7fb7
bpo-43456: Remove _xxsubinterpreters from sys.stdlib_module_names (GH-24814) 2021-03-10 12:10:01 +01:00
Ikko Ashimine 57827f8754
Fix typo in compile.c (GH-24812)
guranteed -> guaranteed
2021-03-10 10:39:51 +00:00
Victor Stinner 307745aa42
bpo-43445: Add frozen modules to sys.stdlib_module_names (GH-24798)
Add frozen modules to sys.stdlib_module_names. For example, add
"_frozen_importlib" and "_frozen_importlib_external" names.

Add "list_frozen" command to Programs/_testembed.
2021-03-10 11:14:07 +01:00
Pablo Galindo b4f9089d4a
bpo-43439: Add audit hooks for gc functions (GH-24794) 2021-03-10 00:53:57 +00:00
Kamil Turek 62a03cd490
bpo-43446: Fix markup in sqlite3 footnote (GH-24806) 2021-03-10 01:41:41 +02:00
Erlend Egeberg Aasland 31818e98d3
bpo-43440 : Enable SQLite R*Tree support for windows builds (GH-24797) 2021-03-09 20:59:44 +00:00
Victor Stinner 0d6bd1ca7c
bpo-3329: Fix typo in PyObjectArenaAllocator doc (GH-24795) 2021-03-09 12:16:42 +01:00
Guilherme Martins Crocetti 0554044ddc
bpo-43415: Fix typo on dataclasses.rst (#24789) 2021-03-08 17:50:39 -05:00
Victor Stinner 9f672a52f5
bpo-37146: Move _PyEval_DeactivateOpCache() to the internal C API (GH-24786)
Don't export the symbol anymore.
2021-03-08 22:56:37 +01:00
Desmond Cheong 3abf6f0102
bpo-14678: Update zipimport to support importlib.invalidate_caches() (GH-24159)
Added an invalidate_caches() method to the zipimport.zipimporter class based on the implementation of importlib.FileFinder.invalidate_caches(). This was done by adding a get_files() method and an _archive_mtime attribute to zipimport.zipimporter to check for updates or cache invalidation whenever the cache of files and toc entry information in the zipimporter is accessed.
2021-03-08 12:06:02 -08:00
Mariusz Felisiak bbba28212c
bpo-43353: Document that logging.getLevelName() accepts string representation of logging level. (GH-24693)
[bpo-43353]()

Automerge-Triggered-By: GH:vsajip
2021-03-08 03:16:20 -08:00
Gregory P. Smith c25910a135
bpo-43332: Buffer proxy connection setup packets before sending. (GH-24780)
We now buffer the CONNECT request + tunnel HTTP headers into a single
send call.  This prevents the OS from generating multiple network
packets for connection setup when not necessary, improving efficiency.
2021-03-07 23:35:13 -08:00
cmhzc 8d00462850
bpo-43319: Fixed the tutorial on venv about standard library (GH-24740)
In the [official tutorial on virtual environment](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments)

> This will create the tutorial-env directory if it doesn’t exist, and also create directories inside it containing a copy of the Python interpreter, **the standard library**, and various supporting files.

According to the actual behavior of `venv` and [PEP 405](https://www.python.org/dev/peps/pep-0405/#id15)'s description about virtual environment, no standard library file is included in the virtual environment's directory.

Automerge-Triggered-By: GH:vsajip
2021-03-07 01:08:50 -08:00