Skip to content

Commit 4457195

Browse files
committed
docs: Add a note about calling Python C APIs on py::native_enum
1 parent c630e22 commit 4457195

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

docs/classes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,13 @@ The older ``py::enum_`` is not PEP 435 compatible
583583
but remains supported indefinitely for backward compatibility.
584584
New bindings should prefer ``py::native_enum``.
585585

586+
.. important::
587+
588+
The enum types created by ``py::native_enum`` are native Python types, while
589+
the enum types created by the older ``py::enum_`` are C++ pybind11 types.
590+
Developers **SHOULD NOT** call ``PyType_*`` Python C APIs on the enum types
591+
created by ``py:native_enum``.
592+
586593
.. note::
587594

588595
The deprecated ``py::enum_`` is :ref:`documented here <deprecated_enum>`.

0 commit comments

Comments
 (0)