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

Add pybind11::bytearray #2799

Merged
merged 15 commits into from
Feb 14, 2021
Merged

Add pybind11::bytearray #2799

merged 15 commits into from
Feb 14, 2021

Conversation

in42
Copy link
Contributor

@in42 in42 commented Jan 16, 2021

Description

Implement #2523

Suggested changelog entry:

Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.

@in42 in42 changed the title Add pybind11::bytearray [WIP] Add pybind11::bytearray Jan 16, 2021
@YannickJadoul
Copy link
Collaborator

Nice; thanks! This is still "[WIP]", I see, but just ping me whenever you're ready for review :-)

I guess we'd need a few more useful methods, and of course some tests (test_pytypes.{cpp,py} is probably where you want to add a few things ;-) )

@in42
Copy link
Contributor Author

in42 commented Jan 18, 2021

Nice; thanks! This is still "[WIP]", I see, but just ping me whenever you're ready for review :-)

I guess we'd need a few more useful methods, and of course some tests (test_pytypes.{cpp,py} is probably where you want to add a few things ;-) )

Hi, I have added tests and few more methods. Can you review the patch? I am especially not sure if I have added the tests correctly or not.

@in42 in42 changed the title [WIP] Add pybind11::bytearray [RFC] Add pybind11::bytearray Jan 18, 2021
@in42
Copy link
Contributor Author

in42 commented Jan 18, 2021

Nice; thanks! This is still "[WIP]", I see, but just ping me whenever you're ready for review :-)

I guess we'd need a few more useful methods, and of course some tests (test_pytypes.{cpp,py} is probably where you want to add a few things ;-) )

Also do I need to add to the documentation?

Comment on lines 1082 to 1083
char *buffer = PyByteArray_AsString(m_ptr);
return std::string(buffer);
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Get the size as well, with PyByteArray_GET_SIZE, because std::string{buffer, size} is more efficient.
  2. Do we need to free(buffer) after passing it off to the string?
  3. Can PyByteArray_AsString() ever return NULL? Perhaps we need to guard against it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Done
  2. I don't think we need to free the buffer since PyByteArray_AsString is not allocating anything it is just returning a pointer to already allocated bytearray as far as I understand.
  3. PyByteArray_AsString() will return NULL only if m_ptr which it will never be as it is checked in the constructor. So in fact I am now using macro versions of the methods as documented here: https://docs.python.org/3/c-api/bytearray.html which do not check if m_ptr is NULL.

YannickJadoul
YannickJadoul previously approved these changes Jan 20, 2021
Copy link
Collaborator

@YannickJadoul YannickJadoul left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for this :-)

Possibly useful functions (mostly stolen from https://docs.python.org/3/c-api/bytearray.html):

  • char *get() and/or operator char*()? I think this wouldn't copy, like string does, and would allow to change the contents? Maybe that's a reason to not want this, though.
  • size_t size(); this seems potentially useful.
  • bytesarray concat(bytesarray): PyByteArray_Concat exists. Not sure how useful it would be, though? Not crucial to have, afaic.
  • resize: PyByteArray_Resize exists.
  • Something to assign and change the contents of the bytearray? I thought that was the whole point of a bytearray, being a mutable bytes? @bstaletic, any thoughts?

include/pybind11/pytypes.h Outdated Show resolved Hide resolved
include/pybind11/pytypes.h Outdated Show resolved Hide resolved
include/pybind11/pytypes.h Show resolved Hide resolved
include/pybind11/pytypes.h Outdated Show resolved Hide resolved
@YannickJadoul YannickJadoul self-requested a review January 20, 2021 23:07
Copy link
Collaborator

@YannickJadoul YannickJadoul left a comment

Choose a reason for hiding this comment

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

(Whoops, sorry; didn't mean to approve yet. I definitely will, but there's a few more things to resolve.)

What a mess. Apologies, @in42.

@YannickJadoul YannickJadoul self-requested a review January 20, 2021 23:08
@YannickJadoul YannickJadoul dismissed their stale review January 20, 2021 23:10

Didn't mean to approve

Copy link
Collaborator

@bstaletic bstaletic left a comment

Choose a reason for hiding this comment

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

char get() and/or operator char()? I think this wouldn't copy, like string does, and would allow to change the contents? Maybe that's a reason to not want this, though

data()? That would be in line with STL.

size_t size(); this seems potentially useful.

Agreed.

bytesarray concat(bytesarray): PyByteArray_Concat exists. Not sure how useful it would be, though? Not crucial to have, afaic.

operator+=()?

resize: PyByteArray_Resize exists.

Agreed.

Something to assign and change the contents of the bytearray? I thought that was the whole point of a bytearray, being a mutable bytes? @bstaletic, any thoughts?

operator[](ssize_t)?

With all the overloaded operators, it would actually feel like a C++ type.

include/pybind11/pytypes.h Show resolved Hide resolved
@YannickJadoul
Copy link
Collaborator

With all the overloaded operators, it would actually feel like a C++ type.

That's true, yes! Of course, that's also up to @in42. I'm not saying this needs to per se go into this PR in order for this PR to be useful. So up to @in42 to judge what could still go in?

operator[](ssize_t)?

Hmm, there's no dedicated C API for this, is there? So this might already be supported (though slow, since there's no C API) through inheritance from object_api<T>?

