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

Repr nullptr-check can never trigger #70

@EinarElen

Description

@EinarElen

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions