Commit 17ba47e
committed
gh-130821: Add type info to error message in Modules/_abc.c
When an item yielded by a class namespace's items() is not iterable
during abstract-method computation, include the type of the offending
item in the raised TypeError, matching the type-information convention
established in gh-130835.
This targets the same _abc.c hunk that gh-144737 (now stale) proposed,
using PyErr_ExceptionMatches to only replace the message on a genuine
TypeError instead of passing NULL through PySequence_Fast, which risks
a NULL PyErr_SetString call if that path is ever reached with a
different underlying error.1 parent 91d71dd commit 17ba47e
2 files changed
Lines changed: 11 additions & 1 deletion
File tree
- Misc/NEWS.d/next/Core_and_Builtins
- Modules
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 | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| 386 | + | |
386 | 387 | | |
387 | | - | |
| 388 | + | |
388 | 389 | | |
389 | 390 | | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
390 | 397 | | |
391 | 398 | | |
392 | 399 | | |
| |||
0 commit comments