Skip to content

MAINT: remove undocumented __buffer__ attribute lookup#13049

Merged
charris merged 1 commit into
numpy:masterfrom
mattip:remove-buffer-check
Mar 4, 2019
Merged

MAINT: remove undocumented __buffer__ attribute lookup#13049
charris merged 1 commit into
numpy:masterfrom
mattip:remove-buffer-check

Conversation

@mattip

@mattip mattip commented Feb 26, 2019

Copy link
Copy Markdown
Member

If a python-level class defined the __buffer__ attribute, frombuffer(buf, ...) would assume it returns the instance as a buffer. This was undocumented and flaky: if the
__buffer__ attribute was a method it would not be called. I tried to search for where this was ever used and got back to the original numeric code, where once it was a method to be called, but elsewhere an attribute. This second use was preserved until today.

Since it is undocumented I do not think we need a deprecation cycle. Should this hit the mailing list?

@mhvk

mhvk commented Feb 27, 2019

Copy link
Copy Markdown
Contributor

It seems very reasonable to remove it; I guess a check on the mailing list is a good idea, just in case.

@charris

charris commented Mar 1, 2019

Copy link
Copy Markdown
Member

Should probably put something in the release notes too, maybe in Compatibility for reference and comment. Numarray isn't Numeric, both can be found on sourceforge and I don't see __buffer__ in Numeric, so it was something added by STScI. tp_as_buffer wasn't available in the very early Pythons, maybe that is why,

Comment thread doc/release/1.17.0-notes.rst Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@charris is this appropriate? Should it be in a different section?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would put it in the Compatibility notes section and just say that it was non-functional and removed. We don't expect anyone to notice in practice, but if they do, there it is.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

adopted

@mattip mattip force-pushed the remove-buffer-check branch from c8dd886 to acecd26 Compare March 3, 2019 09:30
@charris charris merged commit c2fbbb1 into numpy:master Mar 4, 2019
@charris

charris commented Mar 4, 2019

Copy link
Copy Markdown
Member

In it goes. Thanks Matti.

@mattip mattip deleted the remove-buffer-check branch June 8, 2020 06:58
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