Go to the source code of this file.
Classes | |
struct | internals |
struct | local_internals |
struct | override_hash |
struct | type_equal_to |
struct | type_hash |
struct | type_info |
Macros | |
#define | PYBIND11_BUILD_ABI "" |
On Linux/OSX, changes in GXX_ABI_VERSION indicate ABI incompatibility. More... | |
#define | PYBIND11_BUILD_TYPE "" |
On MSVC, debug and release builds are not ABI-compatible! More... | |
#define | PYBIND11_COMPILER_TYPE "_unknown" |
#define | PYBIND11_INTERNALS_ID |
#define | PYBIND11_INTERNALS_KIND "_without_thread" |
#define | PYBIND11_INTERNALS_VERSION 4 |
#define | PYBIND11_MODULE_LOCAL_ID |
#define | PYBIND11_STDLIB "" |
Also standard libs. More... | |
#define | PYBIND11_TLS_DELETE_VALUE(key) PyThread_set_key_value((key), nullptr) |
#define | PYBIND11_TLS_FREE(key) (void) key |
#define | PYBIND11_TLS_GET_VALUE(key) PyThread_get_key_value((key)) |
#define | PYBIND11_TLS_KEY_CREATE(var) (((var) = PyThread_create_key()) != -1) |
#define | PYBIND11_TLS_KEY_INIT(var) PYBIND11_TLS_KEY_REF var = 0; |
#define | PYBIND11_TLS_KEY_REF decltype(PyThread_create_key()) |
#define | PYBIND11_TLS_REPLACE_VALUE(key, value) PyThread_set_key_value((key), (value)) |
Typedefs | |
using | ExceptionTranslator = void(*)(std::exception_ptr) |
template<typename value_type > | |
using | type_map = std::unordered_map< std::type_index, value_type, type_hash, type_equal_to > |
Functions | |
template<typename... Args> | |
const char * | c_str (Args &&...args) |
const char * | get_function_record_capsule_name () |
PYBIND11_NOINLINE internals & | get_internals () |
Return a reference to the current internals data. More... | |
object | get_internals_obj_from_state_dict (handle state_dict) |
internals **& | get_internals_pp () |
internals ** | get_internals_pp_from_capsule (handle obj) |
local_internals & | get_local_internals () |
Works like get_internals , but for things which are locally registered. More... | |
template<typename T > | |
T & | get_or_create_shared_data (const std::string &name) |
object | get_python_state_dict () |
PYBIND11_NOINLINE void * | get_shared_data (const std::string &name) |
template<class T , enable_if_t< std::is_same< std::nested_exception, remove_cvref_t< T >>::value, int > = 0> | |
bool | handle_nested_exception (const T &exc, const std::exception_ptr &p) |
bool | is_function_record_capsule (const capsule &cap) |
PyTypeObject * | make_default_metaclass () |
PyObject * | make_object_base_type (PyTypeObject *metaclass) |
PyTypeObject * | make_static_property_type () |
bool | raise_err (PyObject *exc_type, const char *msg) |
bool | same_type (const std::type_info &lhs, const std::type_info &rhs) |
PYBIND11_NOINLINE void * | set_shared_data (const std::string &name, void *data) |
Set the shared data that can be later recovered by get_shared_data() . More... | |
void | translate_exception (std::exception_ptr) |
void | translate_local_exception (std::exception_ptr p) |
Variables | |
constexpr const char * | internals_function_record_capsule_name = "pybind11_function_record_capsule" |
#define PYBIND11_BUILD_ABI "" |
On Linux/OSX, changes in GXX_ABI_VERSION indicate ABI incompatibility.
Definition at line 298 of file internals.h.
#define PYBIND11_BUILD_TYPE "" |
On MSVC, debug and release builds are not ABI-compatible!
Definition at line 256 of file internals.h.
#define PYBIND11_COMPILER_TYPE "_unknown" |
Let's assume that different compilers are ABI-incompatible. A user can manually set this string if they know their compiler is compatible.
Definition at line 278 of file internals.h.
#define PYBIND11_INTERNALS_ID |
Definition at line 310 of file internals.h.
#define PYBIND11_INTERNALS_KIND "_without_thread" |
Definition at line 306 of file internals.h.
#define PYBIND11_INTERNALS_VERSION 4 |
Tracks the internals
and type_info
ABI version independent of the main library version.
Some portions of the code use an ABI that is conditional depending on this version number. That allows ABI-breaking changes to be "pre-implemented". Once the default version number is incremented, the conditional logic that no longer applies can be removed. Additionally, users that need not maintain ABI compatibility can increase the version number in order to take advantage of any functionality/efficiency improvements that depend on the newer ABI.
WARNING: If you choose to manually increase the ABI version, note that pybind11 may not be tested as thoroughly with a non-default ABI version, and further ABI-incompatible changes may be made before the ABI is officially changed to the new version.
Definition at line 41 of file internals.h.
#define PYBIND11_MODULE_LOCAL_ID |
Definition at line 315 of file internals.h.
#define PYBIND11_STDLIB "" |
Also standard libs.
Definition at line 289 of file internals.h.
Definition at line 114 of file internals.h.
Definition at line 117 of file internals.h.
Definition at line 101 of file internals.h.
#define PYBIND11_TLS_KEY_CREATE | ( | var | ) | (((var) = PyThread_create_key()) != -1) |
Definition at line 100 of file internals.h.
#define PYBIND11_TLS_KEY_INIT | ( | var | ) | PYBIND11_TLS_KEY_REF var = 0; |
Definition at line 99 of file internals.h.
#define PYBIND11_TLS_KEY_REF decltype(PyThread_create_key()) |
Definition at line 98 of file internals.h.
Definition at line 115 of file internals.h.
using ExceptionTranslator = void (*)(std::exception_ptr) |
Definition at line 51 of file internals.h.
using type_map = std::unordered_map<std::type_index, value_type, type_hash, type_equal_to> |
Definition at line 155 of file internals.h.
const char* c_str | ( | Args &&... | args | ) |
Constructs a std::string with the given arguments, stores it in internals
, and returns its c_str()
. Such strings objects have a long storage duration – the internal strings are only cleared when the program exits or after interpreter shutdown (when embedding), and so are suitable for c-style strings needed by Python internals (such as PyTypeObject's tp_name).
Definition at line 599 of file internals.h.
|
inline |
Definition at line 605 of file internals.h.
PYBIND11_NOINLINE internals& get_internals | ( | ) |
Return a reference to the current internals
data.
Definition at line 467 of file internals.h.
Definition at line 454 of file internals.h.
|
inline |
Each module locally stores a pointer to the internals
data. The data itself is shared among modules with the same PYBIND11_INTERNALS_ID
.
Definition at line 322 of file internals.h.
Definition at line 458 of file internals.h.
|
inline |
Works like get_internals
, but for things which are locally registered.
Definition at line 584 of file internals.h.
T& get_or_create_shared_data | ( | const std::string & | name | ) |
Returns a typed reference to a shared data entry (by using get_shared_data()
) if such entry exists. Otherwise, a new object of default-constructible type T
is added to the shared data under the given name and a reference to it is returned.
Definition at line 645 of file internals.h.
|
inline |
Definition at line 434 of file internals.h.
PYBIND11_NOINLINE void* get_shared_data | ( | const std::string & | name | ) |
Returns a named pointer that is shared among all extension modules (using the same pybind11 version) running in the current interpreter. Names starting with underscores are reserved for internal usage. Returns nullptr
if no matching entry was found.
Definition at line 629 of file internals.h.
bool handle_nested_exception | ( | const T & | exc, |
const std::exception_ptr & | p | ||
) |
Definition at line 332 of file internals.h.
|
inline |
Definition at line 619 of file internals.h.
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 350 of file internals.h.
|
inline |
Definition at line 132 of file internals.h.
PYBIND11_NOINLINE void* set_shared_data | ( | const std::string & | name, |
void * | data | ||
) |
Set the shared data that can be later recovered by get_shared_data()
.
Definition at line 636 of file internals.h.
|
inline |
Definition at line 359 of file internals.h.
|
inline |
Definition at line 419 of file internals.h.
|
constexpr |
Definition at line 55 of file internals.h.