Commit graph

116438 commits

Author SHA1 Message Date
Michael Handler
1a8f862e32
gh-66897: Upgrade HTTP CONNECT to protocol HTTP/1.1 (#8305)
* bpo-22708: Upgrade HTTP CONNECT to protocol HTTP/1.1 (GH-NNNN)

Use protocol HTTP/1.1 when sending HTTP CONNECT tunnelling requests;
generate Host: headers if one is not already provided (required by
HTTP/1.1), convert IDN domains to punycode in HTTP CONNECT requests.

* Refactor tests to pass under -bb (fix ByteWarnings); missed some lines >80.

* Use consistent 'tunnelling' spelling in Lib/http/client.py

* Lib/test/test_httplib: Remove remnant of obsoleted test.

* Use dict.copy() not copy.copy()

* fix version changed

* Update Lib/http/client.py

Co-authored-by: bgehman <bgehman@users.noreply.github.com>

* Switch to for/else: syntax, as suggested

* Don't use for: else:

* Sure, fine, w/e

* Oops

* 1nm to the left

---------

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: bgehman <bgehman@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-04-04 21:55:24 -07:00
Dong-hee Na
a62ff97075
gh-101525: Disable peephole optimization process of BOLT (gh-103187)
Co-authored-by: Dong-hee Na <donghee.na@linecorp.com>
2023-04-05 09:10:45 +09:00
Eric Snow
f513d5c806
gh-102660: Fix is_core_module() (gh-103257)
In gh-102744 we added is_core_module() (in Python/import.c), which relies on get_core_module_dict() (also added in that PR).  The problem is that_PyImport_FixupBuiltin(), which ultimately calls is_core_module(), is called on the builtins module before interp->builtins_copyis set.  Consequently, the builtins module isn't considered a "core" module while it is getting "fixed up" and its module def m_copy erroneously gets set.  Under isolated interpreters this causes problems since sys and builtins are allowed even though they are still single-phase init modules.  (This was discovered while working on gh-101660.)

The solution is to stop relying on get_core_module_dict() in is_core_module().
2023-04-04 17:03:40 -06:00
Tim Burke
bceb9e00ad
Improve some grammar in the socket docs (#103254) 2023-04-04 23:46:46 +01:00
Charles Machalow
935aa45235
GH-75586: Make shutil.which() on Windows more consistent with the OS (GH-103179) 2023-04-04 23:24:13 +01:00
Ned Deily
f184abbdc9
gh-103207: Add instructions to the macOS installer welcome display on how to workaround the macOS 13 Ventura “The installer encountered an error” failure. (GH-103251) 2023-04-04 17:06:00 -04:00
Thomas Wouters
30f82cf6c9 Merge branch 'main' of https://github.com/python/cpython into main 2023-04-04 22:01:07 +02:00
Thomas Wouters
a90f5ca87b Post 3.12.0a7 2023-04-04 22:00:41 +02:00
Steve Dower
fd1947ecfb
bpo-44844: Enable detection of Microsoft Edge browser in webbrowser module (GH-29908) 2023-04-04 17:00:03 +01:00
Thomas Wouters
b861ba4a82 Python 3.12.0a7 2023-04-04 17:52:42 +02:00
T. Wouters
89e6a34461
Fix a compiler warning in _xxsubinterpretermodule.c (#103245)
Fix a (correct) warning about potential uses of uninitialized memory in
_xxsubinterpreter. Unlike newly allocated PyObject structs or global
structs, stack-allocated structs are not initialised, and a few places in
the code expect the _sharedexception struct data to be either NULL or
initialised.
2023-04-04 16:51:30 +02:00
Erlend E. Aasland
c00dcf0e38
gh-103092: Isolate _pickle module (#102982)
Co-authored-by: Mohamed Koubaa <koubaa.m@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-04-04 15:38:54 +05:30
Ethan Furman
810d365b5e
gh-103056: [Enum] use staticmethod decorator for _gnv_ (GH-103231)
_gnv_ --> _generate_next_value_
2023-04-03 17:47:40 -07:00
Brett Cannon
c71756fa65
Specify more settings for the C extension of VS Code for dev containers (GH-103229)
Should help with auto-complete.
2023-04-03 16:47:48 -07:00
David Benjamin
02f9920900
gh-100062: Remove error code tables from _ssl and err_names_to_codes (GH-100063)
Prior to https://github.com/python/cpython/pull/25300, the
make_ssl_data.py script used various tables, exposed in _ssl, to update
the error list.

After that PR, this is no longer used. Moreover, the err_names_to_codes
map isn't used at all. Clean those up. This gets them out of the way if,
in the future, OpenSSL provides an API to do what the code here is doing
directly. (https://github.com/openssl/openssl/issues/19848)
2023-04-03 23:44:00 +01:00
Ethan Furman
5ffc1e5a21
gh-98298, gh-74730: [Enum] update docs (GH-103163)
fix FlagBoundary statements
add warning about reloading modules and enum identity
2023-04-03 14:57:42 -07:00
Sadra Barikbin
d3a7732dd5
gh-103215: Remove redundant if stmt from enum.EnumType._find_data_type_ (GH-103222) 2023-04-03 14:51:43 -07:00
Hugo van Kemenade
24facd60f6
gh-101100: Use list of 'dirty' docs, with warnings, instead of a clean list (#103191)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-04-03 21:59:47 +03:00
Barney Gale
11c302055a
GH-76846, GH-85281: Call __new__() and __init__() on pathlib subclasses (GH-102789)
Fix an issue where `__new__()` and `__init__()` were not called on subclasses of `pathlib.PurePath` and `Path` in some circumstances.

Paths are now normalized on-demand. This speeds up path construction, `p.joinpath(q)`, and `p / q`.

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2023-04-03 19:57:11 +01:00
Nikita Sobolev
2a721258a1
gh-101865: Deprecate co_lnotab from code objects as per PEP 626 (#101866)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-04-03 17:35:04 +02:00
Kumar Aditya
e6f7d35be7
GH-103182: use vectorcall in _asyncio instead of variadic calling APIs (#103175) 2023-04-03 18:14:32 +05:30
Shantanu
385b5d6e09
gh-102038: Skip a sometimes unnecessary stat in site.py (#102039) 2023-04-02 15:47:31 -07:00
Nouran Ali
55decb72c4
gh-102994: Profile docs has typo in example (#103074) 2023-04-02 15:44:16 -07:00
Charlie Zhao
32937d6aa4
gh-103109: Document ignore_warnings() test support helper (#103110)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-04-03 00:18:25 +02:00
Giampaolo Rodola
6883007a86
bpo-4080: unittest durations (#12271) 2023-04-03 00:12:51 +02:00
Ikko Eltociear Ashimine
a0305c5fdf
fix typo in _ssl.c (GH-103192)
seperated -> separated

Automerge-Triggered-By: GH:AlexWaygood
2023-04-02 08:25:46 -07:00
Alex Waygood
6d59c9e32e
gh-102433: Use inspect.getattr_static in typing._ProtocolMeta.__instancecheck__ (#103034) 2023-04-02 14:22:19 +01:00
Partha P. Mukherjee
d828b35785
GH-102456: Fix docstring and getopt options for base64 (gh-102457) 2023-04-02 14:05:50 +09:00
Irit Katriel
06249ec89f
gh-102192: deprecate _PyErr_ChainExceptions (#102935) 2023-04-01 21:30:23 +01:00
Irit Katriel
848bdbe166
gh-102192: use PyErr_SetHandledException instead of the legacy PyErr_SetExcInfo (#103157) 2023-04-01 10:31:48 +05:30
Brett Cannon
d97aef8ebf
Add missing variables to bytecodes.c (GH-103153)
The code works without this change, but it does cause C tooling to complain less about undeclared variables.
2023-03-31 14:23:55 -07:00
Alex Waygood
361a3eaf1b
gh-74690: Micro-optimise typing._get_protocol_attrs (#103152)
Improve performance of `isinstance()` checks against runtime-checkable protocols
2023-03-31 21:54:50 +01:00
Ethan Furman
2a4d8c0a9e
gh-102549: [Enum] fail enum creation when data type raises in __init__ (GH-103149) 2023-03-31 13:52:31 -07:00
Eric Snow
dfc4c95762
gh-101659: Clean Up the General Import Tests for Subinterpreters (gh-103151)
This involves 3 changes: some general cleanup, checks to match the kind of module, and switch from testing against sys to _imp.

This is a precursor to gh-103150, though the changes are meant to stand on their own.
2023-03-31 12:18:33 -06:00
Eric Snow
dde028480e
gh-100227: Fix Cleanup of the Extensions Cache (gh-103150)
Decref the key in the right interpreter in _extensions_cache_set().

This is a follow-up to gh-103084. I found the bug while working on gh-101660.
2023-03-31 12:09:10 -06:00
Alex Waygood
9048d73f7a
gh-74690: typing: Don't unnecessarily call _get_protocol_attrs twice in _ProtocolMeta.__instancecheck__ (#103141)
Speed up `isinstance()` calls against runtime-checkable protocols
2023-03-31 18:37:24 +01:00
Irit Katriel
80163e17d3
gh-87092: move CFG related code from compile.c to flowgraph.c (#103021) 2023-03-31 18:17:59 +01:00
James De Bias
b0422e140d
gh-102871: Remove obsolete browsers from webbrowser (#102872) 2023-03-31 11:02:47 -04:00
Furkan Onder
048d6243d4
GH-84783: Mention Author for GH-101264 (make slices hashable) (#103146)
Will Bradshaw contributed original patch on bpo-40603.
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-03-31 09:54:17 -04:00
Petr Viktorin
f6405a4662
Quote literal tokens in standard format specifier grammar (GH-102902)
Reported by Damian Dureck: https://mail.python.org/archives/list/docs@python.org/thread/UZTWBJIXC3MBKTHXVTIBPGDPKBNWZ5LN/
2023-03-31 14:40:38 +02:00
Hugo van Kemenade
20c0f196ff
gh-101100: Expand list of clean docs (GH-103135)
Follow on from https://github.com/python/cpython/pull/103116.

Expand list of clean docs files from 3 to 181. These files have no Sphinx warnings, and their presence in this list means that any new warnings introduced will fail the build.

The list was created by subtracting the list of files with warnings from a list of all files.

I tested with all of those, but found that `touch`ing two clean files (https://github.com/python/cpython/blob/main/Doc/includes/wasm-notavail.rst and https://github.com/python/cpython/blob/main/Doc/whatsnew/changelog.rst) caused a cascade effect and resulted in a number of dirty files being rebuilt too, and failing the build. So those two have been omitted.

Automerge-Triggered-By: GH:hugovk
2023-03-31 03:48:46 -07:00
Irit Katriel
44bd3fe570
gh-102799: use exception instance instead of sys.exc_info() (#102885) 2023-03-31 11:23:02 +01:00
gaogaotiantian
c1e71ce56f
Minor docs improvements fix for codeop (#103123) 2023-03-30 15:51:36 -07:00
Missoupro
01a49d1745
gh-102110: Add all tools description missed (GH-102625)
Added missing descriptions of some tools.

Automerge-Triggered-By: GH:hugovk
2023-03-30 13:49:07 -07:00
Brian Haley
ecc5441505
Add IPv6 into to the docstring for socket.getsockname (#102961)
Signed-off-by: Brian Haley <haleyb.dev@gmail.com>
2023-03-30 11:40:58 -07:00
Hugo van Kemenade
f192a558f5
gh-101100: Fix Sphinx warning in gc.rst and refactor docs clean list (#103116)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-03-30 21:03:50 +03:00
Jeong, YunWon
21e9de3bf0
gh-103085: Fix python locale.getencoding not to emit deprecation warning (gh-103086) 2023-03-31 01:23:43 +09:00
Shantanu
fda95aa194
gh-103099: Link mypy docs from typing.rst (#103100) 2023-03-30 01:32:09 -07:00
Eric Snow
dcd6f226d6
gh-100227: Make the Global PyModuleDef Cache Safe for Isolated Interpreters (gh-103084)
Sharing mutable (or non-immortal) objects between interpreters is generally not safe.  We can work around that but not easily. 
 There are two restrictions that are critical for objects that break interpreter isolation.

The first is that the object's state be guarded by a global lock.  For now the GIL meets this requirement, but a granular global lock is needed once we have a per-interpreter GIL.

The second restriction is that the object (and, for a container, its items) be deallocated/resized only when the interpreter in which it was allocated is the current one.  This is because every interpreter has (or will have, see gh-101660) its own object allocator.  Deallocating an object with a different allocator can cause crashes.

The dict for the cache of module defs is completely internal, which simplifies what we have to do to meet those requirements.  To do so, we do the following:

* add a mechanism for re-using a temporary thread state tied to the main interpreter in an arbitrary thread
   * add _PyRuntime.imports.extensions.main_tstate` 
   * add _PyThreadState_InitDetached() and _PyThreadState_ClearDetached() (pystate.c)
   * add _PyThreadState_BindDetached() and _PyThreadState_UnbindDetached() (pystate.c)
* make sure the cache dict (_PyRuntime.imports.extensions.dict) and its items are all owned by the main interpreter)
* add a placeholder using for a granular global lock

Note that the cache is only used for legacy extension modules and not for multi-phase init modules.

https://github.com/python/cpython/issues/100227
2023-03-29 17:15:43 -06:00
Brandt Bucher
121057aa36
GH-89987: Shrink the BINARY_SUBSCR caches (GH-103022) 2023-03-29 15:53:30 -07:00