Skip to content

What is nb_type_0? #439

Closed Answered by wjakob
zhqrbitee asked this question in Q&A
Mar 1, 2024 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

It is the nanobind metaclass. In other words, the class that constructs the Python type A when you call nb::class_<A>. It cannot be pickled, and I am not sure how it could be pickled. That's because we don't just have nb_type_0 -- it's part of a family of metaclasses nb_type_N that are created on demand based how how many extra bytes of storage N are required inside the type object. That extra storage could include arbitrary pointers that don't make sense across Python sessions. All of this is deep inside the C++ guts of nanobind and not accessible through normal Python code.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@wjakob
Comment options

@zhqrbitee
Comment options

@wjakob
Comment options

@zhqrbitee
Comment options

@wjakob
Comment options

Answer selected by zhqrbitee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants