Skip to content

Commit 90722a8

Browse files
committed
Deploying to gh-pages from @ c347ae2 🚀
1 parent 11a75de commit 90722a8

File tree

561 files changed

+743
-598
lines changed

Some content is hidden

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

561 files changed

+743
-598
lines changed

_sources/c-api/init.rst.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,17 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
14451445
14461446
.. versionadded:: 3.8
14471447
1448+
1449+
.. c:function:: PyObject* PyUnstable_InterpreterState_GetMainModule(PyInterpreterState *interp)
1450+
1451+
Return a :term:`strong reference` to the ``__main__`` `module object <moduleobjects>`_
1452+
for the given interpreter.
1453+
1454+
The caller must hold the GIL.
1455+
1456+
.. versionadded:: 3.13
1457+
1458+
14481459
.. c:type:: PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
14491460
14501461
Type of a frame evaluation function.

_sources/library/asyncio-eventloop.rst.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ Scheduling callbacks
236236
another thread, this function *must* be used, since :meth:`call_soon` is not
237237
thread-safe.
238238

239+
This function is safe to be called from a reentrant context or signal handler,
240+
however, it is not safe or fruitful to use the returned handle in such contexts.
241+
239242
Raises :exc:`RuntimeError` if called on a loop that's been closed.
240243
This can happen on a secondary thread when the main application is
241244
shutting down.
@@ -957,6 +960,9 @@ Watching file descriptors
957960
invoke *callback* with the specified arguments once *fd* is available for
958961
reading.
959962

963+
Any preexisting callback registered for *fd* is cancelled and replaced by
964+
*callback*.
965+
960966
.. method:: loop.remove_reader(fd)
961967

962968
Stop monitoring the *fd* file descriptor for read availability. Returns
@@ -968,6 +974,9 @@ Watching file descriptors
968974
invoke *callback* with the specified arguments once *fd* is available for
969975
writing.
970976

977+
Any preexisting callback registered for *fd* is cancelled and replaced by
978+
*callback*.
979+
971980
Use :func:`functools.partial` :ref:`to pass keyword arguments
972981
<asyncio-pass-keywords>` to *callback*.
973982

_sources/library/asyncio-queue.rst.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ Queue
115115

116116
.. method:: task_done()
117117

118-
Indicate that a formerly enqueued task is complete.
118+
Indicate that a formerly enqueued work item is complete.
119119

120120
Used by queue consumers. For each :meth:`~Queue.get` used to
121-
fetch a task, a subsequent call to :meth:`task_done` tells the
122-
queue that the processing on the task is complete.
121+
fetch a work item, a subsequent call to :meth:`task_done` tells the
122+
queue that the processing on the work item is complete.
123123

