| 1993 | private: |
| 1994 | template <typename T> |
| 1995 | arg_v(arg &&base, T &&x, const char *descr = nullptr) |
| 1996 | : arg(base), value(reinterpret_steal<object>(detail::make_caster<T>::cast( |
| 1997 | std::forward<T>(x), return_value_policy::automatic, {}))), |
| 1998 | descr(descr) |
| 1999 | #if defined(PYBIND11_DETAILED_ERROR_MESSAGES) |
| 2000 | , |
| 2001 | type(type_id<T>()) |
| 2002 | #endif |
| 2003 | { |
| 2004 | // Workaround! See: |
| 2005 | // https://github.com/pybind/pybind11/issues/2336 |
| 2006 | // https://github.com/pybind/pybind11/pull/2685#issuecomment-731286700 |
| 2007 | if (PyErr_Occurred()) { |
| 2008 | PyErr_Clear(); |
| 2009 | } |
| 2010 | } |
| 2011 | |
| 2012 | public: |
| 2013 | /// Direct construction with name, default, and description |