Skip to content

Commit 36bca28

Browse files
Deploy preview for PR 1174 🛫
1 parent ba98251 commit 36bca28

File tree

583 files changed

+781
-734
lines changed

Some content is hidden

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

583 files changed

+781
-734
lines changed

pr-preview/pr-1174/_sources/howto/functional.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Functional Programming HOWTO
55
********************************
66

7-
:Author: A. M. Kuchling
7+
:Author: \A. M. Kuchling
88
:Release: 0.32
99

1010
In this document, we'll take a tour of Python's features suitable for

pr-preview/pr-1174/_sources/howto/urllib2.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Introduction
1515
You may also find useful the following article on fetching web resources
1616
with Python:
1717

18-
* `Basic Authentication <https://web.archive.org/web/20201215133350/http://www.voidspace.org.uk/python/articles/authentication.shtml>`_
18+
* `Basic Authentication <https://web.archive.org/web/20201215133350/http://www.voidspace.org.uk/python/articles/authentication.shtml>`__
1919

2020
A tutorial on *Basic Authentication*, with examples in Python.
2121

pr-preview/pr-1174/_sources/library/argparse.rst.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,9 @@ how the command-line arguments should be handled. The supplied actions are:
768768
Namespace(foo=42)
769769

770770
* ``'store_true'`` and ``'store_false'`` - These are special cases of
771-
``'store_const'`` used for storing the values ``True`` and ``False``
772-
respectively. In addition, they create default values of ``False`` and
773-
``True`` respectively::
771+
``'store_const'`` that respectively store the values ``True`` and ``False``
772+
with default values of ``False`` and
773+
``True``::
774774

775775
>>> parser = argparse.ArgumentParser()
776776
>>> parser.add_argument('--foo', action='store_true')
@@ -790,8 +790,8 @@ how the command-line arguments should be handled. The supplied actions are:
790790
>>> parser.parse_args('--foo 1 --foo 2'.split())
791791
Namespace(foo=['0', '1', '2'])
792792

793-
* ``'append_const'`` - This stores a list, and appends the value specified by
794-
the const_ keyword argument to the list; note that the const_ keyword
793+
* ``'append_const'`` - This appends the value specified by
794+
the const_ keyword argument to a list; note that the const_ keyword
795795
argument defaults to ``None``. The ``'append_const'`` action is typically
796796
useful when multiple arguments need to store constants to the same list. For
797797
example::
@@ -802,8 +802,8 @@ how the command-line arguments should be handled. The supplied actions are:
802802
>>> parser.parse_args('--str --int'.split())
803803
Namespace(types=[<class 'str'>, <class 'int'>])
804804

805-
* ``'extend'`` - This stores a list and appends each item from the multi-value
806-
argument list to it.
805+
* ``'extend'`` - This appends each item from a multi-value
806+
argument to a list.
807807
The ``'extend'`` action is typically used with the nargs_ keyword argument
808808
value ``'+'`` or ``'*'``.
809809
Note that when nargs_ is ``None`` (the default) or ``'?'``, each
@@ -817,7 +817,7 @@ how the command-line arguments should be handled. The supplied actions are:
817817

818818
.. versionadded:: 3.8
819819

820-
* ``'count'`` - This counts the number of times a keyword argument occurs. For
820+
* ``'count'`` - This counts the number of times an argument occurs. For
821821
example, this is useful for increasing verbosity levels::
822822

823823
>>> parser = argparse.ArgumentParser()

pr-preview/pr-1174/_sources/library/decimal.rst.txt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,20 +2100,20 @@ to work with the :class:`Decimal` class::
21002100
Decimal FAQ
21012101
-----------
21022102

2103-
Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way to
2103+
Q: It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way to
21042104
minimize typing when using the interactive interpreter?
21052105

2106-
A. Some users abbreviate the constructor to just a single letter:
2106+
A: Some users abbreviate the constructor to just a single letter:
21072107

21082108
>>> D = decimal.Decimal
21092109
>>> D('1.23') + D('3.45')
21102110
Decimal('4.68')
21112111

