Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle errors correctly in tmtotuple in timemodule #118998

Closed
sobolevn opened this issue May 13, 2024 · 0 comments
Closed

Handle errors correctly in tmtotuple in timemodule #118998

sobolevn opened this issue May 13, 2024 · 0 comments
Assignees
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented May 13, 2024

Bug report

This call is problematic:

#define SET(i,val) PyStructSequence_SET_ITEM(v, i, PyLong_FromLong((long) val))

It can return NULL in theory.

These calls also can return NULL:

This error guard in the end will only show the last error:

if (PyErr_Occurred()) {
Py_XDECREF(v);
return NULL;
}
Not the first one. Also: why XDECREF when v cannot be NULL at this point?

Refs #116714

I will send a PR adding our regular macro for the job.

Linked PRs

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error extension-modules C modules in the Modules dir labels May 13, 2024
@sobolevn sobolevn self-assigned this May 13, 2024
sobolevn added a commit to sobolevn/cpython that referenced this issue May 13, 2024
sobolevn added a commit to sobolevn/cpython that referenced this issue May 13, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 13, 2024
…e` (pythonGH-118999)

(cherry picked from commit fc75792)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 13, 2024
…e` (pythonGH-118999)

(cherry picked from commit fc75792)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
sobolevn added a commit that referenced this issue May 13, 2024
…le` (GH-118999) (#119018)

gh-118998: Handle errors correctly in `tmtotuple` in `timemodule` (GH-118999)
(cherry picked from commit fc75792)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
sobolevn added a commit that referenced this issue May 13, 2024
…le` (GH-118999) (#119019)

gh-118998: Handle errors correctly in `tmtotuple` in `timemodule` (GH-118999)
(cherry picked from commit fc75792)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant