Skip to content

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Feb 10, 2024

Things I've fixed:

  • A typo
  • There were several indentation issues (3 vs 4 spaces)
  • Errors were potentially swallowed (I know that this is unlikely, but only the last error was reported previously. Now the first one will be)

Copy link
Contributor

@ronaldoussoren ronaldoussoren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

PyStructSequence_SET_ITEM(v, 7,
PyLong_FromLongLong((long long) st.f_ffree));
PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) flags));
#define SET_ITEM(v, index, item) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sobolevn, the macro expansion of this will leak memory: item gets substituted as PyLong_FromLong, etc. at every occurrence, i.e.:

    do {
        if (PyLong_FromLong((long) st.f_iosize) == NULL) {
            Py_DECREF(v);
            return NULL;
        }
        PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long) st.f_iosize));
    } while (0)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, looks like you already figured it out 😊

@sobolevn
Copy link
Member Author

Fix: #115335

fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants