Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 59ad2c8

Browse files
committed
Deploying to gh-pages from @ 2df827a 🚀
1 parent 6b0975b commit 59ad2c8

File tree

578 files changed

+17342
-16087
lines changed

Some content is hidden

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

578 files changed

+17342
-16087
lines changed

_sources/c-api/arg.rst.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,8 @@ Building values
639639
``L`` (:class:`int`) [long long]
640640
Convert a C :c:expr:`long long` to a Python integer object.
641641
642+
.. _capi-py-buildvalue-format-K:
643+
642644
``K`` (:class:`int`) [unsigned long long]
643645
Convert a C :c:expr:`unsigned long long` to a Python integer object.
644646

_sources/c-api/buffer.rst.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@ characteristic of being backed by a possibly large memory buffer. It is
2626
then desirable, in some situations, to access that buffer directly and
2727
without intermediate copying.
2828

29-
Python provides such a facility at the C level in the form of the :ref:`buffer
30-
protocol <bufferobjects>`. This protocol has two sides:
29+
Python provides such a facility at the C and Python level in the form of the
30+
:ref:`buffer protocol <bufferobjects>`. This protocol has two sides:
3131

3232
.. index:: single: PyBufferProcs (C type)
3333

3434
- on the producer side, a type can export a "buffer interface" which allows
3535
objects of that type to expose information about their underlying buffer.
36-
This interface is described in the section :ref:`buffer-structs`;
36+
This interface is described in the section :ref:`buffer-structs`; for
37+
Python see :ref:`python-buffer-protocol`.
3738

3839
- on the consumer side, several means are available to obtain a pointer to
39-
the raw underlying data of an object (for example a method parameter).
40+
the raw underlying data of an object (for example a method parameter). For
41+
Python see :class:`memoryview`.
4042

4143
Simple objects such as :class:`bytes` and :class:`bytearray` expose their
4244
underlying buffer in byte-oriented form. Other forms are possible; for example,
@@ -62,6 +64,10 @@ In both cases, :c:func:`PyBuffer_Release` must be called when the buffer
6264
isn't needed anymore. Failure to do so could lead to various issues such as
6365
resource leaks.
6466

67+
.. versionadded:: 3.12
68+
69+
The buffer protocol is now accessible in Python, see
70+
:ref:`python-buffer-protocol` and :class:`memoryview`.
6571

6672
.. _buffer-structure:
6773

_sources/c-api/intro.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ complete listing.
138138
.. c:macro:: Py_ALWAYS_INLINE
139139
140140
Ask the compiler to always inline a static inline function. The compiler can
141-
ignore it and decides to not inline the function.
141+
ignore it and decide to not inline the function.
142142

143143
It can be used to inline performance critical static inline functions when
144144
building Python in debug mode with function inlining disabled. For example,

_sources/c-api/unicode.rst.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,14 @@ Python:
6868

6969
.. c:var:: PyTypeObject PyUnicode_Type
7070
71-
This instance of :c:type:`PyTypeObject` represents the Python Unicode type. It
72-
is exposed to Python code as ``str``.
71+
This instance of :c:type:`PyTypeObject` represents the Python Unicode type.
72+
It is exposed to Python code as ``str``.
73+
74+
75+
.. c:var:: PyTypeObject PyUnicodeIter_Type
76+
77+
This instance of :c:type:`PyTypeObject` represents the Python Unicode
78+
iterator type. It is used to iterate over Unicode string objects.
7379

7480

7581
The following APIs are C macros and static inlined functions for fast checks and

_sources/deprecations/pending-removal-in-future.rst.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ although there is currently no date scheduled for their removal.
77
* :mod:`argparse`: Nesting argument groups and nesting mutually exclusive
88
groups are deprecated.
99

10-
* :mod:`array`'s ``'u'`` format code (:gh:`57281`)
11-
1210
* :mod:`builtins`:
1311

1412
* ``bool(NotImplemented)``.

_sources/library/ast.rst.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,43 @@ Pattern matching
17561756

17571757
.. versionadded:: 3.10
17581758

