summaryrefslogtreecommitdiffstats
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* bpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481)Inada Naoki2021-03-2915-15/+93
| | | | | | | | | | | See [PEP 597](https://www.python.org/dev/peps/pep-0597/). * Add `-X warn_default_encoding` and `PYTHONWARNDEFAULTENCODING`. * Add EncodingWarning * Add io.text_encoding() * open(), TextIOWrapper() emits EncodingWarning when encoding is omitted and warn_default_encoding is enabled. * _pyio.TextIOWrapper() uses UTF-8 as fallback default encoding used when failed to import locale module. (used during building Python) * bz2, configparser, gzip, lzma, pathlib, tempfile modules use io.text_encoding(). * What's new entry
* bpo-25643: Refactor the C tokenizer into smaller, logical units (GH-25050)Pablo Galindo2021-03-282-2/+19
|
* bpo-43562: fix test_ssl to skip on unreachable network (GH-24937)Carl Meyer2021-03-271-0/+2
| | | This test checks result code of the connection directly, so it never raises an exception that can be suppressed by `support.transient_internet`. Directly support skipping the test in case of unreachable network.
* bpo-40645: use C implementation of HMAC (GH-24920)Christian Heimes2021-03-273-80/+121
| | | | | | - [x] fix tests - [ ] add test scenarios for old/new code. Signed-off-by: Christian Heimes <christian@python.org>
* bpo-42136: Deprecate module_repr() as found in importlib (GH-25022)Brett Cannon2021-03-266-8/+38
|
* bpo-41064: Improve syntax error for invalid usage of '**' in f-strings ↵Pablo Galindo2021-03-241-0/+9
| | | | (GH-25006)
* bpo-42137: have ModuleType.__repr__ prefer __spec__ over module_repr() ↵Brett Cannon2021-03-243-23/+8
| | | | | (GH-24953) This is to work towards the removal of the use of module_repr() in Python 3.12 (documented as deprecated since 3.4).
* bpo-42914: add a pprint underscore_numbers option (GH-24864)sblondon2021-03-242-6/+28
| | | | | pprint() gains a new boolean underscore_numbers kwarg to emit integers with thousands separated by an underscore character for improved readability (for example 1_000_000 instead of 1000000).
* bpo-31861: Add aiter and anext to builtins (#23847)Joshua Bronson2021-03-232-0/+85
| | | | | | Co-authored-by: jab <jab@users.noreply.github.com> Co-authored-by: Daniel Pope <mauve@mauveweb.co.uk> Co-authored-by: Justin Wang <justin39@gmail.com>
* bpo-41718: runpy now imports pkgutil in functions (GH-24996)Victor Stinner2021-03-231-1/+2
| | | | | | Reduce the number of modules imported by "python3 -m module". The runpy module no longer imports at startup (in the module body), but only in functions using it: _get_code_from_file() and run_path().
* bpo-41718: subprocess imports grp and pwd on demand (GH-24987)Victor Stinner2021-03-232-24/+23
| | | | | The shutil and subprocess modules now only import the grp and pwd modules when they are needed, which is not the case by default in subprocess.
* bpo-41718: libregrtest avoids importing datetime (GH-24985)Victor Stinner2021-03-232-5/+6
| | | | * libregrtest reimplements datetime.timedelta.__str__() * support.testresult only imports datetime if USE_XML is true.
* bpo-41718: Disable support.testresult XML output by default (GH-24982)Victor Stinner2021-03-232-7/+22
| | | | | | | RegressionTestResult.USE_XML must now be set to True to get the JUnit XML output. Reduce the number of imports when --junit-xml=FILE option is not used: 153 => 144 (-9).
* bpo-41718: libregrtest runtest avoids import_helper (GH-24983)Victor Stinner2021-03-231-2/+4
| | | | Inline import_helper.unload() in libregrtest.runtest to avoid one import.
* bpo-41718: Reduce libregrtest runtest imports (GH-24980)Victor Stinner2021-03-223-97/+107
| | | | | | Move clear_caches() from libregrtest.refleak to libregrtest.utils to avoid importing libregrtest.refleak when it's not needed. clear_caches() now only calls re.purge() if 're' is in sys.modules.
* bpo-41718: regrtest saved_test_environment avoids imports (GH-24934)Victor Stinner2021-03-222-42/+69
| | | | | | | | | | | | | | | | | | | | | | | | | Reduce the number of modules imported by libregrtest. saved_test_environment no longer imports modules at startup, but try to get them from sys.modules. If an module is missing, skip the test. It also sets directly support.environment_altered. runtest() now now two saved_test_environment instances: one before importing the test module, one after importing it. Remove imports from test.libregrtest.save_env: * asyncio * logging * multiprocessing * shutil * sysconfig * urllib.request * warnings When a test method imports a module (ex: warnings) and the test has a side effect (ex: add a warnings filter), the side effect is not detected, because the module was not imported when Python enters the saved_test_environment context manager.
* bpo-43555: Report the column offset for invalid line continuation character ↵Pablo Galindo2021-03-221-0/+5
| | | | (GH-24939)
* bpo-43591: Fix error location in interactive mode for errors at the end of ↵Pablo Galindo2021-03-221-2/+8
| | | | | the line (GH-24973) Co-authored-by: Erlend Egeberg Aasland
* bpo-35134: Add include/cpython/compile.h (GH-24922)Hai Shi2021-03-221-1/+1
| | | | Move C API excluded from the limited C API from Include/compile.h to a new Include/cpython/compile.h header file.
* bpo-43420: Simple optimizations for Fraction's arithmetics (GH-24779)Sergey B Kirpichev2021-03-222-9/+118
| | | | | | | bpo-43420: Implement standard transformations in + - * / that can often reduce the size of intermediate integers needed. For rationals with large components, this can yield dramatic speed improvements, but for small rationals can run 10-20% slower, due to increased fixed overheads in the longer-winded code. If those slowdowns turn out to be a problem, see the PR discussion for low-level implementation tricks that could cut other fixed overheads. Co-authored-by: Tim Peters <tim.peters@gmail.com> Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-43422: Revert _decimal C API addition (GH-24960)Antoine Pitrou2021-03-211-176/+0
| | | | | | | | | Stefan Krah requested the reversal of these (unreleased) changes, quoting him: > The capsule API does not meet my testing standards, since I've focused on the upstream mpdecimal in the last couple of months. > Additionally, I'd like to refine the API, perhaps together with the Arrow community. Automerge-Triggered-By: GH:pitrou
* bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback ↵Christian Heimes2021-03-211-0/+22
| | | | | | | | | | | | (GH-24957) OpenSSL copies the internal message callback from SSL_CTX->msg_callback to SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback to use the callback value of the new context. PySSL_set_context() now resets the callback and _PySSL_msg_callback() resets thread state in error path. Signed-off-by: Christian Heimes <christian@python.org>
* bpo-43542: Add heif/heic formats in mimetypes (GH-24917)Ilya Stepin2021-03-201-0/+2
| | | | | | | | | | * bpo-43542: Add heif/heic formats in mimetypes Add HEIF and HEIC format to list of media types. It has IANA registration. IANA: https://www.iana.org/assignments/media-types/image/heic HEIF Github: https://github.com/nokiatech/heif Co-authored-by: Gregory P. Smith <greg@krypto.org>
* bpo-43517: Fix false positive in detection of circular imports (#24895)Antoine Pitrou2021-03-203-1/+78
|
* bpo-41561: Add workaround for Ubuntu's custom security level (GH-24915)Christian Heimes2021-03-181-0/+29
| | | | | | | | | | Ubuntu 20.04 comes with a patched OpenSSL 1.1.1. Default security level 2 blocks TLS 1.0 and 1.1 connections. Regular OpenSSL 1.1.1 builds allow TLS 1.0 and 1.1 on security level 2. See: See: https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1899878 See: https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1917625 Signed-off-by: Christian Heimes <christian@python.org>
* bpo-43521: Allow ast.unparse with empty sets and NaN (GH-24897)Kodi Arfer2021-03-182-9/+26
| | | Automerge-Triggered-By: GH:pablogsal
* bpo-39342: Expose X509_V_FLAG_ALLOW_PROXY_CERTS in ssl module (GH-18011)Chris Burr2021-03-181-0/+2
| | | Exposes the `X509_V_FLAG_ALLOW_PROXY_CERTS` constant as `ssl.VERIFY_ALLOW_PROXY_CERTS` to allow for proxy certificate validation as described in: https://www.openssl.org/docs/man1.1.1/man7/proxy-certificates.html
* bpo-42128: Add 'missing :' syntax error message to match statements (GH-24733)Pablo Galindo2021-03-181-0/+36
|
* bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)Victor Stinner2021-03-171-26/+60
| | | | | | | | | | 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.
* bpo-43497: Emit SyntaxWarnings for assertions with tuple constants. (GH-24867)tsukasa-au2021-03-161-2/+28
| | | | | | | | | | | | | | | | | | | * 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.
* bpo-41933: Clarify wording for s * n in Common Sequence Operations (GH-22570)Chavdar Yotov2021-03-151-2/+2
|
* bpo-43285 Make ftplib not trust the PASV response. (GH-24838)Gregory P. Smith2021-03-152-3/+35
| | | | | | | | | | | | | | | 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.
* Mark POP_TOP at end of expression statement as artificial, to conform to PEP ↵Mark Shannon2021-03-151-0/+8
| | | | 626. (GH-24860)
* bpo-43428: Improve documentation for importlib.metadata changes. (GH-24858)Jason R. Coombs2021-03-151-2/+18
| | | | | | | * 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.
* bpo-29982: Add "ignore_cleanup_errors" param to ↵CAM Gerlach2021-03-142-12/+102
| | | | tempfile.TemporaryDirectory() (GH-24793)
* bpo-39316: Make sure that attribute accesses and stores, including method ↵Mark Shannon2021-03-141-0/+45
| | | | calls, conform to PEP 626. (GH-24859)
* bpo-43410: Fix crash in the parser when producing syntax errors when reading ↵Pablo Galindo2021-03-141-1/+8
| | | | from stdin (GH-24763)
* bpo-43245: Add keyword argument support to ChainMap.new_child() (GH-24788)Kamil Turek2021-03-142-2/+9
|
* bpo-43428: Sync with importlib_metadata 3.7. (GH-24782)Jason R. Coombs2021-03-136-38/+308
| | | | | | | * bpo-43428: Sync with importlib_metadata 3.7.2 (67234b6) * Add blurb * Reformat blurb to create separate paragraphs for each change included.
* Update client.py (GH-24827)Géry Ogam2021-03-131-3/+0
|
* bpo-27820: Fix AUTH LOGIN logic in smtplib.SMTP (GH-24118)Pandu E POLUAN2021-03-122-3/+57
| | | | | | * 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.
* bpo-43356: Allow passing a signal number to interrupt_main() (GH-24755)Antoine Pitrou2021-03-111-10/+33
| | | | Also introduce a new C API ``PyErr_SetInterruptEx(int signum)``.
* bpo-43423 Fix IndexError in subprocess _communicate function (GH-24777)Chris Griffith2021-03-111-4/+2
| | | | | 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>
* bpo-43406: Fix test_signal.test_stress_modifying_handlers() (GH-24815)Victor Stinner2021-03-101-3/+13
| | | | | | | 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.
* bpo-43439: Add audit hooks for gc functions (GH-24794)Pablo Galindo2021-03-102-0/+31
|
* bpo-14678: Update zipimport to support importlib.invalidate_caches() (GH-24159)Desmond Cheong2021-03-082-0/+51
| | | 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.
* bpo-43353: Document that logging.getLevelName() accepts string ↵Mariusz Felisiak2021-03-081-2/+6
| | | | | | | representation of logging level. (GH-24693) [bpo-43353]() Automerge-Triggered-By: GH:vsajip
* bpo-43332: Buffer proxy connection setup packets before sending. (GH-24780)Gregory P. Smith2021-03-082-10/+29
| | | | | | 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.
* bpo-43405: Fix DeprecationWarnings in test_unicode (GH-24754)Zackery Spytz2021-03-071-20/+24
| | | | DeprecationWarnings were being raised in the test_encode_decimal() and test_transform_decimal() methods after 91a639a0949.
* bpo-43372: Use _freeze_importlib for regen-frozen. (GH-24759)Neil Schemenauer2021-03-061-3/+3
| | | | | | | This approach ensures the code matches the interpreter version. Previously, PYTHON_FOR_REGEN was used to generate the code, which might be wrong. The marshal format for code objects has changed with bpo-42246, commit 877df851. Update the code and the expected code sizes in ctypes test_frozentable.