Skip to content

Commit 7ac9d72

Browse files
committed
Deploying to gh-pages from @ 10794fd 🚀
1 parent 317e735 commit 7ac9d72

File tree

529 files changed

+4583
-4529
lines changed

Some content is hidden

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

529 files changed

+4583
-4529
lines changed

_sources/library/pprint.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ let's fetch information about a project from `PyPI <https://pypi.org>`_::
267267
>>> import json
268268
>>> import pprint
269269
>>> from urllib.request import urlopen
270-
>>> with urlopen('https://pypi.org/pypi/sampleproject/json') as resp:
270+
>>> with urlopen('https://pypi.org/pypi/sampleproject/1.2.0/json') as resp:
271271
... project_info = json.load(resp)['info']
272272

273273
In its basic form, :func:`~pprint.pp` shows the whole object::

_sources/library/socket.rst.txt

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,9 @@ The :mod:`socket` module also offers various network-related services:
920920

921921
.. versionadded:: 3.7
922922

923-
.. function:: getaddrinfo(host, port, family=0, type=0, proto=0, flags=0)
923+
.. function:: getaddrinfo(host, port, family=AF_UNSPEC, type=0, proto=0, flags=0)
924+
925+
This function wraps the C function ``getaddrinfo`` of the underlying system.
924926

