Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-87804: Fix error handling and style in _pystatvfs_fromstructstatfs #115236

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

Merged
merged 1 commit into from
Feb 12, 2024

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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.