@bstaletic
Copy link
Collaborator

Hmm, there's no dedicated C API for this, is there? So this might already be supported (though slow, since there's no C API) through inheritance from object_api?

I'd actually be surprised that the generic PyObject_GetAttrString() would work here. Also, operator[](ssize_t) could be accompanied with at(ssize_t), matching STL containers.

That's true, yes! Of course, that's also up to @in42. I'm not saying this needs to per se go into this PR in order for this PR to be useful. So up to @in42 to judge what could still go in?

Fair enough.

@in42
Copy link
Contributor Author

in42 commented Jan 26, 2021

Nice! Thanks for this :-)

Possibly useful functions (mostly stolen from https://docs.python.org/3/c-api/bytearray.html):

  • char *get() and/or operator char*()? I think this wouldn't copy, like string does, and would allow to change the contents? Maybe that's a reason to not want this, though.
  • size_t size(); this seems potentially useful.
  • bytesarray concat(bytesarray): PyByteArray_Concat exists. Not sure how useful it would be, though? Not crucial to have, afaic.
  • resize: PyByteArray_Resize exists.
  • Something to assign and change the contents of the bytearray? I thought that was the whole point of a bytearray, being a mutable bytes? @bstaletic, any thoughts?

I will add the additional methods - but I remember seeing for pybind11::bytes, these methods were not defined. Is there any reason why they were not implemented for pybind11::bytes?

@bstaletic
Copy link
Collaborator

A few possible reasons:

  • Nobody requested it before. Simple omission.
  • It was postponed for "later".
  • bytes being immutable, it's worth taking a second look at whether CharT& operator[](size_t); is a good idea.

@YannickJadoul
Copy link
Collaborator

@in42, if you don't see a use for it, you don't have to ofc, as I suggested. But as far as I can tell, it could be useful. Especially so for bytearray, as it's a mutable structure.

@in42 in42 changed the title [RFC] Add pybind11::bytearray [WIP] Add pybind11::bytearray Feb 5, 2021
@YannickJadoul YannickJadoul added this to the v2.7 milestone Feb 13, 2021
Copy link
Collaborator

@YannickJadoul YannickJadoul left a comment

Choose a reason for hiding this comment

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

One more implicit conversion remark. I'm reasonably confident @bstaletic will feel the same about this?

include/pybind11/pytypes.h Outdated Show resolved Hide resolved
@bstaletic
Copy link
Collaborator

Final thought: commit history is a mess here. There are at least three empty commits and none of the 14 commits suggests that it has anything to do with py::bytearray.

@in42
Copy link
Contributor Author

in42 commented Feb 14, 2021

Final thought: commit history is a mess here. There are at least three empty commits and none of the 14 commits suggests that it has anything to do with py::bytearray.

I am little unfamiliar with how changes are merged using a pull request. Aren't you supposed to squash the commits and merge them in a single commit? Otherwise I can rebase my changes in a single commit but the discussions will probably be lost then.

I am more familiar with the gerrit model.

@YannickJadoul
Copy link
Collaborator

@bstaletic, the pybind11 GitHub project will squash anyway, and use the title of this PR, I believe. So we should be fine?

@bstaletic
Copy link
Collaborator

Alright, if @YannickJadoul says not to worry about history, fine by me.

@YannickJadoul YannickJadoul changed the title [WIP] Add pybind11::bytearray Add pybind11::bytearray Feb 14, 2021
@YannickJadoul
Copy link
Collaborator

It's been long enough, and both @bstaletic and I approved. Thanks for holding on and making the PR, @in42! :-)

@YannickJadoul YannickJadoul merged commit 417067e into pybind:master Feb 14, 2021
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Feb 14, 2021
@in42 in42 deleted the bytearray branch February 14, 2021 17:33
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Jul 13, 2021
kraj referenced this pull request in YoeDistro/meta-openembedded Jul 26, 2021
v2.7.0 (Jul 16, 2021)
---------------------

New features:

* Enable ``py::implicitly_convertible<py::none, ...>`` for
  ``py::class_``-wrapped types.
  `#3059 <https://github.com/pybind/pybind11/pull/3059>`_

* Allow function pointer extraction from overloaded functions.
  `#2944 <https://github.com/pybind/pybind11/pull/2944>`_

* NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  result, which also distinguishes types by bit length (unlike ``.kind()``).
  `#2864 <https://github.com/pybind/pybind11/pull/2864>`_

* Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  `#2799 <https://github.com/pybind/pybind11/pull/2799>`_

* ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  ``os.PathLike`` to ``std::filesystem::path``.
  `#2730 <https://github.com/pybind/pybind11/pull/2730>`_

* A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  `#3120 <https://github.com/pybind/pybind11/pull/3120>`_

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj referenced this pull request in YoeDistro/meta-openembedded Jul 26, 2021
v2.7.0 (Jul 16, 2021)
---------------------

New features:

* Enable ``py::implicitly_convertible<py::none, ...>`` for
  ``py::class_``-wrapped types.
  `#3059 <https://github.com/pybind/pybind11/pull/3059>`_

* Allow function pointer extraction from overloaded functions.
  `#2944 <https://github.com/pybind/pybind11/pull/2944>`_

* NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  result, which also distinguishes types by bit length (unlike ``.kind()``).
  `#2864 <https://github.com/pybind/pybind11/pull/2864>`_

* Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  `#2799 <https://github.com/pybind/pybind11/pull/2799>`_

* ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  ``os.PathLike`` to ``std::filesystem::path``.
  `#2730 <https://github.com/pybind/pybind11/pull/2730>`_

* A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  `#3120 <https://github.com/pybind/pybind11/pull/3120>`_

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
@crimsoncor
Copy link
Contributor

great feature. I'm actually making use of it today. But it isn't documented anywhere. I was able to go through the PR and the source to figure out how to use it, but should probably be added to the documentation

kraj referenced this pull request in YoeDistro/meta-openembedded Jul 27, 2021
v2.7.0 (Jul 16, 2021)
---------------------

New features:

* Enable ``py::implicitly_convertible<py::none, ...>`` for
  ``py::class_``-wrapped types.
  `#3059 <https://github.com/pybind/pybind11/pull/3059>`_

* Allow function pointer extraction from overloaded functions.
  `#2944 <https://github.com/pybind/pybind11/pull/2944>`_

* NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  result, which also distinguishes types by bit length (unlike ``.kind()``).
  `#2864 <https://github.com/pybind/pybind11/pull/2864>`_

* Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  `#2799 <https://github.com/pybind/pybind11/pull/2799>`_

* ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  ``os.PathLike`` to ``std::filesystem::path``.
  `#2730 <https://github.com/pybind/pybind11/pull/2730>`_

* A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  `#3120 <https://github.com/pybind/pybind11/pull/3120>`_

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj referenced this pull request in YoeDistro/meta-openembedded Jul 27, 2021
v2.7.0 (Jul 16, 2021)
---------------------

New features:

* Enable ``py::implicitly_convertible<py::none, ...>`` for
  ``py::class_``-wrapped types.
  `#3059 <https://github.com/pybind/pybind11/pull/3059>`_

* Allow function pointer extraction from overloaded functions.
  `#2944 <https://github.com/pybind/pybind11/pull/2944>`_

* NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  result, which also distinguishes types by bit length (unlike ``.kind()``).
  `#2864 <https://github.com/pybind/pybind11/pull/2864>`_

* Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  `#2799 <https://github.com/pybind/pybind11/pull/2799>`_

* ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  ``os.PathLike`` to ``std::filesystem::path``.
  `#2730 <https://github.com/pybind/pybind11/pull/2730>`_

* A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  `#3120 <https://github.com/pybind/pybind11/pull/3120>`_

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj referenced this pull request in YoeDistro/meta-openembedded Jul 28, 2021
v2.7.0 (Jul 16, 2021)
---------------------

New features:

* Enable ``py::implicitly_convertible<py::none, ...>`` for
  ``py::class_``-wrapped types.
  `#3059 <https://github.com/pybind/pybind11/pull/3059>`_

* Allow function pointer extraction from overloaded functions.
  `#2944 <https://github.com/pybind/pybind11/pull/2944>`_

* NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  result, which also distinguishes types by bit length (unlike ``.kind()``).
  `#2864 <https://github.com/pybind/pybind11/pull/2864>`_

* Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  `#2799 <https://github.com/pybind/pybind11/pull/2799>`_

* ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  ``os.PathLike`` to ``std::filesystem::path``.
  `#2730 <https://github.com/pybind/pybind11/pull/2730>`_

* A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  `#3120 <https://github.com/pybind/pybind11/pull/3120>`_

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj referenced this pull request in YoeDistro/meta-openembedded Jul 28, 2021
v2.7.0 (Jul 16, 2021)
---------------------

New features:

* Enable ``py::implicitly_convertible<py::none, ...>`` for
  ``py::class_``-wrapped types.
  `#3059 <https://github.com/pybind/pybind11/pull/3059>`_

* Allow function pointer extraction from overloaded functions.
  `#2944 <https://github.com/pybind/pybind11/pull/2944>`_

* NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  result, which also distinguishes types by bit length (unlike ``.kind()``).
  `#2864 <https://github.com/pybind/pybind11/pull/2864>`_

* Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  `#2799 <https://github.com/pybind/pybind11/pull/2799>`_

* ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  ``os.PathLike`` to ``std::filesystem::path``.
  `#2730 <https://github.com/pybind/pybind11/pull/2730>`_

* A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  `#3120 <https://github.com/pybind/pybind11/pull/3120>`_

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj referenced this pull request in YoeDistro/meta-openembedded Jul 28, 2021
v2.7.0 (Jul 16, 2021)
---------------------

New features:

* Enable ``py::implicitly_convertible<py::none, ...>`` for
  ``py::class_``-wrapped types.
  `#3059 <https://github.com/pybind/pybind11/pull/3059>`_

* Allow function pointer extraction from overloaded functions.
  `#2944 <https://github.com/pybind/pybind11/pull/2944>`_

* NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  result, which also distinguishes types by bit length (unlike ``.kind()``).
  `#2864 <https://github.com/pybind/pybind11/pull/2864>`_

* Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  `#2799 <https://github.com/pybind/pybind11/pull/2799>`_

* ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  ``os.PathLike`` to ``std::filesystem::path``.
  `#2730 <https://github.com/pybind/pybind11/pull/2730>`_

* A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  `#3120 <https://github.com/pybind/pybind11/pull/3120>`_

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj referenced this pull request in YoeDistro/meta-openembedded Jul 29, 2021
v2.7.0 (Jul 16, 2021)
---------------------

New features:

* Enable ``py::implicitly_convertible<py::none, ...>`` for
  ``py::class_``-wrapped types.
  `#3059 <https://github.com/pybind/pybind11/pull/3059>`_

* Allow function pointer extraction from overloaded functions.
  `#2944 <https://github.com/pybind/pybind11/pull/2944>`_

* NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  result, which also distinguishes types by bit length (unlike ``.kind()``).
  `#2864 <https://github.com/pybind/pybind11/pull/2864>`_

* Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  `#2799 <https://github.com/pybind/pybind11/pull/2799>`_

* ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  ``os.PathLike`` to ``std::filesystem::path``.
  `#2730 <https://github.com/pybind/pybind11/pull/2730>`_

* A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  `#3120 <https://github.com/pybind/pybind11/pull/3120>`_

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj referenced this pull request in YoeDistro/meta-openembedded Jul 29, 2021
v2.7.0 (Jul 16, 2021)
---------------------

New features:

* Enable ``py::implicitly_convertible<py::none, ...>`` for
  ``py::class_``-wrapped types.
  `#3059 <https://github.com/pybind/pybind11/pull/3059>`_

* Allow function pointer extraction from overloaded functions.
  `#2944 <https://github.com/pybind/pybind11/pull/2944>`_

* NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  result, which also distinguishes types by bit length (unlike ``.kind()``).
  `#2864 <https://github.com/pybind/pybind11/pull/2864>`_

* Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  `#2799 <https://github.com/pybind/pybind11/pull/2799>`_

* ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  ``os.PathLike`` to ``std::filesystem::path``.
  `#2730 <https://github.com/pybind/pybind11/pull/2730>`_

* A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  `#3120 <https://github.com/pybind/pybind11/pull/3120>`_

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
@gatopeich
Copy link

Late to the party here, but it would be great to have an implicit conversion to string_view like bytes and str do.

@Skylion007
Copy link
Collaborator

@gatopeich PR welcome on this front.

daregit referenced this pull request in daregit/yocto-combined May 22, 2024
v2.7.0 (Jul 16, 2021)
---------------------

New features:

* Enable ``py::implicitly_convertible<py::none, ...>`` for
  ``py::class_``-wrapped types.
  `#3059 <https://github.com/pybind/pybind11/pull/3059>`_

* Allow function pointer extraction from overloaded functions.
  `#2944 <https://github.com/pybind/pybind11/pull/2944>`_

* NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  result, which also distinguishes types by bit length (unlike ``.kind()``).
  `#2864 <https://github.com/pybind/pybind11/pull/2864>`_

* Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  `#2799 <https://github.com/pybind/pybind11/pull/2799>`_

* ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  ``os.PathLike`` to ``std::filesystem::path``.
  `#2730 <https://github.com/pybind/pybind11/pull/2730>`_

* A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  `#3120 <https://github.com/pybind/pybind11/pull/3120>`_

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
daregit referenced this pull request in daregit/yocto-combined May 22, 2024
v2.7.0 (Jul 16, 2021)
---------------------

New features:

* Enable ``py::implicitly_convertible<py::none, ...>`` for
  ``py::class_``-wrapped types.
  `#3059 <https://github.com/pybind/pybind11/pull/3059>`_

* Allow function pointer extraction from overloaded functions.
  `#2944 <https://github.com/pybind/pybind11/pull/2944>`_

* NumPy: added ``.char_()`` to type which gives the NumPy public ``char``
  result, which also distinguishes types by bit length (unlike ``.kind()``).
  `#2864 <https://github.com/pybind/pybind11/pull/2864>`_

* Add ``pybind11::bytearray`` to manipulate ``bytearray`` similar to ``bytes``.
  `#2799 <https://github.com/pybind/pybind11/pull/2799>`_

* ``pybind11/stl/filesystem.h`` registers a type caster that, on C++17/Python
  3.6+, converts ``std::filesystem::path`` to ``pathlib.Path`` and any
  ``os.PathLike`` to ``std::filesystem::path``.
  `#2730 <https://github.com/pybind/pybind11/pull/2730>`_

* A ``PYBIND11_VERSION_HEX`` define was added, similar to ``PY_VERSION_HEX``.
  `#3120 <https://github.com/pybind/pybind11/pull/3120>`_

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
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.

7 participants