1759+
1760+
Type annotations
1761+
^^^^^^^^^^^^^^^^
1762+
1763+
.. class:: TypeIgnore(lineno, tag)
1764+
1765+
A ``# type: ignore`` comment located at *lineno*.
1766+
*tag* is the optional tag specified by the form ``# type: ignore <tag>``.
1767+
1768+
.. doctest::
1769+
1770+
>>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), indent=4))
1771+
Module(
1772+
body=[
1773+
Assign(
1774+
targets=[
1775+
Name(id='x', ctx=Store())],
1776+
value=Constant(value=1))],
1777+
type_ignores=[
1778+
TypeIgnore(lineno=1, tag='')])
1779+
>>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', type_comments=True), indent=4))
1780+
Module(
1781+
body=[
1782+
AnnAssign(
1783+
target=Name(id='x', ctx=Store()),
1784+
annotation=Name(id='bool', ctx=Load()),
1785+
value=Constant(value=1),
1786+
simple=1)],
1787+
type_ignores=[
1788+
TypeIgnore(lineno=1, tag='[assignment]')])
1789+
1790+
.. note::
1791+
:class:`!TypeIgnore` nodes are not generated when the *type_comments* parameter
1792+
is set to ``False`` (default). See :func:`ast.parse` for more details.
1793+
1794+
.. versionadded:: 3.8
1795+
17591796
.. _ast-type-params:
17601797

17611798
Type parameters

_sources/library/cmdline.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The following modules have a command-line interface.
2828
* :mod:`pdb`
2929
* :mod:`pickle`
3030
* :ref:`pickletools <pickletools-cli>`
31-
* :mod:`platform`
31+
* :ref:`platform <platform-cli>`
3232
* :mod:`poplib`
3333
* :ref:`profile <profile-cli>`
3434
* :mod:`pstats`

_sources/library/decimal.rst.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ Decimal objects
367367
appears above. These include decimal digits from various other
368368
alphabets (for example, Arabic-Indic and Devanāgarī digits) along
369369
with the fullwidth digits ``'\uff10'`` through ``'\uff19'``.
370+
Case is not significant, so, for example, ``inf``, ``Inf``, ``INFINITY``,
371+
and ``iNfINity`` are all acceptable spellings for positive infinity.
370372

371373
If *value* is a :class:`tuple`, it should have three components, a sign
372374
(``0`` for positive or ``1`` for negative), a :class:`tuple` of

_sources/library/dis.rst.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@ iterations of the loop.
16371637
* ``oparg == 2``: call :func:`repr` on *value*
16381638
* ``oparg == 3``: call :func:`ascii` on *value*
16391639

1640-
Used for implementing formatted literal strings (f-strings).
1640+
Used for implementing formatted string literals (f-strings).
16411641

16421642
.. versionadded:: 3.13
16431643

@@ -1650,7 +1650,7 @@ iterations of the loop.
16501650
result = value.__format__("")
16511651
STACK.append(result)
16521652

1653-
Used for implementing formatted literal strings (f-strings).
1653+
Used for implementing formatted string literals (f-strings).
16541654

16551655
.. versionadded:: 3.13
16561656

@@ -1663,7 +1663,7 @@ iterations of the loop.
16631663
result = value.__format__(spec)
16641664
STACK.append(result)
16651665

1666-
Used for implementing formatted literal strings (f-strings).
1666+
Used for implementing formatted string literals (f-strings).
16671667

16681668
.. versionadded:: 3.13
16691669

_sources/library/fcntl.rst.txt

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -82,65 +82,82 @@ descriptor.
8282
The module defines the following functions:
8383

8484

85-
.. function:: fcntl(fd, cmd, arg=0)
85+
.. function:: fcntl(fd, cmd, arg=0, /)
8686

