Skip to content

Commit 5f6b3ff

Browse files
committed
Deploying to gh-pages from @ 6c367bc 🚀
1 parent 7f60c87 commit 5f6b3ff

File tree

564 files changed

+836
-730
lines changed

Some content is hidden

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

564 files changed

+836
-730
lines changed

_sources/c-api/memory.rst.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,10 @@ This allocator is disabled if Python is configured with the
656656
:option:`--without-pymalloc` option. It can also be disabled at runtime using
657657
the :envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``).
658658
659+
Typically, it makes sense to disable the pymalloc allocator when building
660+
Python with AddressSanitizer (:option:`--with-address-sanitizer`) which helps
661+
uncover low level bugs within the C code.
662+
659663
Customize pymalloc Arena Allocator
660664
----------------------------------
661665

_sources/howto/logging.rst.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ reading the following sections. If you're ready for that, grab some of your
302302
favourite beverage and carry on.
303303

304304
If your logging needs are simple, then use the above examples to incorporate
305-
logging into your own scripts, and if you run into problems or don't
306-
understand something, please post a question on the comp.lang.python Usenet
307-
group (available at https://groups.google.com/g/comp.lang.python) and you
308-
should receive help before too long.
305+
logging into your own scripts, and if you run into problems or don't understand
306+
something, please post a question in the Help category of the `Python
307+
discussion forum <https://discuss.python.org/c/help/7>`_ and you should receive
308+
help before too long.
309309

310310
Still here? You can carry on reading the next few sections, which provide a
311311
slightly more advanced/in-depth tutorial than the basic one above. After that,

_sources/library/argparse.rst.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,18 @@ arguments they contain. For example::
415415
>>> parser.parse_args(['-f', 'foo', '@args.txt'])
416416
Namespace(f='bar')
417417

418-
Arguments read from a file must by default be one per line (but see also
418+
Arguments read from a file must be one per line by default (but see also
419419
:meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they
420420
were in the same place as the original file referencing argument on the command
421421
line. So in the example above, the expression ``['-f', 'foo', '@args.txt']``
422422
is considered equivalent to the expression ``['-f', 'foo', '-f', 'bar']``.
423423

424+
.. note::
425+
426+
Empty lines are treated as empty strings (``''``), which are allowed as values but
427+
not as arguments. Empty lines that are read as arguments will result in an
428+
"unrecognized arguments" error.
429+
424430
:class:`ArgumentParser` uses :term:`filesystem encoding and error handler`
425431
to read the file containing arguments.
426432

_sources/library/ctypes.rst.txt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,24 @@ Fundamental data types
232232
+----------------------+------------------------------------------+----------------------------+
233233
| :class:`c_int` | :c:expr:`int` | int |
234234
+----------------------+------------------------------------------+----------------------------+
235+
| :class:`c_int8` | :c:type:`int8_t` | int |
236+
+----------------------+------------------------------------------+----------------------------+
237+
| :class:`c_int16` | :c:type:`int16_t` | int |
238+
+----------------------+------------------------------------------+----------------------------+
239+
| :class:`c_int32` | :c:type:`int32_t` | int |
240+
+----------------------+------------------------------------------+----------------------------+
241+
| :class:`c_int64` | :c:type:`int64_t` | int |
242+
+----------------------+------------------------------------------+----------------------------+
235243
| :class:`c_uint` | :c:expr:`unsigned int` | int |
236244
+----------------------+------------------------------------------+----------------------------+
245+
| :class:`c_uint8` | :c:type:`uint8_t` | int |
246+
+----------------------+------------------------------------------+----------------------------+
247+
| :class:`c_uint16` | :c:type:`uint16_t` | int |
248+
+----------------------+------------------------------------------+----------------------------+
249+
| :class:`c_uint32` | :c:type:`uint32_t` | int |
250+
+----------------------+------------------------------------------+----------------------------+
251+
| :class:`c_uint64` | :c:type:`uint64_t` | int |
252+
+----------------------+------------------------------------------+----------------------------+
237253
| :class:`c_long` | :c:expr:`long` | int |
238254
+----------------------+------------------------------------------+----------------------------+
239255
| :class:`c_ulong` | :c:expr:`unsigned long` | int |
@@ -2348,7 +2364,7 @@ These are the fundamental ctypes data types:
23482364

23492365
.. class:: c_int8
23502366

2351-
Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for
2367+
Represents the C 8-bit :c:expr:`signed int` datatype. It is an alias for
23522368
:class:`c_byte`.
23532369

23542370

@@ -2423,7 +2439,7 @@ These are the fundamental ctypes data types:
24232439

24242440
.. class:: c_uint8
24252441

2426-
Represents the C 8-bit :c:expr:`unsigned int` datatype. Usually an alias for
2442+
Represents the C 8-bit :c:expr:`unsigned int` datatype. It is an alias for
24272443
:class:`c_ubyte`.
24282444

24292445

_sources/library/ipaddress.rst.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,16 @@ write code that handles both IP versions correctly. Address objects are
232232

233233
.. attribute:: is_reserved
234234

235-
``True`` if the address is otherwise IETF reserved.
235+
``True`` if the address is noted as reserved by the IETF.
236+
For IPv4, this is only ``240.0.0.0/4``, the ``Reserved`` address block.
237+
For IPv6, this is all addresses `allocated <iana-ipv6-address-space_>`__ as
238+
``Reserved by IETF`` for future use.
239+
240+
.. note:: For IPv4, ``is_reserved`` is not related to the address block value of the
241+
``Reserved-by-Protocol`` column in iana-ipv4-special-registry_.
242+
243+
.. caution:: For IPv6, ``fec0::/10`` a former Site-Local scoped address prefix is
244+
currently excluded from that list (see :attr:`~IPv6Address.is_site_local` & :rfc:`3879`).
236245

237246
.. attribute:: is_loopback
238247

@@ -253,6 +262,7 @@ write code that handles both IP versions correctly. Address objects are
253262

254263
.. _iana-ipv4-special-registry: https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
255264
.. _iana-ipv6-special-registry: https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
265+
.. _iana-ipv6-address-space: https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml
256266

257267
.. method:: IPv4Address.__format__(fmt)
258268

_sources/library/itertools.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Iterator Arguments Results
4747
Iterator Arguments Results Example
4848
============================ ============================ ================================================= =============================================================
4949
:func:`accumulate` p [,func] p0, p0+p1, p0+p1+p2, ... ``accumulate([1,2,3,4,5]) → 1 3 6 10 15``
50-
:func:`batched` p, n (p0, p1, ..., p_n-1), ... ``batched('ABCDEFG', n=3) → ABC DEF G``
50+
:func:`batched` p, n (p0, p1, ..., p_n-1), ... ``batched('ABCDEFG', n=2) → AB CD EF G``
5151
:func:`chain` p, q, ... p0, p1, ... plast, q0, q1, ... ``chain('ABC', 'DEF') → A B C D E F``
5252
:func:`chain.from_iterable` iterable p0, p1, ... plast, q0, q1, ... ``chain.from_iterable(['ABC', 'DEF']) → A B C D E F``
5353
:func:`compress` data, selectors (d[0] if s[0]), (d[1] if s[1]), ... ``compress('ABCDEF', [1,0,1,0,1,1]) → A C E F``
@@ -181,7 +181,7 @@ loops that truncate the stream.
181181
Roughly equivalent to::
182182

183183
def batched(iterable, n, *, strict=False):
184-
# batched('ABCDEFG', 3) → ABC DEF G
184+
# batched('ABCDEFG', 2) → AB CD EF G
185185
if n < 1:
186186
raise ValueError('n must be at least one')
187187
iterator = iter(iterable)

_sources/library/multiprocessing.rst.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,13 @@ For an example of the usage of queues for interprocess communication see
897897

898898
.. method:: close()
899899

900-
Indicate that no more data will be put on this queue by the current
901-
process. The background thread will quit once it has flushed all buffered
900+
Close the queue: release internal resources.
901+
902+
A queue must not be used anymore after it is closed. For example,
903+
:meth:`~Queue.get`, :meth:`~Queue.put` and :meth:`~Queue.empty`
904+
methods must no longer be called.
905+
906+
The background thread will quit once it has flushed all buffered
902907
data to the pipe. This is called automatically when the queue is garbage
903908
collected.
904909

_sources/library/os.path.rst.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ the :mod:`glob` module.)
6464
Accepts a :term:`path-like object`.
6565

6666

67-
.. function:: basename(path)
67+
.. function:: basename(path, /)
6868

6969
Return the base name of pathname *path*. This is the second element of the
7070
pair returned by passing *path* to the function :func:`split`. Note that
@@ -118,7 +118,7 @@ the :mod:`glob` module.)
118118
Accepts a :term:`path-like object`.
119119

120120

121-
.. function:: dirname(path)
121+
.. function:: dirname(path, /)
122122

123123
Return the directory name of pathname *path*. This is the first element of
124124
the pair returned by passing *path* to the function :func:`split`.
@@ -237,7 +237,7 @@ the :mod:`glob` module.)
237237
Accepts a :term:`path-like object`.
238238