2112-
Q. In a fixed-point application with two decimal places, some inputs have many
2112+
Q: In a fixed-point application with two decimal places, some inputs have many
21132113
places and need to be rounded. Others are not supposed to have excess digits
21142114
and need to be validated. What methods should be used?
21152115

2116-
A. The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal places. If
2116+
A: The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal places. If
21172117
the :const:`Inexact` trap is set, it is also useful for validation:
21182118

21192119
>>> TWOPLACES = Decimal(10) ** -2 # same as Decimal('0.01')
@@ -2131,10 +2131,10 @@ the :const:`Inexact` trap is set, it is also useful for validation:
21312131
...
21322132
Inexact: None
21332133

2134-
Q. Once I have valid two place inputs, how do I maintain that invariant
2134+
Q: Once I have valid two place inputs, how do I maintain that invariant
21352135
throughout an application?
21362136

2137-
A. Some operations like addition, subtraction, and multiplication by an integer
2137+
A: Some operations like addition, subtraction, and multiplication by an integer
21382138
will automatically preserve fixed point. Others operations, like division and
21392139
non-integer multiplication, will change the number of decimal places and need to
21402140
be followed-up with a :meth:`~Decimal.quantize` step:
@@ -2166,21 +2166,21 @@ to handle the :meth:`~Decimal.quantize` step:
21662166
>>> div(b, a)
21672167
Decimal('0.03')
21682168

2169-
Q. There are many ways to express the same value. The numbers ``200``,
2169+
Q: There are many ways to express the same value. The numbers ``200``,
21702170
``200.000``, ``2E2``, and ``.02E+4`` all have the same value at
21712171
various precisions. Is there a way to transform them to a single recognizable
21722172
canonical value?
21732173

2174-
A. The :meth:`~Decimal.normalize` method maps all equivalent values to a single
2174+
A: The :meth:`~Decimal.normalize` method maps all equivalent values to a single
21752175
representative:
21762176

21772177
>>> values = map(Decimal, '200 200.000 2E2 .02E+4'.split())
21782178
>>> [v.normalize() for v in values]
21792179
[Decimal('2E+2'), Decimal('2E+2'), Decimal('2E+2'), Decimal('2E+2')]
21802180

2181-
Q. When does rounding occur in a computation?
2181+
Q: When does rounding occur in a computation?
21822182

2183-
A. It occurs *after* the computation. The philosophy of the decimal
2183+
A: It occurs *after* the computation. The philosophy of the decimal
21842184
specification is that numbers are considered exact and are created
21852185
independent of the current context. They can even have greater
21862186
precision than current context. Computations process with those
@@ -2198,10 +2198,10 @@ applied to the *result* of the computation::
21982198
>>> pi + 0 - Decimal('0.00005'). # Intermediate values are rounded
21992199
Decimal('3.1416')
22002200

2201-
Q. Some decimal values always print with exponential notation. Is there a way
2201+
Q: Some decimal values always print with exponential notation. Is there a way
22022202
to get a non-exponential representation?
22032203

2204-
A. For some values, exponential notation is the only way to express the number
2204+
A: For some values, exponential notation is the only way to express the number
22052205
of significant places in the coefficient. For example, expressing
22062206
``5.0E+3`` as ``5000`` keeps the value constant but cannot show the
22072207
original's two-place significance.
@@ -2216,9 +2216,9 @@ value unchanged:
22162216
>>> remove_exponent(Decimal('5E+3'))
22172217
Decimal('5000')
22182218

2219-
Q. Is there a way to convert a regular float to a :class:`Decimal`?
2219+
Q: Is there a way to convert a regular float to a :class:`Decimal`?
22202220

2221-
A. Yes, any binary floating-point number can be exactly expressed as a
2221+
A: Yes, any binary floating-point number can be exactly expressed as a
22222222
Decimal though an exact conversion may take more precision than intuition would
22232223
suggest:
22242224

@@ -2227,19 +2227,19 @@ suggest:
22272227
>>> Decimal(math.pi)
22282228
Decimal('3.141592653589793115997963468544185161590576171875')
22292229

