Skip to content

Commit 0a15ae7

Browse files
committed
Merge branch '3.14' of https://github.com/python/cpython into 3.14
2 parents 7235861 + 78c1227 commit 0a15ae7

File tree

3 files changed

+37
-16
lines changed

3 files changed

+37
-16
lines changed

Doc/library/exceptions.rst

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,24 @@ The following exceptions are the exceptions that are usually raised.
204204
assignment fails. (When an object does not support attribute references or
205205
attribute assignments at all, :exc:`TypeError` is raised.)
206206

207-
The :attr:`name` and :attr:`obj` attributes can be set using keyword-only
208-
arguments to the constructor. When set they represent the name of the attribute
209-
that was attempted to be accessed and the object that was accessed for said
210-
attribute, respectively.
207+
The optional *name* and *obj* keyword-only arguments
208+
set the corresponding attributes:
209+
210+
.. attribute:: name
211+
212+
The name of the attribute that was attempted to be accessed.
213+
214+
.. attribute:: obj
215+
216+
The object that was accessed for the named attribute.
211217

212218
.. versionchanged:: 3.10
213219
Added the :attr:`name` and :attr:`obj` attributes.
214220

215221
.. exception:: EOFError
216222

217223
Raised when the :func:`input` function hits an end-of-file condition (EOF)
218-
without reading any data. (N.B.: the :meth:`io.IOBase.read` and
224+
without reading any data. (Note: the :meth:`!io.IOBase.read` and
219225
:meth:`io.IOBase.readline` methods return an empty string when they hit EOF.)
220226

221227

@@ -312,9 +318,11 @@ The following exceptions are the exceptions that are usually raised.
312318
unqualified names. The associated value is an error message that includes the
313319
name that could not be found.
314320

315-
The :attr:`name` attribute can be set using a keyword-only argument to the
316-
constructor. When set it represent the name of the variable that was attempted
317-
to be accessed.
321+
The optional *name* keyword-only argument sets the attribute:
322+
323+
.. attribute:: name
324+
325+
The name of the variable that was attempted to be accessed.
318326

319327
.. versionchanged:: 3.10
320328
Added the :attr:`name` attribute.
@@ -382,7 +390,7 @@ The following exceptions are the exceptions that are usually raised.
382390

383391
The corresponding error message, as provided by
384392
the operating system. It is formatted by the C
385-
functions :c:func:`perror` under POSIX, and :c:func:`FormatMessage`
393+
functions :c:func:`!perror` under POSIX, and :c:func:`!FormatMessage`
386394
under Windows.
387395

388396
.. attribute:: filename
@@ -398,7 +406,7 @@ The following exceptions are the exceptions that are usually raised.
398406
.. versionchanged:: 3.3
399407
:exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`,
400408
:exc:`socket.error`, :exc:`select.error` and
401-
:exc:`mmap.error` have been merged into :exc:`OSError`, and the
409+
:exc:`!mmap.error` have been merged into :exc:`OSError`, and the
402410
constructor may return a subclass.
403411

404412
.. versionchanged:: 3.4
@@ -590,7 +598,7 @@ The following exceptions are the exceptions that are usually raised.
590598
handled, the Python interpreter exits; no stack traceback is printed. The
591599
constructor accepts the same optional argument passed to :func:`sys.exit`.
592600
If the value is an integer, it specifies the system exit status (passed to
593-
C's :c:func:`exit` function); if it is ``None``, the exit status is zero; if
601+
C's :c:func:`!exit` function); if it is ``None``, the exit status is zero; if
594602
it has another type (such as a string), the object's value is printed and
595603
the exit status is one.
596604

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Doc/library/ast.rst
1616
Doc/library/asyncio-extending.rst
1717
Doc/library/email.charset.rst
1818
Doc/library/email.parser.rst
19-
Doc/library/exceptions.rst
2019
Doc/library/functools.rst
2120
Doc/library/http.cookiejar.rst
2221
Doc/library/http.server.rst

Lib/test/test_external_inspection.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sys
66
import socket
77
import threading
8+
import time
89
from asyncio import staggered, taskgroups, base_events, tasks
910
from unittest.mock import ANY
1011
from test.support import os_helper, SHORT_TIMEOUT, busy_retry, requires_gil_enabled
@@ -930,9 +931,6 @@ def main_work():
930931
# Signal threads to start waiting
931932
ready_event.set()
932933
933-
# Give threads time to start sleeping
934-
time.sleep(0.1)
935-
936934
# Now do busy work to hold the GIL
937935
main_work()
938936
"""
@@ -967,7 +965,23 @@ def main_work():
967965

968966
# Get stack trace with all threads
969967
unwinder_all = RemoteUnwinder(p.pid, all_threads=True)
970-
all_traces = unwinder_all.get_stack_trace()
968+
for _ in range(10):
969+
# Wait for the main thread to start its busy work
970+
all_traces = unwinder_all.get_stack_trace()
971+
found = False
972+
for thread_id, stack in all_traces:
973+
if not stack:
974+
continue
975+
current_frame = stack[0]
976+
if current_frame.funcname == "main_work" and current_frame.lineno >15:
977+
found = True
978+
979+
if found:
980+
break
981+
# Give a bit of time to take the next sample
982+
time.sleep(0.1)
983+
else:
984+
self.fail("Main thread did not start its busy work on time")
971985

972986
# Get stack trace with only GIL holder
973987
unwinder_gil = RemoteUnwinder(p.pid, only_active_thread=True)

0 commit comments

Comments
 (0)