-
Hi there! While studying the implementation of implicit conversions (in PyObject *args[2] = { nullptr, src };
result = PyObject_Vectorcall((PyObject *) dst_type->type_py, args + 1,
NB_VECTORCALL_ARGUMENTS_OFFSET + 1, nullptr); When I was reading the docs, I also noticed that there is a convenience method So I'm left with this feeling that the nanobind call in nb_type is intentionally using So I'm wondering if there's any current reason to use Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @tjstum. The code that you see right now is the result of quite a bit of evolution, and initially |
Beta Was this translation helpful? Give feedback.
Hi @tjstum. The code that you see right now is the result of quite a bit of evolution, and initially
PyObject_CallOneArg
was not used because it's unavailable on Python 3.8 (before the ifdef you mentioned was added). Looking at the implementation ofPyObject_CallOneArg
in CPython, I don't think there is a performance advantage over just directly usingPyObject_VectorCall
. This explains why it was not changed at some point.