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

BUG: (probably) Should ensure that view->obj is set to NULL or at least unmodified #18672

Open
seberg opened this issue Mar 24, 2021 · 0 comments

Comments

@seberg
Copy link
Member

seberg commented Mar 24, 2021

The recent buffer changes mean that view->obj may be set even on error when exporting a buffer. Previously, we probably never set view->obj if an error occurred (I did not double check).

Technically, the Python documentation says we should NULL object, but de-facto not even Python does it, and any consumer should just not make assumption if the buffer export fails!

Python also has one (or two) code places that actually rely on view->len not being initialized on error, I think those should probably be fixed, but if someone wants to be particularly clean, we could just leave view->len uninitialized until after all possible errors are handled. (In most places handling errors up-front is easier anyway)

Note: I may look into some time (and it would be good to fix), but its also not super high priority, since we never NULL'ed object it seems very unlikely anyone relies on us not touching it... See also: https://bugs.python.org/issue43608

(I stumbled upon this randomly, because I missed an actual, absolutely harmless, reference count leak on our side...)

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

No branches or pull requests

1 participant