GeezerVison is showing github.com — Incorrect error handling for APIs that can raise exceptions · Issue #105375 · python/cpython
Incorrect error handling for APIs that can raise exceptions #105375DescriptionFor example, in the collation callback two str objects (string1 and string2) are created using PyUnicode_FromStringAndSize. Error handling should happen directly after each call to PyUnicode_FromStringAndSize:
|
string1 = PyUnicode_FromStringAndSize((const char*)text1_data, text1_length); |
|
string2 = PyUnicode_FromStringAndSize((const char*)text2_data, text2_length); |
|
|
|
if (!string1 || !string2) { |
|
goto finally; /* failed to allocate strings */ |
|
} |
Other cases where error handling is not done immediately after the API has been used:
I might have missed some; I did not do a complete audit yet.
Linked PRs
Activityerlend-aasland commented on Jun 6, 2023 Author show commentMore actions changed the title [-]Incorrect error handling in sqlite3 collation callback[/-] [+]Missing error handling for APIs that can raise exceptions[/+] on Jun 7, 2023changed the title [-]Missing error handling for APIs that can raise exceptions[/-] [+]Incorrect error handling for APIs that can raise exceptions[/+] on Jun 7, 2023
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|