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 f91cdbe commit ddc2aaa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/pybind11/functional.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ struct type_caster<std::function<Return(Args...)>> {

std::cout << "BEFORE " << std::endl;
auto codeAttr
= reinterpret_borrow<object> (PyObject_GetAttrString(src.ptr(), "__code__"));
= reinterpret_borrow<object>(PyObject_GetAttrString(src.ptr(), "__code__"));
assert((static_cast<bool>(codeAttr)
== static_cast<bool>(PyObject_HasAttrString(src.ptr(), "__code__")))
&& "ptr and "
Expand All @@ -152,16 +152,16 @@ struct type_caster<std::function<Return(Args...)>> {
argCount = argCountFromFuncCode(codeAttr);
} else {
auto callAttr
= reinterpret_borrow<object> (PyObject_GetAttrString(src.ptr(), "__call__"));
= reinterpret_borrow<object>(PyObject_GetAttrString(src.ptr(), "__call__"));
assert((static_cast<bool>(callAttr)
== static_cast<bool>(PyObject_HasAttrString(src.ptr(), "__call__")))
&& "ptr and "
"HasAttrString "
"inconsistent for __call__");
if (static_cast<bool>(PyObject_HasAttrString(src.ptr(), "__call__"))) {
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 ddc2aaa

Please sign in to comment.