Commit eca0efe
In `symtable_visit_type_param_bound_or_default()`, when a reserved name
(e.g. `__classdict__`) is used as a type parameter, `PyUnicode_FromFormat()`
is called to build the SyntaxError message. If the allocation fails and
returns NULL, the subsequent `PyErr_SetObject()` and `Py_DECREF()` calls
would dereference NULL, causing a segfault.
Fix by returning 0 immediately when `PyUnicode_FromFormat()` returns NULL.
This propagates the MemoryError set by `PyUnicode_FromFormat()`.
The bug was introduced in gh-128632 (commit 891c61c).
(cherry picked from commit 10ed03e)
Co-authored-by: Petr Vaganov <petrvaganoff@gmail.com>
* Remove test
---------
Co-authored-by: Petr Vaganov <petrvaganoff@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 43d8492 commit eca0efe
2 files changed
Lines changed: 6 additions & 0 deletions
File tree
- Misc/NEWS.d/next/Core_and_Builtins
- Python
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2318 | 2318 | | |
2319 | 2319 | | |
2320 | 2320 | | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
2321 | 2324 | | |
2322 | 2325 | | |
2323 | 2326 | | |
| |||
0 commit comments