Skip to content

Commit 19b3d9e

Browse files
committed
Merge branch 'main' into supermon
* main: (27 commits) pythongh-87849: fix SEND specialization family definition (pythonGH-104268) pythongh-101819: Adapt _io.IOBase.seek and _io.IOBase.truncate to Argument Clinic (python#104384) pythongh-101819: Adapt _io._Buffered* methods to Argument Clinic (python#104367) pythongh-101819: Refactor `_io` futher in preparation for module isolation (python#104369) pythongh-101819: Adapt _io.TextIOBase methods to Argument Clinic (python#104383) pythongh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (python#104287) pythonGH-92184: Convert os.altsep to '/' in filenames when creating ZipInfo objects (python#92185) pythongh-104357: fix inlined comprehensions that close over iteration var (python#104368) pythonGH-90208: Suppress OSError exceptions from `pathlib.Path.glob()` (pythonGH-104141) pythonGH-102181: Improve specialization stats for SEND (pythonGH-102182) pythongh-103000: Optimise `dataclasses.asdict` for the common case (python#104364) pythongh-103538: Remove unused TK_AQUA code (pythonGH-103539) pythonGH-87695: Fix OSError from `pathlib.Path.glob()` (pythonGH-104292) pythongh-104263: Rely on Py_NAN and introduce Py_INFINITY (pythonGH-104202) pythongh-104010: Separate and improve docs for `typing.get_origin` and `typing.get_args` (python#104013) pythongh-101819: Adapt _io._BufferedIOBase_Type methods to Argument Clinic (python#104355) pythongh-103960: Dark mode: invert image brightness (python#103983) pythongh-104252: Immortalize Py_EMPTY_KEYS (pythongh-104253) pythongh-101819: Clean up _io windows console io after pythongh-104197 (python#104354) pythongh-101819: Harden _io init (python#104352) ...
2 parents 8fb9b52 + 1670729 commit 19b3d9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1780
-918
lines changed

Doc/howto/logging.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ The flow of log event information in loggers and handlers is illustrated in the
418418
following diagram.
419419

420420
.. image:: logging_flow.png
421+
:class: invert-in-dark-mode
421422

422423
Loggers
423424
^^^^^^^

Doc/library/hashlib.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ Constructor functions also accept the following tree hashing parameters:
430430

431431
.. figure:: hashlib-blake2-tree.png
432432
:alt: Explanation of tree mode parameters.
433+
:class: invert-in-dark-mode
433434

434435
See section 2.10 in `BLAKE2 specification
435436
<https://www.blake2.net/blake2_20130129.pdf>`_ for comprehensive review of tree

Doc/library/http.client.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,10 @@ HTTPConnection Objects
264264
encode_chunked=False)
265265

266266
This will send a request to the server using the HTTP request
267-
method *method* and the selector *url*.
267+
method *method* and the request URI *url*. The provided *url* must be
268+
an absolute path to conform with :rfc:`RFC 2616 §5.1.2 <2616#section-5.1.2>`
269+
(unless connecting to an HTTP proxy server or using the ``OPTIONS`` or
270+
``CONNECT`` methods).
268271

269272
If *body* is specified, the specified data is sent after the headers are
270273
finished. It may be a :class:`str`, a :term:`bytes-like object`, an
@@ -279,7 +282,10 @@ HTTPConnection Objects
279282
iterable are sent as is until the iterable is exhausted.
280283

281284
The *headers* argument should be a mapping of extra HTTP headers to send
282-
with the request.
285+
with the request. A :rfc:`Host header <2616#section-14.23>`
286+
must be provided to conform with :rfc:`RFC 2616 §5.1.2 <2616#section-5.1.2>`
287+
(unless connecting to an HTTP proxy server or using the ``OPTIONS`` or
288+
``CONNECT`` methods).
283289

284290
If *headers* contains neither Content-Length nor Transfer-Encoding,
285291
but there is a request body, one of those
@@ -298,6 +304,16 @@ HTTPConnection Objects
298304
HTTPConnection object assumes that all encoding is handled by the
299305
calling code. If it is ``True``, the body will be chunk-encoded.
300306

307+
For example, to perform a ``GET`` request to ``https://docs.python.org/3/``::
308+
309+
>>> import http.client
310+
>>> host = "docs.python.org"
311+
>>> conn = http.client.HTTPSConnection(host)
312+
>>> conn.request("GET", "/3/", headers={"Host": host})
313+
>>> response = conn.getresponse()
314+
>>> print(response.status, response.reason)
315+
200 OK
316+
301317
.. note::
302318
Chunked transfer encoding has been added to the HTTP protocol
303319
version 1.1. Unless the HTTP server is known to handle HTTP 1.1,

Doc/library/pathlib.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ inherit from pure paths but also provide I/O operations.
2121