239239

240-
.. function:: isabs(path)
240+
.. function:: isabs(path, /)
241241

242242
Return ``True`` if *path* is an absolute pathname. On Unix, that means it
243243
begins with a slash, on Windows that it begins with two (back)slashes, or a
@@ -261,7 +261,7 @@ the :mod:`glob` module.)
261261
Accepts a :term:`path-like object`.
262262

263263

264-
.. function:: isdir(path)
264+
.. function:: isdir(path, /)
265265

266266
Return ``True`` if *path* is an :func:`existing <exists>` directory. This
267267
follows symbolic links, so both :func:`islink` and :func:`isdir` can be true
@@ -372,7 +372,7 @@ the :mod:`glob` module.)
372372
Accepts a :term:`path-like object` for *path* and *paths*.
373373

374374

375-
.. function:: normcase(path)
375+
.. function:: normcase(path, /)
376376

377377
Normalize the case of a pathname. On Windows, convert all characters in the
378378
pathname to lowercase, and also convert forward slashes to backward slashes.
@@ -509,7 +509,7 @@ the :mod:`glob` module.)
509509
Added Windows support.
510510

511511

512-
.. function:: split(path)
512+
.. function:: split(path, /)
513513

514514
Split the pathname *path* into a pair, ``(head, tail)`` where *tail* is the
515515
last pathname component and *head* is everything leading up to that. The
@@ -525,7 +525,7 @@ the :mod:`glob` module.)
525525
Accepts a :term:`path-like object`.
526526

