Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Aug 21, 2024
1 parent ef3acb4 commit d7f49dd
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions include/pybind11/functional.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,8 @@ struct type_caster<std::function<Return(Args...)>> {

std::cout << "BEFORE " << std::endl;
auto codeAttr
= reinterpret_borrow<object> (PyObject_GetAttrString(src.ptr(), "__code__"));
assert(((codeAttr)
== static_cast<bool>(PyObject_HasAttrString(src.ptr(), "__code__")))
= reinterpret_borrow<object>(PyObject_GetAttrString(src.ptr(), "__code__"));
assert(((codeAttr) == static_cast<bool>(PyObject_HasAttrString(src.ptr(), "__code__")))
&& "ptr and "
"HasAttrString "
"inconsistent for __code__");
Expand All @@ -152,16 +151,16 @@ struct type_caster<std::function<Return(Args...)>> {
argCount = argCountFromFuncCode(codeAttr);
} else {
auto callAttr
= reinterpret_borrow<object> (PyObject_GetAttrString(src.ptr(), "__call__"));
assert(
((callAttr)
== static_cast<bool>(PyObject_HasAttrString(src.ptr(), "__call__"))) && "ptr and "
"HasAttrString "
"inconsistent for __call__");
if (callAttr.ptr()!=nullptr) {
= reinterpret_borrow<object>(PyObject_GetAttrString(src.ptr(), "__call__"));
assert(((callAttr)
== static_cast<bool>(PyObject_HasAttrString(src.ptr(), "__call__")))
&& "ptr and "
"HasAttrString "
"inconsistent for __call__");
if (callAttr.ptr() != nullptr) {
std::cout << "__call__ exists" << std::endl;
auto codeAttr2 = reinterpret_borrow<object> (PyObject_GetAttrString(
callAttr.ptr(), "__code__"));
auto codeAttr2 = reinterpret_borrow<object>(
PyObject_GetAttrString(callAttr.ptr(), "__code__"));
argCount = argCountFromFuncCode(codeAttr2)
- 1; // we have to remove the self argument
} else {
Expand Down

0 comments on commit d7f49dd

Please sign in to comment.