Skip to content

Commit 0d48019

Browse files
authored
Merge branch '3.13' into backport-ff2b5f4-3.13
2 parents dccc750 + c44070b commit 0d48019

File tree

240 files changed

+2346
-991
lines changed

Some content is hidden

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

240 files changed

+2346
-991
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ repos:
2626
name: Run Black on Tools/jit/
2727
files: ^Tools/jit/
2828

29+
- repo: https://github.com/Lucas-C/pre-commit-hooks
30+
rev: v1.5.5
31+
hooks:
32+
- id: remove-tabs
33+
types: [python]
34+
exclude: ^Tools/c-analyzer/cpython/_parser.py
35+
2936
- repo: https://github.com/pre-commit/pre-commit-hooks
3037
rev: v5.0.0
3138
hooks:

Doc/c-api/capsule.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,19 @@ Refer to :ref:`using-capsules` for more information on using these objects.
105105
``module.attribute``. The *name* stored in the capsule must match this
106106
string exactly.
107107
108+
This function splits *name* on the ``.`` character, and imports the first
109+
element. It then processes further elements using attribute lookups.
110+
108111
Return the capsule's internal *pointer* on success. On failure, set an
109112
exception and return ``NULL``.
110113
114+
.. note::
115+
116+
If *name* points to an attribute of some submodule or subpackage, this
117+
submodule or subpackage must be previously imported using other means
118+
(for example, by using :c:func:`PyImport_ImportModule`) for the
119+
attribute lookups to succeed.
120+
111121
.. versionchanged:: 3.3
112122
*no_block* has no effect anymore.
113123

Doc/c-api/exceptions.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,16 @@ Exception Classes
749749
.. versionadded:: 3.2
750750
751751
752+
.. c:function:: int PyExceptionClass_Check(PyObject *ob)
753+
754+
Return non-zero if *ob* is an exception class, zero otherwise. This function always succeeds.
755+
756+
757+
.. c:function:: const char *PyExceptionClass_Name(PyObject *ob)
758+
759+
Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*.
760+
761+
752762
Exception Objects
753763
=================
754764

Doc/c-api/function.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ There are a few functions specific to Python functions.
9595
9696
.. versionadded:: 3.12
9797
98+
99+
.. c:function:: PyObject* PyFunction_GetKwDefaults(PyObject *op)
100+
101+
Return the keyword-only argument default values of the function object *op*. This can be a
102+
dictionary of arguments or ``NULL``.
103+
104+
98105
.. c:function:: PyObject* PyFunction_GetClosure(PyObject *op)
99106
100107
Return the closure associated with the function object *op*. This can be ``NULL``
@@ -123,6 +130,19 @@ There are a few functions specific to Python functions.
123130
Raises :exc:`SystemError` and returns ``-1`` on failure.
124131
125132
133+
.. c:function:: PyObject *PyFunction_GET_CODE(PyObject *op)
134+
PyObject *PyFunction_GET_GLOBALS(PyObject *op)
135+
PyObject *PyFunction_GET_MODULE(PyObject *op)
136+
PyObject *PyFunction_GET_DEFAULTS(PyObject *op)
137+
PyObject *PyFunction_GET_KW_DEFAULTS(PyObject *op)
138+
PyObject *PyFunction_GET_CLOSURE(PyObject *op)
139+
PyObject *PyFunction_GET_ANNOTATIONS(PyObject *op)
140+
141+
These functions are similar to their ``PyFunction_Get*`` counterparts, but
142+
do not do type checking. Passing anything other than an instance of
143+
:c:data:`PyFunction_Type` is undefined behavior.
144+
145+
126146
.. c:function:: int PyFunction_AddWatcher(PyFunction_WatchCallback callback)
127147
128148
Register *callback* as a function watcher for the current interpreter.

Doc/c-api/long.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
382382
All *n_bytes* of the buffer are written: large buffers are padded with
383383
zeroes.
384384
385-
If the returned value is greater than than *n_bytes*, the value was
385+
If the returned value is greater than *n_bytes*, the value was
386386
truncated: as many of the lowest bits of the value as could fit are written,
387387
and the higher bits are ignored. This matches the typical behavior
388388
of a C-style downcast.

Doc/c-api/refcounting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ of Python objects.
201201
202202
Py_SETREF(dst, src);
203203
204-
That arranges to set *dst* to *src* _before_ releasing the reference
204+
That arranges to set *dst* to *src* *before* releasing the reference
205205
to the old value of *dst*, so that any code triggered as a side-effect
206206
of *dst* getting torn down no longer believes *dst* points
207207
to a valid object.

Doc/c-api/type.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ Type Objects
267267
and other places where a method's defining class cannot be passed using the
268268
:c:type:`PyCMethod` calling convention.
269269
270+
The returned reference is :term:`borrowed <borrowed reference>` from *type*,
271+
and will be valid as long as you hold a reference to *type*.
272+
Do not release it with :c:func:`Py_DECREF` or similar.
273+
270274
.. versionadded:: 3.11
271275
272276
.. c:function:: int PyUnstable_Type_AssignVersionTag(PyTypeObject *type)