8787
Perform the operation *cmd* on file descriptor *fd* (file objects providing
8888
a :meth:`~io.IOBase.fileno` method are accepted as well). The values used
8989
for *cmd* are operating system dependent, and are available as constants
9090
in the :mod:`fcntl` module, using the same names as used in the relevant C
91-
header files. The argument *arg* can either be an integer value, or a
92-
:class:`bytes` object. With an integer value, the return value of this
93-
function is the integer return value of the C :c:func:`fcntl` call. When
94-
the argument is bytes it represents a binary structure, e.g. created by
95-
:func:`struct.pack`. The binary data is copied to a buffer whose address is
91+
header files. The argument *arg* can either be an integer value, a
92+
:class:`bytes` object, or a string.
93+
The type and size of *arg* must match the type and size of
94+
the argument of the operation as specified in the relevant C documentation.
95+
96+
When *arg* is an integer, the function returns the integer
97+
return value of the C :c:func:`fcntl` call.
98+
99+
When the argument is bytes, it represents a binary structure,
100+
for example, created by :func:`struct.pack`.
101+
A string value is encoded to binary using the UTF-8 encoding.
102+
The binary data is copied to a buffer whose address is
96103
passed to the C :c:func:`fcntl` call. The return value after a successful
97104
call is the contents of the buffer, converted to a :class:`bytes` object.
98105
The length of the returned object will be the same as the length of the
99-
*arg* argument. This is limited to 1024 bytes. If the information returned
100-
in the buffer by the operating system is larger than 1024 bytes, this is
101-
most likely to result in a segmentation violation or a more subtle data
102-
corruption.
106+
*arg* argument. This is limited to 1024 bytes.
103107

104108
If the :c:func:`fcntl` call fails, an :exc:`OSError` is raised.
105109

110+
.. note::
111+
If the type or the size of *arg* does not match the type or size
112+
of the argument of the operation (for example, if an integer is
113+
passed when a pointer is expected, or the information returned in
114+
the buffer by the operating system is larger than 1024 bytes),
115+
this is most likely to result in a segmentation violation or
116+
a more subtle data corruption.
117+
106118
.. audit-event:: fcntl.fcntl fd,cmd,arg fcntl.fcntl
107119

108120

109-
.. function:: ioctl(fd, request, arg=0, mutate_flag=True)
121+
.. function:: ioctl(fd, request, arg=0, mutate_flag=True, /)
110122

111123
This function is identical to the :func:`~fcntl.fcntl` function, except
112124
that the argument handling is even more complicated.
113125

114-
The *request* parameter is limited to values that can fit in 32-bits.
126+
The *request* parameter is limited to values that can fit in 32-bits
127+
or 64-bits, depending on the platform.
115128
Additional constants of interest for use as the *request* argument can be
116129
found in the :mod:`termios` module, under the same names as used in
117130
the relevant C header files.
118131

119-
The parameter *arg* can be one of an integer, an object supporting the
120-
read-only buffer interface (like :class:`bytes`) or an object supporting
121-
the read-write buffer interface (like :class:`bytearray`).
132+
The parameter *arg* can be an integer, a :term:`bytes-like object`,
133+
or a string.
134+
The type and size of *arg* must match the type and size of
135+
the argument of the operation as specified in the relevant C documentation.
122136

123-
In all but the last case, behaviour is as for the :func:`~fcntl.fcntl`
137+
If *arg* does not support the read-write buffer interface or
138+
the *mutate_flag* is false, behavior is as for the :func:`~fcntl.fcntl`
124139
function.
125140

126-
If a mutable buffer is passed, then the behaviour is determined by the value of
127-
the *mutate_flag* parameter.
128-
129-
If it is false, the buffer's mutability is ignored and behaviour is as for a
130-
read-only buffer, except that the 1024 byte limit mentioned above is avoided --
131-
so long as the buffer you pass is at least as long as what the operating system
132-
wants to put there, things should work.
133-
134-
If *mutate_flag* is true (the default), then the buffer is (in effect) passed
135-
to the underlying :func:`ioctl` system call, the latter's return code is
141+
If *arg* supports the read-write buffer interface (like :class:`bytearray`)
142+
and *mutate_flag* is true (the default), then the buffer is (in effect) passed
143+
to the underlying :c:func:`!ioctl` system call, the latter's return code is
136144
passed back to the calling Python, and the buffer's new contents reflect the
137-
action of the :func:`ioctl`. This is a slight simplification, because if the
145+
action of the :c:func:`ioctl`. This is a slight simplification, because if the
138146
supplied buffer is less than 1024 bytes long it is first copied into a static
139147
buffer 1024 bytes long which is then passed to :func:`ioctl` and copied back
140148
into the supplied buffer.
141149