124124
If a :meth:`join` is currently blocking, it will resume when all
125125
items have been processed (meaning that a :meth:`task_done`

_sources/library/fnmatch.rst.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ module. See module :mod:`glob` for pathname expansion (:mod:`glob` uses
4646
a period are not special for this module, and are matched by the ``*`` and ``?``
4747
patterns.
4848

49-
Also note that :func:`functools.lru_cache` with the *maxsize* of 32768 is used to
50-
cache the compiled regex patterns in the following functions: :func:`fnmatch`,
51-
:func:`fnmatchcase`, :func:`.filter`.
49+
Unless stated otherwise, "filename string" and "pattern string" either refer to
50+
:class:`str` or ``ISO-8859-1`` encoded :class:`bytes` objects. Note that the
51+
functions documented below do not allow to mix a :class:`!bytes` pattern with
52+
a :class:`!str` filename, and vice-versa.
53+
54+
Finally, note that :func:`functools.lru_cache` with a *maxsize* of 32768
55+
is used to cache the (typed) compiled regex patterns in the following
56+
functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`.
57+
5258

5359
.. function:: fnmatch(name, pat)
5460

@@ -78,16 +84,16 @@ cache the compiled regex patterns in the following functions: :func:`fnmatch`,
7884

7985
.. function:: filter(names, pat)
8086

81-
Construct a list from those elements of the :term:`iterable` *names*
82-
that match pattern *pat*.
87+
Construct a list from those elements of the :term:`iterable` of filename
88+
strings *names* that match the pattern string *pat*.
8389
It is the same as ``[n for n in names if fnmatch(n, pat)]``,
8490
but implemented more efficiently.
8591

8692

8793
.. function:: translate(pat)
8894

8995
Return the shell-style pattern *pat* converted to a regular expression for
90-
using with :func:`re.match`.
96+
using with :func:`re.match`. The pattern is expected to be a :class:`str`.
9197

9298
Example:
9399

_sources/library/json.rst.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ Basic Usage
324324
:raises JSONDecodeError:
325325
When the data being deserialized is not a valid JSON document.
326326

327+
:raises UnicodeDecodeError:
328+
When the data being deserialized does not contain
329+
UTF-8, UTF-16 or UTF-32 encoded data.
330+
327331
.. versionchanged:: 3.1
328332

329333
* Added the optional *object_pairs_hook* parameter.
@@ -343,15 +347,11 @@ Basic Usage
343347

344348
.. function:: loads(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)
345349

346-
Deserialize *s* (a :class:`str`, :class:`bytes` or :class:`bytearray`
350+
Identical to :func:`load`, but instead of a file-like object,
351+
deserialize *s* (a :class:`str`, :class:`bytes` or :class:`bytearray`
347352
instance containing a JSON document) to a Python object using this
348353
:ref:`conversion table <json-to-py-table>`.
349354

350-
The other arguments have the same meaning as in :func:`load`.
351-
352-
If the data being deserialized is not a valid JSON document, a
353-
:exc:`JSONDecodeError` will be raised.
354-
355355
.. versionchanged:: 3.6
356356
*s* can now be of type :class:`bytes` or :class:`bytearray`. The
357357
input encoding should be UTF-8, UTF-16 or UTF-32.

_sources/library/pdb.rst.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,15 @@ slightly different way:
173173
:func:`set_trace` will enter the debugger immediately, rather than
174174
on the next line of code to be executed.
175175

176-
.. function:: post_mortem(traceback=None)
176+
.. function:: post_mortem(t=None)
177177

178-
Enter post-mortem debugging of the given *traceback* object. If no
179-
*traceback* is given, it uses the one of the exception that is currently
180-
being handled (an exception must be being handled if the default is to be
181-
used).
178+
Enter post-mortem debugging of the given exception or
179+
:ref:`traceback object <traceback-objects>`. If no value is given, it uses
180+
the exception that is currently being handled, or raises ``ValueError`` if
181+
there isn’t one.
182182

183+
.. versionchanged:: 3.13
184+
Support for exception objects was added.
183185

184186
.. function:: pm()
185187

_sources/library/turtle.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,8 +987,8 @@ Settings for measurement
987987
>>> turtle.heading()
988988
90.0
989989

990-
Change angle measurement unit to grad (also known as gon,
991-
grade, or gradian and equals 1/100-th of the right angle.)
990+
>>> # Change angle measurement unit to grad (also known as gon,
991+
>>> # grade, or gradian and equals 1/100-th of the right angle.)
992992
>>> turtle.degrees(400.0)
993993
>>> turtle.heading()
994994
100.0

_sources/whatsnew/3.13.rst.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,6 +2715,33 @@ Changes in the C API
27152715
Calling this function is redundant now that :c:func:`PyFrame_GetLocals`
27162716
returns a write-through proxy for :term:`optimized scopes <optimized scope>`.
27172717

2718+
* Python 3.13 removed many private functions. Some of them can be replaced using these
2719+
alternatives:
2720+
2721+
* ``_PyDict_Pop()``: :c:func:`PyDict_Pop` or :c:func:`PyDict_PopString`;
2722+
* ``_PyDict_GetItemWithError()``: :c:func:`PyDict_GetItemRef`;
2723+
* ``_PyErr_WriteUnraisableMsg()``: :c:func:`PyErr_FormatUnraisable`;
2724+
* ``_PyEval_SetTrace()``: :c:func:`PyEval_SetTrace` or :c:func:`PyEval_SetTraceAllThreads`;
2725+
* ``_PyList_Extend()``: :c:func:`PyList_Extend`;
2726+
* ``_PyLong_AsInt()``: :c:func:`PyLong_AsInt`;
2727+
* ``_PyMem_RawStrdup()``: ``strdup()``;
2728+
* ``_PyMem_Strdup()``: ``strdup()``;
2729+
* ``_PyObject_ClearManagedDict()``: :c:func:`PyObject_ClearManagedDict`;
2730+
* ``_PyObject_VisitManagedDict()``: :c:func:`PyObject_VisitManagedDict`;
2731+
* ``_PyThreadState_UncheckedGet()``: :c:func:`PyThreadState_GetUnchecked()`;
2732+
* ``_PyTime_AsSecondsDouble()``: :c:func:`PyTime_AsSecondsDouble`;
2733+
* ``_PyTime_GetMonotonicClock()``: :c:func:`PyTime_Monotonic` or :c:func:`PyTime_MonotonicRaw`;
2734+
* ``_PyTime_GetPerfCounter()``: :c:func:`PyTime_PerfCounter` or :c:func:`PyTime_PerfCounterRaw`;
2735+
* ``_PyTime_GetSystemClock()``: :c:func:`PyTime_Time` or :c:func:`PyTime_TimeRaw`;
2736+
* ``_PyTime_MAX``: :c:var:`PyTime_MAX`;
2737+
* ``_PyTime_MIN``: :c:var:`PyTime_MIN`;
2738+
* ``_PyTime_t``: :c:type:`PyTime_t`;
2739+
* ``_Py_HashPointer()``: :c:func:`Py_HashPointer`;
2740+
* ``_Py_IsFinalizing()``: :c:func:`Py_IsFinalizing`.
2741+
2742+
The `pythoncapi-compat project`_ can be used to get most of these new
2743+
functions on Python 3.12 and older.
2744+
27182745
Regression Test Changes
27192746
=======================
27202747

_static/glossary.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ <h3>瀏覽</h3>
322322
<a href="https://www.python.org/psf/donations/">Please donate.</a>
323323
<br />
324324
<br />
325-
最後更新於 1月 08, 2025 (08:43 UTC)。
325+
最後更新於 1月 15, 2025 (05:38 UTC)。
326326

327327
<a href="/bugs.html">Found a bug</a>?
328328

0 commit comments

Comments
 (0)