Doc/conf.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@
7878
rst_epilog = f"""
7979
.. |python_version_literal| replace:: ``Python {version}``
8080
.. |python_x_dot_y_literal| replace:: ``python{version}``
81+
.. |python_x_dot_y_t_literal| replace:: ``python{version}t``
82+
.. |python_x_dot_y_t_literal_config| replace:: ``python{version}t-config``
83+
.. |x_dot_y_b2_literal| replace:: ``{version}.0b2``
84+
.. |applications_python_version_literal| replace:: ``/Applications/Python {version}/``
8185
.. |usr_local_bin_python_x_dot_y_literal| replace:: ``/usr/local/bin/python{version}``
8286
"""
8387

@@ -623,13 +627,14 @@
623627
'image': '_static/og-image.png',
624628
'line_color': '#3776ab',
625629
}
626-
ogp_custom_meta_tags = [
627-
'<meta name="theme-color" content="#3776ab">',
628-
]
629-
if 'create-social-cards' not in tags: # noqa: F821
630-
# Define a static preview image when not creating social cards
631-
ogp_image = '_static/og-image.png'
632-
ogp_custom_meta_tags += [
633-
'<meta property="og:image:width" content="200">',
634-
'<meta property="og:image:height" content="200">',
630+
if 'builder_html' in tags: # noqa: F821
631+
ogp_custom_meta_tags = [
632+
'<meta name="theme-color" content="#3776ab">',
635633
]
634+
if 'create-social-cards' not in tags: # noqa: F821
635+
# Define a static preview image when not creating social cards
636+
ogp_image = '_static/og-image.png'
637+
ogp_custom_meta_tags += [
638+
'<meta property="og:image:width" content="200">',
639+
'<meta property="og:image:height" content="200">',
640+
]

Doc/data/refcounts.dat

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,21 +965,45 @@ PyFunction_Check:PyObject*:o:0:
965965
PyFunction_GetAnnotations:PyObject*::0:
966966
PyFunction_GetAnnotations:PyObject*:op:0:
967967

968+
PyFunction_GET_ANNOTATIONS:PyObject*::0:
969+
PyFunction_GET_ANNOTATIONS:PyObject*:op:0:
970+
968971
PyFunction_GetClosure:PyObject*::0:
969972
PyFunction_GetClosure:PyObject*:op:0:
970973

974+
PyFunction_GET_CLOSURE:PyObject*::0:
975+
PyFunction_GET_CLOSURE:PyObject*:op:0:
976+
971977
PyFunction_GetCode:PyObject*::0:
972978
PyFunction_GetCode:PyObject*:op:0:
973979

980+
PyFunction_GET_CODE:PyObject*::0:
981+
PyFunction_GET_CODE:PyObject*:op:0:
982+
974983
PyFunction_GetDefaults:PyObject*::0:
975984
PyFunction_GetDefaults:PyObject*:op:0:
976985

986+
PyFunction_GET_DEFAULTS:PyObject*::0:
987+
PyFunction_GET_DEFAULTS:PyObject*:op:0:
988+
989+
PyFunction_GetKwDefaults:PyObject*::0:
990+
PyFunction_GetKwDefaults:PyObject*:op:0:
991+
992+
PyFunction_GET_KW_DEFAULTS:PyObject*::0:
993+
PyFunction_GET_KW_DEFAULTS:PyObject*:op:0:
994+
977995
PyFunction_GetGlobals:PyObject*::0:
978996
PyFunction_GetGlobals:PyObject*:op:0:
979997

998+
PyFunction_GET_GLOBALS:PyObject*::0:
999+
PyFunction_GET_GLOBALS:PyObject*:op:0:
1000+
9801001
PyFunction_GetModule:PyObject*::0:
9811002
PyFunction_GetModule:PyObject*:op:0:
9821003

1004+
PyFunction_GET_MODULE:PyObject*::0:
1005+
PyFunction_GET_MODULE:PyObject*:op:0:
1006+
9831007
PyFunction_New:PyObject*::+1:
9841008
PyFunction_New:PyObject*:code:+1:
9851009
PyFunction_New:PyObject*:globals:+1:
@@ -2371,6 +2395,10 @@ PyType_GetFlags:PyTypeObject*:type:0:
23712395
PyType_GetName:PyObject*::+1:
23722396
PyType_GetName:PyTypeObject*:type:0:
23732397

2398+
PyType_GetModuleByDef:PyObject*::0:
2399+
PyType_GetModuleByDef:PyTypeObject*:type:0:
2400+
PyType_GetModuleByDef:PyModuleDef*:def::
2401+
23742402
PyType_GetQualName:PyObject*::+1:
23752403
PyType_GetQualName:PyTypeObject*:type:0:
23762404

Doc/deprecations/c-api-pending-removal-in-3.15.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Pending Removal in Python 3.15
22
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33

4-
* The bundled copy of ``libmpdecimal``.
54
* The :c:func:`PyImport_ImportModuleNoBlock`:
65
Use :c:func:`PyImport_ImportModule` instead.
76
* :c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`:

0 commit comments

Comments
 (0)