2230-
Q. Within a complex calculation, how can I make sure that I haven't gotten a
2230+
Q: Within a complex calculation, how can I make sure that I haven't gotten a
22312231
spurious result because of insufficient precision or rounding anomalies.
22322232

2233-
A. The decimal module makes it easy to test results. A best practice is to
2233+
A: The decimal module makes it easy to test results. A best practice is to
22342234
re-run calculations using greater precision and with various rounding modes.
22352235
Widely differing results indicate insufficient precision, rounding mode issues,
22362236
ill-conditioned inputs, or a numerically unstable algorithm.
22372237

2238-
Q. I noticed that context precision is applied to the results of operations but
2238+
Q: I noticed that context precision is applied to the results of operations but
22392239
not to the inputs. Is there anything to watch out for when mixing values of
22402240
different precisions?
22412241

2242-
A. Yes. The principle is that all values are considered to be exact and so is
2242+
A: Yes. The principle is that all values are considered to be exact and so is
22432243
the arithmetic on those values. Only the results are rounded. The advantage
22442244
for inputs is that "what you type is what you get". A disadvantage is that the
22452245
results can look odd if you forget that the inputs haven't been rounded:
@@ -2267,9 +2267,9 @@ Alternatively, inputs can be rounded upon creation using the
22672267
>>> Context(prec=5, rounding=ROUND_DOWN).create_decimal('1.2345678')
22682268
Decimal('1.2345')
22692269

2270-
Q. Is the CPython implementation fast for large numbers?
2270+
Q: Is the CPython implementation fast for large numbers?
22712271

