Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Repr nullptr-check can never trigger #70

Closed
EinarElen opened this issue Sep 14, 2023 · 0 comments · Fixed by #72
Closed

Repr nullptr-check can never trigger #70

EinarElen opened this issue Sep 14, 2023 · 0 comments · Fixed by #72

Comments

@EinarElen
Copy link
Contributor

This minor bug was caught by clang's warnings.

std::string repr(PyObject* obj) {
PyObject* py_repr = PyObject_Repr(obj);
if (repr == nullptr) return "";
std::string str = getPyString(py_repr);
Py_XDECREF(py_repr);
return str;
}

We accidentally try to compare the repr function rather than the py_repr pointer, which ends up comparing with the address of the function which can never be null...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants