From 97fc83e80787f74b84596046e5751181eaee095d Mon Sep 17 00:00:00 2001 From: Wojusensei <3442006415@qq.com> Date: Sat, 4 Jul 2026 01:24:25 +0800 Subject: [PATCH 1/2] bpo-152959: Fix IndexError when appears outside in plistlib --- Lib/plistlib.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/plistlib.py b/Lib/plistlib.py index 93f3ef5e38af843..ad32b4474479751 100644 --- a/Lib/plistlib.py +++ b/Lib/plistlib.py @@ -243,6 +243,9 @@ def end_dict(self): self.stack.pop() def end_key(self): + if not self.stack: + raise InvalidFileException("'key' element found outside of a 'dict' at line %d" % + self.parser.CurrentLineNumber) if self.current_key or not isinstance(self.stack[-1], dict): raise ValueError("unexpected key at line %d" % self.parser.CurrentLineNumber) From 2c11ab0bd39585f4d63815abebf4b19ce8dde0e3 Mon Sep 17 00:00:00 2001 From: Wojusensei <3442006415@qq.com> Date: Sat, 4 Jul 2026 10:35:01 +0800 Subject: [PATCH 2/2] gh-152798: Revert sys.thread_info.lock to 'semaphore'/None for consistency --- Python/thread.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Python/thread.c b/Python/thread.c index 0365f977d82b0ed..5f019c4c322203e 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -335,11 +335,15 @@ PyThread_GetInfo(void) #ifdef HAVE_PTHREAD_STUBS value = Py_NewRef(Py_None); #else - value = PyUnicode_FromString("pymutex"); +#ifdef MS_WINDOWS + value = Py_NewRef(Py_None); +#else + value = PyUnicode_FromString("semaphore"); if (value == NULL) { Py_DECREF(threadinfo); return NULL; } +#endif #endif PyStructSequence_SET_ITEM(threadinfo, pos++, value);