Commit graph

26301 commits

Author SHA1 Message Date
Illia Volochii d36954b7ea
gh-91172: Create a workflow for verifying bundled pip and setuptools (GH-31885)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2022-06-22 15:32:22 +02:00
Jason R. Coombs c029b552f3
gh-93951: In test_bdb.StateTestCase.test_skip, avoid including auxiliary importers. (GH-93962)
Co-authored-by: Brett Cannon <brett@python.org>
2022-06-22 14:05:45 +02:00
chgnrdv dc8e1d0390
gh-94101 Disallow instantiation of SSLSession objects (GH-94102)
Fixes #94101

Automerge-Triggered-By: GH:tiran
2022-06-22 03:10:22 -07:00
Serhiy Storchaka fda4b2f063
gh-74696: Do not change the current working directory in shutil.make_archive() if possible (GH-93160)
It is no longer changed when create a zip or tar archive.

It is still changed for custom archivers registered with shutil.register_archive_format()
if root_dir is not None.

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-06-22 10:47:25 +02:00
Carl Bordum Hansen 9a479c3c10
gh-88123: Implement new Enum __contains__ (GH-93298)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2022-06-22 00:04:04 -07:00
Gregory P. Smith 296e4efebb
gh-89336: Remove configparser APIs that were deprecated for 3.12 (#92503)
https://github.com/python/cpython/issue/89336: Remove configparser 3.12 deprecations.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-06-21 14:31:25 -07:00
Gregory P. Smith 4abab6b603
gh-87389: Fix an open redirection vulnerability in http.server. (#93879)
Fix an open redirection vulnerability in the `http.server` module when
an URI path starts with `//` that could produce a 301 Location header
with a misleading target.  Vulnerability discovered, and logic fix
proposed, by Hamza Avvan (@hamzaavvan).

Test and comments authored by Gregory P. Smith [Google].
2022-06-21 13:16:57 -07:00
Ezio Melotti f28ec34c5c
gh-82927: Update files related to HTML entities. (GH-92504) 2022-06-21 22:03:12 +02:00
Jelle Zijlstra 4e08fbcfdf
gh-93021: Fix __text_signature__ for __get__ (GH-93023)
Because of the way wrap_descr_get is written, the second argument
to __get__ methods implemented through the wrapper is always
optional.
2022-06-21 21:45:38 +02:00
Mark Shannon 6f8875eba3
GH-93841: Allow stats to be turned on and off, cleared and dumped at runtime. (GH-93843) 2022-06-21 15:40:54 +01:00
Erlend Egeberg Aasland 94eeac03dc
gh-94028: Clear and reset sqlite3 statements properly in cursor iternext (GH-94042) 2022-06-21 12:30:29 +01:00
Dennis Sweeney 5fcfdd87c9
GH-91432: Specialize FOR_ITER (GH-91713)
* Adds FOR_ITER_LIST and FOR_ITER_RANGE specializations.

* Adds _PyLong_AssignValue() internal function to avoid temporary boxing of ints.
2022-06-21 11:19:26 +01:00
Victor Stinner d82e0bfe8b
gh-93839: Move Lib/ctypes/test/ to Lib/test/test_ctypes/ (#94041)
* Move Lib/ctypes/test/ to Lib/test/test_ctypes/
* Remove Lib/test/test_ctypes.py
* Update imports and build system.
2022-06-21 10:24:33 +02:00
Irit Katriel 889772fb56
GH-93678: refactor compiler so that optimizer does not need the assembler and compiler structs (GH-93842) 2022-06-21 09:22:17 +01:00
Christian Heimes 77c839c98f
gh-94021: Address unreachable code warning in specialize code (GH-94022) 2022-06-20 23:34:11 -07:00
Mark Shannon ab0e601016
GH-93516: Speedup line number checks when tracing. (GH-93763)
* Use a lookup table to reduce overhead of getting line numbers during tracing.
2022-06-20 13:00:42 +01:00
itssme affa9f22cf
gh-79009: sqlite3.iterdump now correctly handles tables with autoincrement (#9621)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-06-20 00:59:24 +02:00
Erlend Egeberg Aasland 8e08978141
gh-61162: Clarify sqlite3 connection context manager docs (GH-93890)
Explicitly note that transactions are only closed if there is an open
transation at `__exit__`, and that transactions are not implicitly
opened during `__enter__`.

Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>

Automerge-Triggered-By: GH:erlend-aasland
2022-06-19 13:17:43 -07:00
Victor Stinner 27b9894033
gh-93937, C API: Move PyFrame_GetBack() to Python.h (#93938)
Move the follow functions and type from frameobject.h to pyframe.h,
so the standard <Python.h> provide frame getter functions:

* PyFrame_Check()
* PyFrame_GetBack()
* PyFrame_GetBuiltins()
* PyFrame_GetGenerator()
* PyFrame_GetGlobals()
* PyFrame_GetLasti()
* PyFrame_GetLocals()
* PyFrame_Type

Remove #include "frameobject.h" from many C files. It's no longer
needed.
2022-06-19 12:02:33 +02:00
Jason R. Coombs 6066f450b9
gh-93975: Nicer error reporting in test_venv (GH-93959)
- gh-93957: Provide nicer error reporting from subprocesses in test_venv.EnsurePipTest.test_with_pip.
- Update changelog

This change does three things:

1. Extract a function for trapping output in subprocesses.
2. Emit both stdout and stderr when encountering an error.
3. Apply the change to `ensurepip._uninstall` check.
2022-06-18 13:47:27 -07:00
Ken Jin fea1e9bc5c
gh-93955: Use unbound methods for slot __getattr__ and __getattribute__ (GH-93956) 2022-06-18 22:42:42 +08:00
Serhiy Storchaka f9433fff47
gh-89828: Do not relay the __class__ attribute in GenericAlias (#93754)
list[int].__class__ returned type, and isinstance(list[int], type)
returned True. It caused numerous problems in code that checks
isinstance(x, type).
2022-06-18 11:34:57 +03:00
Chris Fernald c1e19421c2
gh-91387: Strip trailing slash from tarfile longname directories (GH-32423)
Co-authored-by: Brett Cannon <brett@python.org>
2022-06-17 15:38:41 -07:00
Kumar Aditya 96464e5401
GH-89858: Fix test_embed for out-of-tree builds (GH-93465) 2022-06-17 17:24:17 +01:00
Ken Jin 11190c4ad0
gh-92888: Fix memoryview bad __index__ use after free (GH-92946)
Co-authored-by: chilaxan <35645806+chilaxan@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <3659035+serhiy-storchaka@users.noreply.github.com>
2022-06-17 23:14:53 +08:00
Ken Jin a51742ab82
gh-93911: Specialize LOAD_ATTR_PROPERTY (GH-93912) 2022-06-17 23:13:17 +08:00
Victor Stinner 0ff626f210
gh-77782: Deprecate global configuration variable (#93943)
Deprecate global configuration variable like
Py_IgnoreEnvironmentFlag: the Py_InitializeFromConfig() API should be
instead.

Fix declaration of Py_GETENV(): use PyAPI_FUNC(), not PyAPI_DATA().
2022-06-17 16:12:00 +02:00
Victor Stinner c5b750dc0b
gh-93852: Add test.support.create_unix_domain_name() (#93914)
test_asyncio, test_logging, test_socket and test_socketserver now
create AF_UNIX domains in the current directory to no longer fail
with OSError("AF_UNIX path too long") if the temporary directory (the
TMPDIR environment variable) is too long.

Modify the following tests to use create_unix_domain_name():

* test_asyncio
* test_logging
* test_socket
* test_socketserver

test_asyncio.utils: remove unused time import.
2022-06-17 13:16:51 +02:00
Gregory P. Smith 4beee0c7b0
gh-91404: Revert "bpo-23689: re module, fix memory leak when a match is terminated by a signal or allocation failure (GH-32283) (#93882)
Revert "bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure (GH-32283)"

This reverts commit 6e3eee5c11.

Manual fixups to increase the MAGIC number and to handle conflicts with
a couple of changes that landed after that.

Thanks for reviews by Ma Lin and Serhiy Storchaka.
2022-06-17 01:19:44 -07:00
Irit Katriel e37a158725
GH-83658: make multiprocessing.Pool raise an exception if maxtasksperchild is not None or a positive int (GH-93364)
Closes #83658.
2022-06-17 00:14:26 -07:00
Brandt Bucher f8e576be0a
GH-91389: Fix dis position information for CACHEs (GH-93663) 2022-06-16 13:49:32 -07:00
Victor Stinner 4f85cec9e2
gh-93353: regrtest supports checking tmp files with -j2 (#93909)
regrtest now also implements checking for leaked temporary files and
directories when using -jN for N >= 2. Use tempfile.mkdtemp() to
create the temporary directory. Skip this check on WASI.
2022-06-16 21:48:26 +02:00
Serhiy Storchaka 138db8e48b
gh-93847: Fix repr of enum of generic aliases (GH-93885) 2022-06-16 12:16:12 -07:00
samtygier 9a458befdd
gh-91577: SharedMemory move imports out of methods (#91579)
SharedMemory.unlink() uses the unregister() function from resource_tracker. Previously it was imported in the method, but this can fail if the method is called during interpreter shutdown, for example when unlink is part of a __del__() method.

Moving the import to the top of the file, means that the unregister() method is available during interpreter shutdown.

The register call in SharedMemory.__init__() can also use this imported resource_tracker.
2022-06-16 15:41:51 +02:00
Christian Heimes 05b32c1c79
gh-93820: Fix copy() regression in enum.Flag (GH-93876)
GH-26658 introduced a regression in copy / pickle protocol for combined
`enum.Flag`s. `copy.copy(re.A | re.I)` would fail with
`AttributeError: ASCII|IGNORECASE`.

`enum.Flag` now has a `__reduce_ex__()` method that reduces flags by
combined value, not by combined name.
2022-06-15 23:42:36 -07:00
Steve Dower 99be1cbeb3
gh-93824: Reenable installation of shell extension on Windows ARM64 (GH-93825) 2022-06-15 17:07:55 +01:00
Erlend Egeberg Aasland d31834688b
gh-87260: Update sqlite3 signature docs to reflect actual implementation (#93840)
Align the docs for the following methods with the actual implementation:

- sqlite3.complete_statement()
- sqlite3.Connection.create_function()
- sqlite3.Connection.create_aggregate()
- sqlite3.Connection.set_progress_handler()
2022-06-15 12:28:24 +02:00
Irit Katriel af15cc534c
GH-93678: reduce boilerplate and code repetition in the compiler (GH-93682) 2022-06-14 13:40:09 +01:00
Erlend Egeberg Aasland 46740073ef
gh-79579: Improve DML query detection in sqlite3 (#93623)
The fix involves using pysqlite_check_remaining_sql(), not only to check
for multiple statements, but now also to strip leading comments and
whitespace from SQL statements, so we can improve DML query detection.

pysqlite_check_remaining_sql() is renamed lstrip_sql(), to more
accurately reflect its function, and hardened to handle more SQL comment
corner cases.
2022-06-14 13:56:36 +02:00
Ken Jin b083450f88
GH-93429: Merge LOAD_METHOD back into LOAD_ATTR (GH-93430) 2022-06-14 11:36:22 +01:00
Mark Shannon 3cd1a5d3ec
GH-93516: Store offset of first traceable instruction in code object (GH-93769) 2022-06-14 11:09:30 +01:00
Mark Shannon 2bf74753c1
GH-93662: Make sure that column offsets are correct in multi-line method calls. (GH-93673) 2022-06-14 11:08:12 +01:00
Victor Stinner 4caf5c2753
gh-91321: Fix compatibility with C++ older than C++11 (#93784)
Fix the compatibility of the Python C API with C++ older than C++11.

_Py_NULL is only defined as nullptr on C++11 and newer.
2022-06-14 11:43:08 +02:00
Petr Viktorin 3597c12941
gh-89546: Clean up PyType_FromMetaclass (GH-93686)
When changing PyType_FromMetaclass recently (GH-93012, GH-93466, GH-28748)
I found a bunch of opportunities to improve the code. Here they are.

Fixes: #89546

Automerge-Triggered-By: GH:encukou
2022-06-14 02:13:29 -07:00
Serhiy Storchaka d7db9dc3cc
gh-91810: Fix regression with writing an XML declaration with encoding='unicode' (GH-93426)
Suppress writing an XML declaration in open files in ElementTree.write()
with encoding='unicode' and xml_declaration=None.

If file patch is passed to ElementTree.write() with encoding='unicode',
always open a new file in UTF-8.
2022-06-14 07:25:33 +03:00
Serhiy Storchaka 8352e322e8
gh-79512: Fixed names and __module__ value of weakref classes (GH-93719)
Classes ReferenceType, ProxyType and CallableProxyType have now correct
atrtributes __module__, __name__ and __qualname__.
It makes them (types, not instances) pickleable.
2022-06-14 07:18:03 +03:00
Victor Stinner 443ca731d6
gh-93353: Fix importlib.resources._tempfile() finalizer (#93377)
Fix the importlib.resources.as_file() context manager to remove the
temporary file if destroyed late during Python finalization: keep a
local reference to the os.remove() function. Patch by Victor Stinner.
2022-06-13 19:24:00 +02:00
Pablo Galindo Salgado 65ff27c7d3
gh-91731: Don't define 'static_assert' in C++11 where is a keyword to avoid UB (GH-93700) 2022-06-13 15:49:08 +01:00
Serhiy Storchaka 3473817106
gh-91162: Support splitting of unpacked arbitrary-length tuple over TypeVar and TypeVarTuple parameters (alt) (GH-93412)
For example:

  A[T, *Ts][*tuple[int, ...]] -> A[int, *tuple[int, ...]]
  A[*Ts, T][*tuple[int, ...]] -> A[*tuple[int, ...], int]
2022-06-12 16:22:01 +03:00
Christian Heimes dc5e02b2f4
gh-84461: Use HOSTRUNNER to run regression tests (GH-93694)
Co-authored-by: Brett Cannon <brett@python.org>
2022-06-11 08:42:23 +02:00