Skip to content

Commit 2b48df5

Browse files
committed
Workaround for pybind#2682 and pybind#2422 by simply clearing the TypeError
1 parent af8849f commit 2b48df5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

include/pybind11/cast.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,14 @@ struct arg_v : arg {
18701870
#if !defined(NDEBUG)
18711871
, type(type_id<T>())
18721872
#endif
1873-
{ }
1873+
{
1874+
// Workaround! See:
1875+
// https://github.com/pybind/pybind11/issues/2336
1876+
// https://github.com/pybind/pybind11/pull/2685#issuecomment-731286700
1877+
if (PyErr_Occurred()) {
1878+
PyErr_Clear();
1879+
}
1880+
}
18741881

18751882
public:
18761883
/// Direct construction with name, default, and description

0 commit comments

Comments
 (0)