Skip to content

Commit df048d1

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

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

include/pybind11/cast.h

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

18751880
public:
18761881
/// Direct construction with name, default, and description

0 commit comments

Comments
 (0)