Skip to content

Commit

Permalink
Merge branch 'main' into instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
iritkatriel authored Sep 7, 2023
2 parents a50201b + 403ab13 commit 88996da
Show file tree
Hide file tree
Showing 30 changed files with 620 additions and 520 deletions.
6 changes: 4 additions & 2 deletions Doc/library/configparser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,10 @@ ConfigParser Objects

When *default_section* is given, it specifies the name for the special
section holding default values for other sections and interpolation purposes
(normally named ``"DEFAULT"``). This value can be retrieved and changed on
runtime using the ``default_section`` instance attribute.
(normally named ``"DEFAULT"``). This value can be retrieved and changed at
runtime using the ``default_section`` instance attribute. This won't
re-evaluate an already parsed config file, but will be used when writing
parsed settings to a new config file.

Interpolation behaviour may be customized by providing a custom handler
through the *interpolation* argument. ``None`` can be used to turn off
Expand Down
13 changes: 12 additions & 1 deletion Doc/library/json.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,23 @@ Compact encoding::
Pretty printing::

>>> import json
>>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4))
>>> print(json.dumps({'6': 7, '4': 5}, sort_keys=True, indent=4))
{
"4": 5,
"6": 7
}

Specializing JSON object encoding::

>>> import json
>>> def custom_json(obj):
... if isinstance(obj, complex):
... return {'__complex__': True, 'real': obj.real, 'imag': obj.imag}
... raise TypeError(f'Cannot serialize object of {type(obj)}')
...
>>> json.dumps(1 + 2j, default=custom_json)
'{"__complex__": true, "real": 1.0, "imag": 2.0}'

Decoding JSON::

>>> import json
Expand Down
39 changes: 20 additions & 19 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1618,25 +1618,6 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
Parameters *out* and *in* was renamed to *out_fd* and *in_fd*.


.. function:: set_blocking(fd, blocking, /)

Set the blocking mode of the specified file descriptor. Set the
:data:`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise.

See also :func:`get_blocking` and :meth:`socket.socket.setblocking`.

.. availability:: Unix, Windows.

The function is limited on Emscripten and WASI, see
:ref:`wasm-availability` for more information.

On Windows, this function is limited to pipes.

.. versionadded:: 3.5

.. versionchanged:: 3.12
Added support for pipes on Windows.

.. data:: SF_NODISKIO
SF_MNOWAIT
SF_SYNC
Expand All @@ -1658,6 +1639,26 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
.. versionadded:: 3.11


.. function:: set_blocking(fd, blocking, /)

Set the blocking mode of the specified file descriptor. Set the
:data:`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise.

See also :func:`get_blocking` and :meth:`socket.socket.setblocking`.

.. availability:: Unix, Windows.

The function is limited on Emscripten and WASI, see
:ref:`wasm-availability` for more information.

On Windows, this function is limited to pipes.

.. versionadded:: 3.5

.. versionchanged:: 3.12
Added support for pipes on Windows.


.. function:: splice(src, dst, count, offset_src=None, offset_dst=None)

Transfer *count* bytes from file descriptor *src*, starting from offset
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/socket.rst
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ The :mod:`socket` module also offers various network-related services:
.. function:: gethostbyname_ex(hostname)

Translate a host name to IPv4 address format, extended interface. Return a
triple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's
3-tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's
primary host name, *aliaslist* is a (possibly
empty) list of alternative host names for the same address, and *ipaddrlist* is
a list of IPv4 addresses for the same interface on the same host (often but not
Expand Down Expand Up @@ -1007,7 +1007,7 @@ The :mod:`socket` module also offers various network-related services:

.. function:: gethostbyaddr(ip_address)

Return a triple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the
Return a 3-tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the
primary host name responding to the given *ip_address*, *aliaslist* is a
(possibly empty) list of alternative host names for the same address, and
*ipaddrlist* is a list of IPv4/v6 addresses for the same interface on the same
Expand Down
8 changes: 5 additions & 3 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ the operations, see :ref:`operator-summary`):
+---------------------+---------------------------------+---------+--------------------+
| ``x / y`` | quotient of *x* and *y* | | |
+---------------------+---------------------------------+---------+--------------------+
| ``x // y`` | floored quotient of *x* and | \(1) | |
| ``x // y`` | floored quotient of *x* and | \(1)\(2)| |
| | *y* | | |
+---------------------+---------------------------------+---------+--------------------+
| ``x % y`` | remainder of ``x / y`` | \(2) | |
Expand Down Expand Up @@ -319,8 +319,10 @@ the operations, see :ref:`operator-summary`):
Notes:

(1)
Also referred to as integer division. The resultant value is a whole
integer, though the result's type is not necessarily int. The result is
Also referred to as integer division. For operands of type :class:`int`,
the result has type :class:`int`. For operands of type :class:`float`,
the result has type :class:`float`. In general, the result is a whole
integer, though the result's type is not necessarily :class:`int`. The result is
always rounded towards minus infinity: ``1//2`` is ``0``, ``(-1)//2`` is
``-1``, ``1//(-2)`` is ``-1``, and ``(-1)//(-2)`` is ``0``.

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ always available.

This function prints out a given traceback and exception to ``sys.stderr``.

When an exception is raised and uncaught, the interpreter calls
When an exception other than :exc:`SystemExit` is raised and uncaught, the interpreter calls
``sys.excepthook`` with three arguments, the exception class, exception
instance, and a traceback object. In an interactive session this happens just
before control is returned to the prompt; in a Python program this happens just
Expand Down
10 changes: 8 additions & 2 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 88996da

Please sign in to comment.