142150
If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised.
143151

152+
.. note::
153+
If the type or size of *arg* does not match the type or size
154+
of the operation's argument (for example, if an integer is
155+
passed when a pointer is expected, or the information returned in
156+
the buffer by the operating system is larger than 1024 bytes,
157+
or the size of the mutable bytes-like object is too small),
158+
this is most likely to result in a segmentation violation or
159+
a more subtle data corruption.
160+
144161
An example::
145162

146163
>>> import array, fcntl, struct, termios, os
@@ -157,7 +174,7 @@ The module defines the following functions:
157174
.. audit-event:: fcntl.ioctl fd,request,arg fcntl.ioctl
158175

159176

160-
.. function:: flock(fd, operation)
177+
.. function:: flock(fd, operation, /)
161178

162179
Perform the lock operation *operation* on file descriptor *fd* (file objects providing
163180
a :meth:`~io.IOBase.fileno` method are accepted as well). See the Unix manual
@@ -169,7 +186,7 @@ The module defines the following functions:
169186
.. audit-event:: fcntl.flock fd,operation fcntl.flock
170187

171188

172-
.. function:: lockf(fd, cmd, len=0, start=0, whence=0)
189+
.. function:: lockf(fd, cmd, len=0, start=0, whence=0, /)
173190

174191
This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls.
175192
*fd* is the file descriptor (file objects providing a :meth:`~io.IOBase.fileno`

_sources/library/gzip.rst.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ Example of how to GZIP compress a binary string::
253253
The basic data compression module needed to support the :program:`gzip` file
254254
format.
255255

256+
In case gzip (de)compression is a bottleneck, the `python-isal`_
257+
package speeds up (de)compression with a mostly compatible API.
258+
259+
.. _python-isal: https://github.com/pycompression/python-isal
256260

257261
.. program:: gzip
258262

_sources/library/hashlib.rst.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ a file or file-like object.
270270
*fileobj* must be a file-like object opened for reading in binary mode.
271271
It accepts file objects from builtin :func:`open`, :class:`~io.BytesIO`
272272
instances, SocketIO objects from :meth:`socket.socket.makefile`, and
273-
similar. The function may bypass Python's I/O and use the file descriptor
273+
similar. *fileobj* must be opened in blocking mode, otherwise a
274+
:exc:`BlockingIOError` may be raised.
275+
276+
The function may bypass Python's I/O and use the file descriptor
274277
from :meth:`~io.IOBase.fileno` directly. *fileobj* must be assumed to be
275278
in an unknown state after this function returns or raises. It is up to
276279
the caller to close *fileobj*.
@@ -299,6 +302,10 @@ a file or file-like object.
299302

300303
.. versionadded:: 3.11
301304

305+
.. versionchanged:: next
306+
Now raises a :exc:`BlockingIOError` if the file is opened in blocking
307+
mode. Previously, spurious null bytes were added to the digest.
308+
302309

303310
Key derivation
304311
--------------

_sources/library/io.rst.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,8 @@ Text I/O
950950
:class:`TextIOBase`.
951951

952952
*encoding* gives the name of the encoding that the stream will be decoded or
953-
encoded with. It defaults to :func:`locale.getencoding`.
953+
encoded with. In :ref:`UTF-8 Mode <utf8-mode>`, this defaults to UTF-8.
954+
Otherwise, it defaults to :func:`locale.getencoding`.
954955
``encoding="locale"`` can be used to specify the current locale's encoding
955956
explicitly. See :ref:`io-text-encoding` for more information.
956957

0 commit comments

Comments
 (0)