Skip to content

fix: add missing signature#2363

Merged
henryiii merged 2 commits into
pybind:masterfrom
henryiii:feat/missingsig
Aug 14, 2020
Merged

fix: add missing signature#2363
henryiii merged 2 commits into
pybind:masterfrom
henryiii:feat/missingsig

Conversation

@henryiii

@henryiii henryiii commented Aug 4, 2020

Copy link
Copy Markdown
Collaborator

All the other array constructors have an optional handle, but this one was missing.

@YannickJadoul

Copy link
Copy Markdown
Collaborator

I was about to say "Isn't that because it's a constructor from buffer_info?", but apparently buffer_info doesn't contain a base either? I'm not a buffer-protocol expert, though, so I don't know if it should be in there. If not, this seems fine.

Maybe do the same for the array_t constructor, though?

@henryiii

henryiii commented Aug 4, 2020

Copy link
Copy Markdown
Collaborator Author

@henryiii

henryiii commented Aug 4, 2020

Copy link
Copy Markdown
Collaborator Author

Someone told me when I found this a while back it was probably just an oversight, but I don't know where that conversation was.

@henryiii

henryiii commented Aug 4, 2020

Copy link
Copy Markdown
Collaborator Author

By the way, buffer info is information about the data, but it does not contain ownership information. The handle contains ownership information, so you can be sure the owning object is not destroyed while the array is still present. The other constructors support this, it's just missing from the direct buffer info constructor.

@YannickJadoul

Copy link
Copy Markdown
Collaborator

Alright; Py_buffer does contain a object field, but py::buffer_info doesn't. I don't know enough about the buffer protocol to assess the details of what should do what, but adding these optional base arguments to the signature seems fine to me!

@rwgk rwgk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me!
I spent a few minutes looking in the nump.h sources, this change seems super safe to me.

@henryiii
henryiii merged commit 2e2de8c into pybind:master Aug 14, 2020
@henryiii
henryiii deleted the feat/missingsig branch August 14, 2020 00:13
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

Successfully merging this pull request may close these issues.

3 participants