mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 07:02:11 +00:00
Changes extracted from pybind11k commit f8128f0b0d712c210d7d4470a50acc88dc4604ea (PR #30005)
This commit is contained in:
parent
48f25275c4
commit
edf03ccd34
@ -153,6 +153,7 @@ set(PYBIND11_HEADERS
|
||||
include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h
|
||||
include/pybind11/detail/init.h
|
||||
include/pybind11/detail/internals.h
|
||||
include/pybind11/detail/native_enum_data.h
|
||||
include/pybind11/detail/smart_holder_poc.h
|
||||
include/pybind11/detail/type_caster_base.h
|
||||
include/pybind11/detail/typeid.h
|
||||
@ -175,6 +176,7 @@ set(PYBIND11_HEADERS
|
||||
include/pybind11/gil_safe_call_once.h
|
||||
include/pybind11/iostream.h
|
||||
include/pybind11/functional.h
|
||||
include/pybind11/native_enum.h
|
||||
include/pybind11/numpy.h
|
||||
include/pybind11/operators.h
|
||||
include/pybind11/pybind11.h
|
||||
|
@ -553,3 +553,8 @@ The ``name`` property returns the name of the enum value as a unicode string.
|
||||
.. warning::
|
||||
|
||||
Contrary to Python customs, enum values from the wrappers should not be compared using ``is``, but with ``==`` (see `#1177 <https://github.com/pybind/pybind11/issues/1177>`_ for background).
|
||||
|
||||
.. note::
|
||||
|
||||
``py::native_enum`` was added as an alternative to ``py::enum_``
|
||||
with http://github.com/pybind/pybind11/pull/9999
|
||||
|
@ -48,6 +48,9 @@ PYBIND11_NAMESPACE_BEGIN(detail)
|
||||
class args_proxy;
|
||||
bool isinstance_generic(handle obj, const std::type_info &tp);
|
||||
|
||||
template <typename T>
|
||||
bool isinstance_native_enum(handle obj, const std::type_info &tp);
|
||||
|
||||
// Accessor forward declarations
|
||||
template <typename Policy>
|
||||
class accessor;
|
||||
@ -845,7 +848,8 @@ bool isinstance(handle obj) {
|
||||
|
||||
template <typename T, detail::enable_if_t<!std::is_base_of<object, T>::value, int> = 0>
|
||||
bool isinstance(handle obj) {
|
||||
return detail::isinstance_generic(obj, typeid(T));
|
||||
return detail::isinstance_native_enum<T>(obj, typeid(T))
|
||||
|| detail::isinstance_generic(obj, typeid(T));
|
||||
}
|
||||
|
||||
template <>
|
||||
|
@ -162,6 +162,7 @@ set(PYBIND11_TEST_FILES
|
||||
test_methods_and_attributes
|
||||
test_modules
|
||||
test_multiple_inheritance
|
||||
test_native_enum
|
||||
test_numpy_array
|
||||
test_numpy_dtypes
|
||||
test_numpy_vectorize
|
||||
|
@ -39,6 +39,7 @@ main_headers = {
|
||||
"include/pybind11/gil.h",
|
||||
"include/pybind11/gil_safe_call_once.h",
|
||||
"include/pybind11/iostream.h",
|
||||
"include/pybind11/native_enum.h",
|
||||
"include/pybind11/numpy.h",
|
||||
"include/pybind11/operators.h",
|
||||
"include/pybind11/options.h",
|
||||
@ -59,6 +60,7 @@ detail_headers = {
|
||||
"include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h",
|
||||
"include/pybind11/detail/init.h",
|
||||
"include/pybind11/detail/internals.h",
|
||||
"include/pybind11/detail/native_enum_data.h",
|
||||
"include/pybind11/detail/smart_holder_poc.h",
|
||||
"include/pybind11/detail/type_caster_base.h",
|
||||
"include/pybind11/detail/typeid.h",
|
||||
|
Loading…
Reference in New Issue
Block a user