527527

528-
.. function:: splitdrive(path)
528+
.. function:: splitdrive(path, /)
529529

530530
Split the pathname *path* into a pair ``(drive, tail)`` where *drive* is either
531531
a mount point or the empty string. On systems which do not use drive
@@ -550,7 +550,7 @@ the :mod:`glob` module.)
550550
Accepts a :term:`path-like object`.
551551

552552

553-
.. function:: splitroot(path)
553+
.. function:: splitroot(path, /)
554554

555555
Split the pathname *path* into a 3-item tuple ``(drive, root, tail)`` where
556556
*drive* is a device name or mount point, *root* is a string of separators
@@ -583,7 +583,7 @@ the :mod:`glob` module.)
583583
.. versionadded:: 3.12
584584

585585

586-
.. function:: splitext(path)
586+
.. function:: splitext(path, /)
587587

588588
Split the pathname *path* into a pair ``(root, ext)`` such that ``root + ext ==
589589
path``, and the extension, *ext*, is empty or begins with a period and contains at

_sources/library/tarfile.rst.txt

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,9 @@ Command-line options
13041304
Examples
13051305
--------
13061306

1307+
Reading examples
1308+
~~~~~~~~~~~~~~~~~~~
1309+
13071310
How to extract an entire tar archive to the current working directory::
13081311

13091312
import tarfile
@@ -1326,6 +1329,23 @@ a generator function instead of a list::
13261329
tar.extractall(members=py_files(tar))
13271330
tar.close()
13281331

1332+
How to read a gzip compressed tar archive and display some member information::
1333+
1334+
import tarfile
1335+
tar = tarfile.open("sample.tar.gz", "r:gz")
1336+
for tarinfo in tar:
1337+
print(tarinfo.name, "is", tarinfo.size, "bytes in size and is ", end="")
1338+
if tarinfo.isreg():
1339+
print("a regular file.")
1340+
elif tarinfo.isdir():
1341+
print("a directory.")
1342+
else:
1343+
print("something else.")
1344+
tar.close()
1345+
1346+
Writing examples
1347+
~~~~~~~~~~~~~~~~
1348+
13291349
How to create an uncompressed tar archive from a list of filenames::
13301350

13311351
import tarfile
@@ -1341,19 +1361,15 @@ The same example using the :keyword:`with` statement::
13411361
for name in ["foo", "bar", "quux"]:
13421362
tar.add(name)
13431363

1344-
How to read a gzip compressed tar archive and display some member information::
1364+
How to create and write an archive to stdout using
1365+
:data:`sys.stdout.buffer <sys.stdout>` in the *fileobj* parameter
1366+
in :meth:`TarFile.add`::
13451367

1346-
import tarfile
1347-
tar = tarfile.open("sample.tar.gz", "r:gz")
1348-
for tarinfo in tar:
1349-
print(tarinfo.name, "is", tarinfo.size, "bytes in size and is ", end="")
1350-
if tarinfo.isreg():
1351-
print("a regular file.")
1352-
elif tarinfo.isdir():
1353-
print("a directory.")
1354-
else:
1355-
print("something else.")
1356-
tar.close()
1368+
import sys
1369+
import tarfile
1370+
with tarfile.open("sample.tar.gz", "w|gz", fileobj=sys.stdout.buffer) as tar:
1371+
for name in ["foo", "bar", "quux"]:
1372+
tar.add(name)
13571373

13581374
How to create an archive and reset the user information using the *filter*
13591375
parameter in :meth:`TarFile.add`::

_sources/tutorial/modules.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,8 @@ module for example, you might use::
579579
from .. import formats
580580
from ..filters import equalizer
581581

582-
Note that relative imports are based on the name of the current module. Since
583-
the name of the main module is always ``"__main__"``, modules intended for use
582+
Note that relative imports are based on the name of the current module's package.
583+
Since the main module does not have a package, modules intended for use
584584
as the main module of a Python application must always use absolute imports.
585585

586586

0 commit comments

Comments
 (0)