Repository navigation
Commit de1d156
committed
Clear leaked Python errors in converter collection and label paths
Several Converter failure paths could leave a Python error pending even
when called with setError: false, relying on the caller to clean up:
- ToList did not handle a failed PyObject_GetIter: the raised TypeError
survived the call (and the iterator reference leaked). Handle it like
ToArray does, disposing the reference and clearing when not setting
errors.
- MakeList treated a null PyIter_Next result as normal exhaustion, but
null also means the iterator raised: the conversion now fails instead
of returning a silently truncated list, clearing the error when not
setting errors and leaving it pending for the caller when setting
errors. The swallowed CLR-exception catch and the element-conversion
failure path also clear when not setting errors, since some element
conversion paths (failed implicit operators, deleted types) raise
regardless of setError to enrich MethodBinder's no-match message.
- The type_error and overflow labels now clear pending errors when not
setting errors, mirroring what convert_error already did, so a
probing sub-path that raised before jumping cannot leak.
The unconditional raises in the implicit-conversion catches are kept:
MethodBinder.Invoke deliberately surfaces a pending error as the
binding failure reason instead of its generic no-match message, and
Converter.TryAsManagedObject clears at the API boundary.1 parent 6bfc85c commit de1d156
2 files changed
Lines changed: 88 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
516 | 549 | | |
517 | 550 | | |
518 | 551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| 510 | + | |
| 511 | + | |
510 | 512 | | |
511 | 513 | | |
512 | 514 | | |
| |||
711 | 713 | | |
712 | 714 | | |
713 | 715 | | |
| 716 | + | |
| 717 | + | |
714 | 718 | | |
715 | 719 | | |
716 | 720 | | |
| |||
1371 | 1375 | | |
1372 | 1376 | | |
1373 | 1377 | | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
1374 | 1383 | | |
1375 | 1384 | | |
1376 | 1385 | | |
| |||
1379 | 1388 | | |
1380 | 1389 | | |
1381 | 1390 | | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
1382 | 1395 | | |
1383 | 1396 | | |
1384 | 1397 | | |
| |||
1456 | 1469 | | |
1457 | 1470 | | |
1458 | 1471 | | |
1459 | | - | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
1460 | 1489 | | |
1461 | 1490 | | |
1462 | 1491 | | |
| |||
1499 | 1528 | | |
1500 | 1529 | | |
1501 | 1530 | | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
1502 | 1536 | | |
1503 | 1537 | | |
1504 | 1538 | | |
1505 | 1539 | | |
1506 | 1540 | | |
1507 | 1541 | | |
1508 | 1542 | | |
1509 | | - | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
1510 | 1557 | | |
1511 | 1558 | | |
1512 | 1559 | | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
1513 | 1566 | | |
1514 | 1567 | | |
1515 | 1568 | | |
| |||
0 commit comments