2222
.. image:: pathlib-inheritance.png
2323
:align: center
24+
:class: invert-in-dark-mode
2425

2526
If you've never used this module before or just aren't sure which class is
2627
right for your task, :class:`Path` is most likely what you need. It instantiates

Doc/library/sqlite3.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,10 @@ Cursor objects
16941694
``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements;
16951695
is ``-1`` for other statements,
16961696
including :abbr:`CTE (Common Table Expression)` queries.
1697-
It is only updated by the :meth:`execute` and :meth:`executemany` methods.
1697+
It is only updated by the :meth:`execute` and :meth:`executemany` methods,
1698+
after the statement has run to completion.
1699+
This means that any resulting rows must be fetched in order for
1700+
:attr:`!rowcount` to be updated.
16981701

16991702
.. attribute:: row_factory
17001703

Doc/library/typing.rst

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2876,24 +2876,37 @@ Introspection helpers
28762876
if a default value equal to ``None`` was set.
28772877
Now the annotation is returned unchanged.
28782878

2879-
.. function:: get_args(tp)
28802879
.. function:: get_origin(tp)
28812880

2882-
Provide basic introspection for generic types and special typing forms.
2883-
2884-
For a typing object of the form ``X[Y, Z, ...]`` these functions return
2885-
``X`` and ``(Y, Z, ...)``. If ``X`` is a generic alias for a builtin or
2881+
Get the unsubscripted version of a type: for a typing object of the form
2882+
``X[Y, Z, ...]`` return ``X``. If ``X`` is a generic alias for a builtin or
28862883
:mod:`collections` class, it gets normalized to the original class.
2884+
If ``X`` is an instance of :class:`ParamSpecArgs` or :class:`ParamSpecKwargs`,
2885+
return the underlying :class:`ParamSpec`.
2886+
Return ``None`` for unsupported objects.
2887+
Examples::
2888+
2889+
assert get_origin(str) is None
2890+
assert get_origin(Dict[str, int]) is dict
2891+
assert get_origin(Union[int, str]) is Union
2892+
P = ParamSpec('P')
2893+
assert get_origin(P.args) is P
2894+
assert get_origin(P.kwargs) is P
2895+
2896+
.. versionadded:: 3.8
2897+
2898+
.. function:: get_args(tp)
2899+
2900+
Get type arguments with all substitutions performed: for a typing object
2901+
of the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``.
28872902
If ``X`` is a union or :class:`Literal` contained in another
28882903
generic type, the order of ``(Y, Z, ...)`` may be different from the order
28892904
of the original arguments ``[Y, Z, ...]`` due to type caching.
2890-
For unsupported objects return ``None`` and ``()`` correspondingly.
2905+
Return ``()`` for unsupported objects.
28912906
Examples::
28922907

2893-
assert get_origin(Dict[str, int]) is dict
2908+
assert get_args(int) == ()
28942909
assert get_args(Dict[int, str]) == (int, str)
2895-
2896-
assert get_origin(Union[int, str]) is Union
28972910
assert get_args(Union[int, str]) == (int, str)
28982911

28992912
.. versionadded:: 3.8

Include/cpython/genobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ PyAPI_FUNC(PyObject *) PyAsyncGen_New(PyFrameObject *,
7777

7878
#define PyAsyncGen_CheckExact(op) Py_IS_TYPE((op), &PyAsyncGen_Type)
7979

80+
#define PyAsyncGenASend_CheckExact(op) Py_IS_TYPE((op), &_PyAsyncGenASend_Type)
81+
8082

8183
#undef _PyGenObject_HEAD
8284

Include/internal/pycore_dict_state.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ struct _Py_dict_state {
3838
PyDict_WatchCallback watchers[DICT_MAX_WATCHERS];
3939
};
4040

41+
#define _dict_state_INIT \
42+
{ \
43+
.next_keys_version = 2, \
44+
}
45+
4146

4247
#ifdef __cplusplus
4348
}

Include/internal/pycore_dtoa.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr);
6464
PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits,
6565
int *decpt, int *sign, char **rve);
6666
PyAPI_FUNC(void) _Py_dg_freedtoa(char *s);
67-
PyAPI_FUNC(double) _Py_dg_stdnan(int sign);
68-
PyAPI_FUNC(double) _Py_dg_infinity(int sign);
6967

7068
#endif // _PY_SHORT_FLOAT_REPR == 1
7169

Include/internal/pycore_runtime_init.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ extern PyTypeObject _PyExc_MemoryError;
107107
}, \
108108
}, \
109109
.dtoa = _dtoa_state_INIT(&(INTERP)), \
110-
.dict_state = { \
111-
.next_keys_version = 2, \
112-
}, \
110+
.dict_state = _dict_state_INIT, \
113111
.func_state = { \
114112
.next_version = 1, \
115113
}, \

0 commit comments

Comments
 (0)