Skip to content

Commit 50081dc

Browse files
Merge remote-tracking branch 'upstream/main' into tos-caching-rebased
2 parents 40988a0 + bda1218 commit 50081dc

55 files changed

Lines changed: 2102 additions & 1455 deletions

Some content is hidden

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

Doc/c-api/arg.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,12 @@ Building values
686686
``p`` (:class:`bool`) [int]
687687
Convert a C :c:expr:`int` to a Python :class:`bool` object.
688688
689+
Be aware that this format requires an ``int`` argument.
690+
Unlike most other contexts in C, variadic arguments are not coerced to
691+
a suitable type automatically.
692+
You can convert another type (for example, a pointer or a float) to a
693+
suitable ``int`` value using ``(x) ? 1 : 0`` or ``!!x``.
694+
689695
.. versionadded:: 3.14
690696
691697
``c`` (:class:`bytes` of length 1) [char]

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/extension-modules.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,6 @@ in the following ways:
242242
* Single-phase modules support module lookup functions like
243243
:c:func:`PyState_FindModule`.
244244

245-
.. [#testsinglephase] ``_testsinglephase`` is an internal module used \
246-
in CPython's self-test suite; your installation may or may not \
245+
.. [#testsinglephase] ``_testsinglephase`` is an internal module used
246+
in CPython's self-test suite; your installation may or may not
247247
include it.

Doc/library/dialog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ is the base class for dialogs defined in other supporting modules.
220220

221221
.. class:: Dialog(master=None, **options)
222222

223-
.. method:: show(color=None, **options)
223+
.. method:: show(**options)
224224

225225
Render the Dialog window.
226226

Doc/library/netrc.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ the Unix :program:`ftp` program and other FTP clients.
2424
a :exc:`FileNotFoundError` exception will be raised.
2525
Parse errors will raise :exc:`NetrcParseError` with diagnostic
2626
information including the file name, line number, and terminating token.
27+
2728
If no argument is specified on a POSIX system, the presence of passwords in
2829
the :file:`.netrc` file will raise a :exc:`NetrcParseError` if the file
2930
ownership or permissions are insecure (owned by a user other than the user
3031
running the process, or accessible for read or write by any other user).
3132
This implements security behavior equivalent to that of ftp and other
32-
programs that use :file:`.netrc`.
33+
programs that use :file:`.netrc`. Such security checks are not available
34+
on platforms that do not support :func:`os.getuid`.
3335

3436
.. versionchanged:: 3.4 Added the POSIX permission check.
3537

Doc/library/sys.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,15 @@ always available. Unless explicitly noted otherwise, all variables are read-only
11851185
``cache_tag`` is set to ``None``, it indicates that module caching should
11861186
be disabled.
11871187

1188+
*supports_isolated_interpreters* is a boolean value, whether
1189+
this implementation supports multiple isolated interpreters.
1190+
It is ``True`` for CPython on most platforms. Platforms with
1191+
this support implement the low-level :mod:`!_interpreters` module.
1192+
1193+
.. seealso::
1194+
1195+
:pep:`684`, :pep:`734`, and :mod:`concurrent.interpreters`.
1196+
11881197
:data:`sys.implementation` may contain additional attributes specific to
11891198
the Python implementation. These non-standard attributes must start with
11901199
an underscore, and are not described here. Regardless of its contents,
@@ -1194,6 +1203,9 @@ always available. Unless explicitly noted otherwise, all variables are read-only
11941203

11951204
.. versionadded:: 3.3
11961205

1206+
.. versionchanged:: 3.14
1207+
Added ``supports_isolated_interpreters`` field.
1208+
11971209
.. note::
11981210

11991211
The addition of new required attributes must go through the normal PEP

Include/internal/pycore_critical_section.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ extern "C" {
6464

6565
# define _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op) \
6666
if (Py_REFCNT(op) != 1) { \
67-
_Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(&_PyObject_CAST(op)->ob_mutex); \
67+
_PyCriticalSection_AssertHeldObj(_PyObject_CAST(op)); \
6868
}
6969

7070
#else /* Py_DEBUG */
@@ -239,6 +239,28 @@ _PyCriticalSection_AssertHeld(PyMutex *mutex)
239239
#endif
240240
}
241241

242+
static inline void
243+
_PyCriticalSection_AssertHeldObj(PyObject *op)
244+
{
245+
#ifdef Py_DEBUG
246+
PyMutex *mutex = &_PyObject_CAST(op)->ob_mutex;
247+
PyThreadState *tstate = _PyThreadState_GET();
248+
uintptr_t prev = tstate->critical_section;
249+
if (prev & _Py_CRITICAL_SECTION_TWO_MUTEXES) {
250+
PyCriticalSection2 *cs = (PyCriticalSection2 *)(prev & ~_Py_CRITICAL_SECTION_MASK);
251+
_PyObject_ASSERT_WITH_MSG(op,
252+
(cs != NULL && (cs->_cs_base._cs_mutex == mutex || cs->_cs_mutex2 == mutex)),
253+
"Critical section of object is not held");
254+
}
255+
else {
256+
PyCriticalSection *cs = (PyCriticalSection *)(prev & ~_Py_CRITICAL_SECTION_MASK);
257+
_PyObject_ASSERT_WITH_MSG(op,
258+
(cs != NULL && cs->_cs_mutex == mutex),
259+
"Critical section of object is not held");
260+
}
261+
262+
#endif
263+
}
242264
#endif /* Py_GIL_DISABLED */
243265

244266
#ifdef __cplusplus

0 commit comments

Comments
 (0)