cpython/Lib
Pablo Galindo Salgado 9df477c0ce
gh-138709: Fix race condition in test_external_inspection (#139209)
Fix race condition in test_external_inspection thread status tests

The tests test_thread_status_detection and test_thread_status_gil_detection
had a race condition where the test could sample thread status between when
the sleeper thread sends its "ready" message and when it actually calls
time.sleep(). This caused intermittent test failures where the sleeper
thread would show as running (status=0) instead of idle (status=1 or 2).

The fix moves the thread status collection inside the retry loop and
specifically waits for the expected thread states before proceeding with
assertions. The retry loop now continues until:
- The sleeper thread shows as idle (status=1 for CPU mode, status=2 for GIL mode)
- The busy thread shows as running (status=0)
- Both thread IDs are found in the status collection

This ensures the test waits for threads to settle into their expected states
before making assertions, eliminating the race condition.
2025-09-21 18:32:03 +01:00
..
__phello__
_pyrepl gh-134466: Don't run when termios is inaccessible (GH-138911) 2025-09-17 12:59:49 +02:00
asyncio gh-138958: remove unused variable in Lib/asyncio/streams.py (#138959) 2025-09-16 08:48:41 +05:30
collections Minor edit: Improve comment readability and ordering (gh-136557) 2025-07-11 12:36:17 -07:00
compression gh-132983: Split `_zstd_set_c_parameters` (#133921) 2025-05-28 14:45:08 +00:00
concurrent gh-135729: Store reference to globals in Interpreter._decref (GH-139104) 2025-09-18 11:17:51 +00:00
ctypes gh-99948: Support ctypes.util.find_library in emscripten environment (#138519) 2025-09-17 10:17:56 +00:00
curses gh-133575: eliminate legacy checks in Lib/curses/__init__.py (#133576) 2025-05-07 20:28:32 +02:00
dbm gh-135386: Fix "unable to open database file" errors on readonly DB (GH-135566) 2025-08-22 14:11:59 +03:00
email gh-134759: fix UnboundLocalError in email.message.Message.get_payload (#136071) 2025-07-12 13:30:09 +00:00
encodings gh-137153: Add latin_N aliases to encodings.aliases (#136701) 2025-08-29 14:28:04 +02:00
ensurepip gh-137257: Upgrade bundled pip to 25.2 (GH-137258) 2025-08-03 22:00:17 -04:00
html gh-135661: Fix parsing unterminated bogus comments in HTMLParser (GH-137873) 2025-08-17 13:37:50 +03:00
http gh-92936: allow double quote in cookie values (#113663) 2025-08-08 12:07:15 -07:00
idlelib gh-71648: Optimize PNG files (GH-138842) 2025-09-12 20:13:05 +00:00
importlib gh-138310: Adds sys.audit event for import_module (#138311) 2025-09-19 06:21:42 -07:00
json gh-138019: improve help message for json.tool (#138037) 2025-08-22 08:44:25 +00:00
logging gh-91555: Revert disabling of logger while handling log record. (GH-135858) 2025-06-25 06:42:38 +01:00
multiprocessing gh-138813: Fix mutable default kwargs={} in multiprocessing BaseProcess and DummyProcess to use None (GH-138814) 2025-09-17 14:45:52 -07:00
pathlib GH-128520: pathlib ABCs: improve protocol for 'openable' objects (#134101) 2025-09-12 22:25:18 +01:00
profiling gh-138709: Implement CPU time profiling in profiling.sample (#138710) 2025-09-19 19:17:28 +01:00
pydoc_data Python 3.14.0b1 2025-05-06 18:33:52 +03:00
re gh-133306: Support \z as a synonym for \Z in regular expressions (GH-133314) 2025-05-03 07:54:33 +00:00
site-packages
sqlite3 gh-133390: Extend completion for .commands in sqlite3 (GH-135432) 2025-08-25 14:58:00 +02:00
string GH-132661: Add `string.templatelib.convert()` (#135217) 2025-07-15 11:56:42 +02:00
sysconfig Synced docs and docstring for sysconfig.get_platform (#135530) 2025-09-16 12:16:48 +01:00
test gh-138709: Fix race condition in test_external_inspection (#139209) 2025-09-21 18:32:03 +01:00
tkinter gh-126008: Improve docstrings for Tkinter cget and configure methods (GH-133303) 2025-08-12 07:55:01 +03:00
tomllib gh-133117: Enable stricter mypy checks for tomllib (#133206) 2025-05-03 16:57:09 +03:00
turtledemo
unittest gh-137716: Fix double period in AttributeError message for invalid mock assertions (#137717) 2025-08-14 21:26:02 +00:00
urllib gh-88375, gh-111788: Fix parsing errors and normalization in robotparser (GH-138502) 2025-09-05 18:58:42 +03:00
venv gh-119535: 3.15 minus π (#134037) 2025-05-15 02:39:42 -07:00
wsgiref gh-133810: remove http.server.CGIHTTPRequestHandler and --cgi flag (#133811) 2025-05-17 09:58:16 +02:00
xml gh-135640: Adds more type checking to ElementTree (GH-135643) 2025-07-03 10:48:47 +03:00
xmlrpc gh-136839: Refactor simple dict.update calls (#136811) 2025-07-19 10:12:10 -07:00
zipfile gh-136170: Revert adding ZipFile.data_offset (GH-136950) 2025-07-21 23:16:30 +00:00
zoneinfo gh-137976: Explicitly exclude localtime from available_timezones (#138012) 2025-09-18 17:32:14 +01:00
__future__.py
__hello__.py
_aix_support.py
_android_support.py Make Android streams respect the unbuffered (-u) option (#138806) 2025-09-18 11:41:21 +01:00
_apple_support.py
_ast_unparse.py gh-132661: Disallow Template/str concatenation after PEP 750 spec update (#135996) 2025-07-21 08:44:26 +02:00
_collections_abc.py gh-118803: Make ByteString deprecations louder; remove ByteString from typing.__all__ and collections.abc.__all__ (#139127) 2025-09-18 18:58:16 +00:00
_colorize.py gh-128636: Fix crash in PyREPL when os.environ is overwritten with an invalid value for macOS (GH-138089) 2025-09-15 18:26:23 +02:00
_compat_pickle.py gh-133810: remove http.server.CGIHTTPRequestHandler and --cgi flag (#133811) 2025-05-17 09:58:16 +02:00
_ios_support.py
_markupbase.py _markupbase.py: Use a permalink for the analysis of MS-Word extensions (GH-129017) 2025-02-06 11:40:43 +01:00
_opcode_metadata.py GH-134282: Always borrow references LOAD_CONST (GH-134284) 2025-05-20 11:24:11 -04:00
_osx_support.py
_py_abc.py
_py_warnings.py gh-134716: Support regular expressions in -W and PYTHONWARNINGS (GH-138149) 2025-09-16 17:06:44 +00:00
_pydatetime.py gh-97517: Add documentation links to datetime strftime/strptime docstrings (#138559) 2025-09-15 19:50:46 +01:00
_pydecimal.py gh-87790: support thousands separators for formatting fractional part of Decimal (#132202) 2025-07-07 11:16:27 +03:00
_pyio.py gh-133982: Test _pyio.BytesIO in free-threaded tests (gh-136218) 2025-07-04 11:27:21 +09:00
_pylong.py
_sitebuiltins.py
_strptime.py gh-81148: Eliminate unnecessary check in _strptime when determining AM/PM (#13428) 2025-09-19 10:23:12 +00:00
_threading_local.py gh-107006: Move threading.local docstring to docs (#131840) 2025-05-05 15:00:15 +03:00
_weakrefset.py
abc.py
annotationlib.py gh-137226: Fix behavior of ForwardRef.evaluate with type_params (#137227) 2025-08-13 06:47:47 -07:00
antigravity.py
argparse.py GH-130645: Default to color help in argparse (#136809) 2025-07-20 14:55:44 -07:00
ast.py gh-124503: Optimize ast.literal_eval() for small input (GH-137010) 2025-07-31 12:55:00 +03:00
base64.py
bdb.py gh-136980: Remove unused C tracing code in bdb (#136981) 2025-07-24 09:58:54 +09:00
bisect.py
bz2.py gh-132983: Introduce compression package and move _compression module (GH-133018) 2025-04-27 14:41:30 -07:00
calendar.py gh-137481: Fix abbreviation of day names in TextCalendar (GH-137482) 2025-08-20 19:55:50 +03:00
cmd.py gh-133363: Fix Cmd completion for lines beginning with ! (#133364) 2025-05-03 22:50:37 -04:00
code.py gh-135103: Remove an unused local variable in Lib/code.py (GH-135104) 2025-06-04 13:57:31 +09:00
codecs.py gh-52876: Implement missing parameter in codecs.StreamReaderWriter functions (#136498) 2025-07-10 17:42:14 +02:00
codeop.py gh-132449: Improve syntax error messages for keywords with typos (#132450) 2025-04-22 11:01:55 +02:00
colorsys.py
compileall.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
configparser.py gh-65697: Improved error msg for configparser key validation (#135527) 2025-06-15 12:13:19 -04:00
contextlib.py
contextvars.py
copy.py gh-132657: improve deepcopy and copy scaling on free-threading (#138429) 2025-09-04 13:20:23 +05:30
copyreg.py gh-132882: Fix copying of unions with members that do not support __or__ (#132883) 2025-04-24 16:49:09 +00:00
cProfile.py gh-138122: Implement PEP 799 (#138142) 2025-08-27 17:52:50 +01:00
csv.py
dataclasses.py gh-135228: Create __dict__ and __weakref__ descriptors for object (GH-136966) 2025-08-18 14:25:51 +02:00
datetime.py
decimal.py
difflib.py gh-133722: Add Difflib theme to _colorize and 'color' option to difflib.unified_diff (#133725) 2025-08-08 18:34:02 +03:00
dis.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
doctest.py gh-136914: Fix support of cached functions and properties in DocTest's lineno computation (GH-136930) 2025-07-25 12:46:12 +03:00
enum.py gh-136764: improve comment in enum.verify.__call__ (GH-136774) 2025-07-19 05:55:02 -07:00
filecmp.py
fileinput.py
fnmatch.py gh-133306: Use \z instead of \Z in fnmatch.translate() and glob.translate() (GH-133338) 2025-05-03 17:58:21 +03:00
fractions.py gh-87790: support thousands separators for formatting fractional part of Fraction (#132204) 2025-07-07 11:16:31 +03:00
ftplib.py
functools.py Improve readability by adding whitespace between code paragraphs (gh-138090) 2025-08-23 15:18:46 +00:00
genericpath.py gh-71189: Support all-but-last mode in os.path.realpath() (GH-117562) 2025-07-30 10:19:19 +03:00
getopt.py
getpass.py gh-138514: getpass: restrict echo_char to a single ASCII character (#138591) 2025-09-16 16:21:55 +02:00
gettext.py gettext: Remove outdated "TODO" comment (#130890) 2025-03-06 23:41:03 +00:00
glob.py GH-137466: Remove deprecated and undocumented glob.glob0() and glob1() (#137467) 2025-08-06 17:13:58 +01:00
graphlib.py gh-130914: Make graphlib.TopologicalSorter.prepare() idempotent (#131317) 2025-03-18 16:28:00 -05:00
gzip.py Remove some dead code from gzip and tarfile (#138123) 2025-08-25 16:23:47 +03:00
hashlib.py gh-136565: use SHA-256 for hashlib.__doc__ example instead of MD5 (#138157) 2025-08-26 10:38:53 +00:00
heapq.py Remove unnecessary slice in heapq.py (gh-139087) 2025-09-18 00:52:46 -05:00
hmac.py gh-136912: fix handling of OverflowError in hmac.digest (#136917) 2025-07-26 08:22:06 +00:00
imaplib.py gh-136134: imaplib: fix CRAM-MD5 on FIPS-only environments (#136615) 2025-08-22 12:08:55 +02:00
inspect.py gh-137317: Fix inspect.signature() for class with wrapped __init__ or __new__ (GH-137862) 2025-08-28 17:57:53 +03:00
io.py gh-132952: Speed up startup by importing _io instead of io (#132957) 2025-04-28 08:38:56 -07:00
ipaddress.py gh-115766: Fix IPv4Interface.is_unspecified (GH-137326) 2025-08-11 15:04:47 +02:00
keyword.py
linecache.py gh-133253: making linecache thread-safe (#133305) 2025-05-09 12:15:16 +05:30
locale.py gh-137729: Fix support for locales with @-modifiers (GH-137253) 2025-08-18 10:11:15 +03:00
lzma.py gh-132983: Introduce compression package and move _compression module (GH-133018) 2025-04-27 14:41:30 -07:00
mailbox.py
mimetypes.py gh-136507: Fix mimetypes CLI to handle multiple file parameters (GH-136508) 2025-08-25 16:38:43 +02:00
modulefinder.py
netrc.py gh-135823: improve error message in netrc security checks (#135827) 2025-06-23 12:49:27 +02:00
ntpath.py gh-71189: Support all-but-last mode in os.path.realpath() (GH-117562) 2025-07-30 10:19:19 +03:00
nturl2path.py GH-125866: Deprecate nturl2path module (#131432) 2025-03-19 19:33:01 +00:00
numbers.py gh-122450: Expand documentation for `Rational and Fraction` (#136800) 2025-08-04 02:15:59 +00:00
opcode.py gh-131738: optimize builtin any/all/tuple calls with a generator expression arg (#131737) 2025-03-28 10:35:20 +00:00
operator.py
optparse.py
os.py GH-119169: Slightly speed up os.walk(topdown=True) (GH-121431) 2025-09-03 13:57:01 +02:00
pdb.py Improve permission error messages in pdb and asyncio.tools (#134290) 2025-09-12 12:54:04 +01:00
pickle.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
pickletools.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
pkgutil.py gh-131152, pkgutil: Remove unused imports (#131149) 2025-03-12 15:03:36 +01:00
platform.py gh-90548: Fix musl version detection with --strip-all (#137864) 2025-09-01 18:58:45 +02:00
plistlib.py
poplib.py gh-130637: Add validation for numeric response data in stat() method (#130646) 2025-03-02 08:05:40 -05:00
posixpath.py gh-71189: Support all-but-last mode in os.path.realpath() (GH-117562) 2025-07-30 10:19:19 +03:00
pprint.py GH-90117: Check for list and tuple before MappingView in pprint (GH-135779) 2025-06-24 14:41:41 -07:00
profile.py gh-138122: Implement PEP 799 (#138142) 2025-08-27 17:52:50 +01:00
pstats.py gh-135953: Implement sampling tool under profile.sample (#135998) 2025-07-10 18:44:24 +01:00
pty.py
py_compile.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
pyclbr.py
pydoc.py gh-139076: Fix regression in pydoc not showing extension functions (GH-139077) 2025-09-19 15:54:06 +03:00
queue.py Fix Queue.shutdown docs for condition to unblock a join (gh-137088) 2025-07-25 07:56:28 -06:00
quopri.py
random.py Minor edit: Move comments closer to the code they describe (gh-136477) 2025-07-09 10:23:46 -07:00
reprlib.py gh-135487: fix reprlib.Repr.repr_int when given very large integers (#135506) 2025-06-24 11:09:46 +00:00
rlcompleter.py
runpy.py
sched.py
secrets.py
selectors.py
shelve.py gh-99631: Add custom loads and dumps support for the shelve module (#118065) 2025-07-12 14:27:32 +02:00
shlex.py gh-138804: Check type in shlex.quote (GH-138809) 2025-09-12 14:26:21 -04:00
shutil.py gh-132983: Add missing references to Zstandard in shutil docstrings (GH-136617) 2025-07-23 18:09:53 +00:00
signal.py
site.py gh-128066: Properly handle history file writes for RO fs on PyREPL (gh-134380) 2025-05-20 21:47:57 +02:00
smtplib.py gh-136134: restore truncated comment post GH-136623 (#138088) 2025-08-23 10:17:14 +00:00
socket.py gh-99813: Start using SSL_sendfile when available (#99907) 2025-07-12 12:42:35 +00:00
socketserver.py gh-80184: Set getattr(socket, "SOMAXCONN", 5) as the default queue size for TCPServer (GH-134249) 2025-05-19 19:28:09 +00:00
ssl.py gh-138252: Add support in SSL module for getting and setting TLS signature algorithms (#138269) 2025-09-08 08:36:12 +00:00
stat.py
statistics.py gh-132893: Minor edits to the statistics module PR (gh-133106) 2025-04-28 23:05:37 -05:00
stringprep.py
struct.py
subprocess.py GH-133711: Enable UTF-8 mode by default (PEP 686) (#133712) 2025-07-15 10:45:41 +01:00
symtable.py gh-121914: Change the names of the symbol tables for lambda and genexpr (GH-135288) 2025-07-13 21:09:42 +03:00
tabnanny.py
tarfile.py gh-57911: Sanitize symlink targets in tarfile on win32 (GH-138309) 2025-09-05 16:19:47 +02:00
tempfile.py gh-136156: Allow using linkat() with TemporaryFile (#136281) 2025-07-08 18:39:47 +02:00
textwrap.py gh-133306: Use \z instead of \Z in regular expressions in the stdlib (GH-133337) 2025-05-03 17:58:49 +03:00
this.py
threading.py gh-136003: Execute pre-finalization callbacks in a loop (GH-136004) 2025-09-18 08:29:12 -04:00
timeit.py gh-131178: Update help message for timeit CLI (#131326) 2025-03-30 14:19:38 +03:00
token.py gh-131507: Add support for syntax highlighting in PyREPL (GH-133247) 2025-05-02 20:22:31 +02:00
tokenize.py gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. (#134734) 2025-05-26 13:49:39 -04:00
trace.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
traceback.py gh-137967: Restore suggestions on nested attribute access (#137968) 2025-08-21 16:56:57 +01:00
tracemalloc.py
tty.py
turtle.py
types.py gh-136492: Add FrameLocalsProxyType to types (GH-136546) 2025-07-20 20:49:00 +02:00
typing.py gh-118803: Make ByteString deprecations louder; remove ByteString from typing.__all__ and collections.abc.__all__ (#139127) 2025-09-18 18:58:16 +00:00
uuid.py gh-76760: test that uuid.uuid1() sets the version field (#139033) 2025-09-17 13:31:51 +00:00
warnings.py gh-128384: Use a context variable for warnings.catch_warnings (gh-130010) 2025-04-09 16:18:54 -07:00
wave.py gh-136523: Fix wave.Wave_write emitting an unraisable when open raises (GH-136529) 2025-07-13 08:49:12 +03:00
weakref.py
webbrowser.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
zipapp.py gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
zipimport.py gh-61206: Support zstandard compression in the zipimport module (GH-138254) 2025-09-01 17:14:23 -07:00