2272-
A. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of
2272+
A: Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of
22732273
the decimal module integrate the high speed `libmpdec
22742274
<https://www.bytereef.org/mpdecimal/doc/libmpdec/index.html>`_ library for
22752275
arbitrary precision correctly rounded decimal floating-point arithmetic [#]_.

pr-preview/pr-1174/_sources/library/socket.rst.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,11 +2086,8 @@ to sockets.
20862086
:attr:`socket.type`.
20872087

20882088

2089-
.. method:: socket.setsockopt(level, optname, value: int)
2090-
.. method:: socket.setsockopt(level, optname, value: buffer)
2091-
:noindex:
2092-
.. method:: socket.setsockopt(level, optname, None, optlen: int)
2093-
:noindex:
2089+
.. method:: socket.setsockopt(level, optname, value: int | Buffer)
2090+
socket.setsockopt(level, optname, None, optlen: int)
20942091

20952092
.. index:: pair: module; struct
20962093

pr-preview/pr-1174/_sources/library/ssl.rst.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2825,16 +2825,16 @@ of TLS/SSL. Some new TLS 1.3 features are not yet available.
28252825
Steve Kent
28262826

28272827
:rfc:`RFC 4086: Randomness Requirements for Security <4086>`
2828-
Donald E., Jeffrey I. Schiller
2828+
Donald E. Eastlake, Jeffrey I. Schiller, Steve Crocker
28292829

28302830
:rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile <5280>`
2831-
D. Cooper
2831+
David Cooper et al.
28322832

28332833
:rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 <5246>`
2834-
T. Dierks et. al.
2834+
Tim Dierks and Eric Rescorla.
28352835

28362836
:rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`
2837-
D. Eastlake
2837+
Donald E. Eastlake
28382838

28392839
`IANA TLS: Transport Layer Security (TLS) Parameters <https://www.iana.org/assignments/tls-parameters/tls-parameters.xml>`_
28402840
IANA

pr-preview/pr-1174/_sources/library/subprocess.rst.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,9 @@ Instances of the :class:`Popen` class have the following methods:
831831

832832
If the process does not terminate after *timeout* seconds, a
833833
:exc:`TimeoutExpired` exception will be raised. Catching this exception and
834-
retrying communication will not lose any output.
834+
retrying communication will not lose any output. Supplying *input* to a
835+
subsequent post-timeout :meth:`communicate` call is in undefined behavior
836+
and may become an error in the future.
835837

836838
The child process is not killed if the timeout expires, so in order to
837839
cleanup properly a well-behaved application should kill the child process and

pr-preview/pr-1174/_sources/library/xml.sax.handler.rst.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ for the feature and property names.
9696

9797
.. data:: feature_external_ges
9898

99+
.. warning::
100+
101+
Enabling opens a vulnerability to
102+
`external entity attacks <https://en.wikipedia.org/wiki/XML_external_entity_attack>`_
103+
if the parser is used with user-provided XML content.
104+
Please reflect on your `threat model <https://en.wikipedia.org/wiki/Threat_model>`_
105+
before enabling this feature.
106+
99107
| value: ``"http://xml.org/sax/features/external-general-entities"``
100108
| true: Include all external general (text) entities.
101109
| false: Do not include external general entities.

pr-preview/pr-1174/_sources/library/zipfile.rst.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ provides tools to create, read, write, append, and list a ZIP file. Any
1616
advanced use of this module will require an understanding of the format, as
1717
defined in `PKZIP Application Note`_.
1818

19-
This module does not currently handle multi-disk ZIP files.
19+
This module does not handle multipart ZIP files.
2020
It can handle ZIP files that use the ZIP64 extensions
2121
(that is ZIP files that are more than 4 GiB in size). It supports
22-
decryption of encrypted files in ZIP archives, but it currently cannot
22+
decryption of encrypted files in ZIP archives, but it cannot
2323
create an encrypted file. Decryption is extremely slow as it is
2424
implemented in native Python rather than C.
2525

@@ -175,7 +175,7 @@ The module defines the following items:
175175

176176
.. _zipfile-objects:
177177

178-
ZipFile Objects
178+
ZipFile objects
179179
---------------
180180

181181

@@ -248,7 +248,7 @@ ZipFile Objects
248248
.. note::
249249

250250
*metadata_encoding* is an instance-wide setting for the ZipFile.
251-
It is not currently possible to set this on a per-member basis.
251+
It is not possible to set this on a per-member basis.
252252

253253
This attribute is a workaround for legacy implementations which produce
254254
archives with names in the current locale encoding or code page (mostly
@@ -571,7 +571,7 @@ The following data attributes are also available:
571571

572572
.. _path-objects:
573573

574-
Path Objects
574+
Path objects
575575
------------
576576

577577
.. class:: Path(root, at='')
@@ -707,7 +707,7 @@ changes.
707707

708708
.. _pyzipfile-objects:
709709

710-
PyZipFile Objects
710+
PyZipFile objects
711711
-----------------
712712

713713
The :class:`PyZipFile` constructor takes the same parameters as the
@@ -784,7 +784,7 @@ The :class:`PyZipFile` constructor takes the same parameters as the
784784

785785
.. _zipinfo-objects:
786786

787-
ZipInfo Objects
787+
ZipInfo objects
788788
---------------
789789

790790
Instances of the :class:`ZipInfo` class are returned by the :meth:`.getinfo` and
@@ -954,7 +954,7 @@ Instances have the following methods and attributes:
954954
.. _zipfile-commandline:
955955
.. program:: zipfile
956956

957-
Command-Line Interface
957+
Command-line interface
958958
----------------------
959959

960960
The :mod:`zipfile` module provides a simple command-line interface to interact
@@ -1029,7 +1029,7 @@ From file itself
10291029
Decompression may fail due to incorrect password / CRC checksum / ZIP format or
10301030
unsupported compression method / decryption.
10311031

1032-
File System limitations
1032+
File system limitations
10331033
~~~~~~~~~~~~~~~~~~~~~~~
10341034

10351035
Exceeding limitations on different file systems can cause decompression failed.

pr-preview/pr-1174/_sources/whatsnew/3.4.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
What's New In Python 3.4
33
****************************
44

5-
:Author: R. David Murray <rdmurray@bitdance.com> (Editor)
5+
:Author: \R. David Murray <rdmurray@bitdance.com> (Editor)
66

77
.. Rules for maintenance:
88

0 commit comments

Comments
 (0)