925927
Translate the *host*/*port* argument into a sequence of 5-tuples that contain
926928
all the necessary arguments for creating a socket connected to that service.
@@ -930,8 +932,10 @@ The :mod:`socket` module also offers various network-related services:
930932
and *port*, you can pass ``NULL`` to the underlying C API.
931933

932934
The *family*, *type* and *proto* arguments can be optionally specified
933-
in order to narrow the list of addresses returned. Passing zero as a
934-
value for each of these arguments selects the full range of results.
935+
in order to provide options and limit the list of addresses returned.
936+
Pass their default values (:data:`AF_UNSPEC`, 0, and 0, respectively)
937+
to not limit the results. See the note below for details.
938+
935939
The *flags* argument can be one or several of the ``AI_*`` constants,
936940
and will influence how results are computed and returned.
937941
For example, :const:`AI_NUMERICHOST` will disable domain name resolution
@@ -951,6 +955,29 @@ The :mod:`socket` module also offers various network-related services:
951955
:const:`AF_INET6`), and is meant to be passed to the :meth:`socket.connect`
952956
method.
953957

958+
.. note::
959+
960+
If you intend to use results from :func:`!getaddrinfo` to create a socket
961+
(rather than, for example, retrieve *canonname*),
962+
consider limiting the results by *type* (e.g. :data:`SOCK_STREAM` or
963+
:data:`SOCK_DGRAM`) and/or *proto* (e.g. :data:`IPPROTO_TCP` or
964+
:data:`IPPROTO_UDP`) that your application can handle.
965+
966+
The behavior with default values of *family*, *type*, *proto*
967+
and *flags* is system-specific.
968+
969+
Many systems (for example, most Linux configurations) will return a sorted
970+
list of all matching addresses.
971+
These addresses should generally be tried in order until a connection succeeds
972+
(possibly tried in parallel, for example, using a `Happy Eyeballs`_ algorithm).
973+
In these cases, limiting the *type* and/or *proto* can help eliminate
974+
unsuccessful or unusable connecton attempts.
975+
976+
Some systems will, however, only return a single address.
977+
(For example, this was reported on Solaris and AIX configurations.)
978+
On these systems, limiting the *type* and/or *proto* helps ensure that
979+
this address is usable.
980+
954981
.. audit-event:: socket.getaddrinfo host,port,family,type,protocol socket.getaddrinfo
955982

956983
The following example fetches address information for a hypothetical TCP
@@ -970,6 +997,8 @@ The :mod:`socket` module also offers various network-related services:
970997
for IPv6 multicast addresses, string representing an address will not
971998
contain ``%scope_id`` part.
972999

1000+
.. _Happy Eyeballs: https://en.wikipedia.org/wiki/Happy_Eyeballs
1001+
9731002
.. function:: getfqdn([name])
9741003

9751004
Return a fully qualified domain name for *name*. If *name* is omitted or empty,

_sources/library/urllib.parse.rst.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,15 @@ or on combining URL components into a URL string.
403403
If you do not want that behavior, preprocess the *url* with :func:`urlsplit` and
404404
:func:`urlunsplit`, removing possible *scheme* and *netloc* parts.
405405

406+
.. warning::
407+
408+
Because an absolute URL may be passed as the ``url`` parameter, it is
409+
generally **not secure** to use ``urljoin`` with an attacker-controlled
410+
``url``. For example in,
411+
``urljoin("https://website.com/users/", username)``, if ``username`` can
412+
contain an absolute URL, the result of ``urljoin`` will be the absolute
413+
URL.
414+
406415

407416
.. versionchanged:: 3.5
408417

_sources/reference/expressions.rst.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,8 @@ a user-defined function:
11561156
first thing the code block will do is bind the formal parameters to the
11571157
arguments; this is described in section :ref:`function`. When the code block
11581158
executes a :keyword:`return` statement, this specifies the return value of the
1159-
function call.
1159+
function call. If execution reaches the end of the code block without
1160+
executing a :keyword:`return` statement, the return value is ``None``.
11601161

11611162
a built-in function or method:
11621163
.. index::

_sources/whatsnew/3.13.rst.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,8 @@ and are now removed:
15681568
For audio playback, use the :pypi:`pygame` library from PyPI instead.
15691569
* :mod:`!pipes`:
15701570
Use the :mod:`subprocess` module instead.
1571+
Use :func:`shlex.quote` to replace the undocumented ``pipes.quote``
1572+
function.
15711573
* :mod:`!sndhdr`:
15721574
The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-magic` libraries
15731575
should be used as replacements.

about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ <h3>瀏覽</h3>
320320
<a href="https://www.python.org/psf/donations/">Please donate.</a>
321321
<br />
322322
<br />
323-
最後更新於 11月 13, 2024 (03:17 UTC)。
323+
最後更新於 11月 16, 2024 (07:42 UTC)。
324324

325325
<a href="/bugs.html">Found a bug</a>?
326326

bugs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ <h3>瀏覽</h3>
359359
<a href="https://www.python.org/psf/donations/">Please donate.</a>
360360
<br />
361361
<br />
362-
最後更新於 11月 13, 2024 (03:17 UTC)。
362+
最後更新於 11月 16, 2024 (07:42 UTC)。
363363

364364
<a href="/bugs.html">Found a bug</a>?
365365

c-api/abstract.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ <h3>瀏覽</h3>
329329
<a href="https://www.python.org/psf/donations/">Please donate.</a>
330330
<br />
331331
<br />
332-
最後更新於 11月 13, 2024 (03:17 UTC)。
332+
最後更新於 11月 16, 2024 (07:42 UTC)。
333333

334334
<a href="/bugs.html">Found a bug</a>?
335335

c-api/allocation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ <h3>瀏覽</h3>
344344
<a href="https://www.python.org/psf/donations/">Please donate.</a>
345345
<br />
346346
<br />
347-
最後更新於 11月 13, 2024 (03:17 UTC)。
347+
最後更新於 11月 16, 2024 (07:42 UTC)。
348348

349349
<a href="/bugs.html">Found a bug</a>?
350350

c-api/apiabiversion.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ <h3>瀏覽</h3>
376376
<a href="https://www.python.org/psf/donations/">Please donate.</a>
377377
<br />
378378
<br />
379-
最後更新於 11月 13, 2024 (03:17 UTC)。
379+
最後更新於 11月 16, 2024 (07:42 UTC)。
380380

381381
<a href="/bugs.html">Found a bug</a>?
382382

0 commit comments

Comments
 (0)