mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-23 17:09:27 +00:00
Reviewer suggestions
This commit is contained in:
parent
bdcd95aa73
commit
225dbae67e
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@ -403,6 +403,7 @@ jobs:
|
|||||||
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \
|
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \
|
||||||
-DCMAKE_CXX_FLAGS="-Wc,--pending_instantiations=0" \
|
-DCMAKE_CXX_FLAGS="-Wc,--pending_instantiations=0" \
|
||||||
-DPYBIND11_TEST_FILTER="test_smart_ptr.cpp;test_virtual_functions.cpp" \
|
-DPYBIND11_TEST_FILTER="test_smart_ptr.cpp;test_virtual_functions.cpp" \
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug
|
||||||
|
|
||||||
# Building before installing Pip should produce a warning but not an error
|
# Building before installing Pip should produce a warning but not an error
|
||||||
- name: Build
|
- name: Build
|
||||||
|
@ -469,22 +469,23 @@ PYBIND11_NOINLINE bool isinstance_generic(handle obj, const std::type_info &tp)
|
|||||||
return isinstance(obj, type);
|
return isinstance(obj, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
PYBIND11_NOINLINE std::string error_string(PyObject *type, PyObject *value, PyObject *trace) {
|
PYBIND11_NOINLINE std::string
|
||||||
if (!type) {
|
error_string(PyObject *exc_type, PyObject *exc_value, PyObject *exc_trace) {
|
||||||
|
if (!exc_type) {
|
||||||
PyErr_SetString(PyExc_RuntimeError, "Unknown internal error occurred");
|
PyErr_SetString(PyExc_RuntimeError, "Unknown internal error occurred");
|
||||||
return "Unknown internal error occurred";
|
return "Unknown internal error occurred";
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = handle(type).attr("__name__").cast<std::string>();
|
auto result = handle(exc_type).attr("__name__").cast<std::string>();
|
||||||
result += ": ";
|
result += ": ";
|
||||||
|
|
||||||
if (value) {
|
if (exc_value) {
|
||||||
result += (std::string) str(value);
|
result += (std::string) str(exc_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trace) {
|
if (exc_trace) {
|
||||||
#if !defined(PYPY_VERSION)
|
#if !defined(PYPY_VERSION)
|
||||||
auto *tb = (PyTracebackObject *) trace;
|
auto *tb = (PyTracebackObject *) exc_trace;
|
||||||
|
|
||||||
// Get the deepest trace possible.
|
// Get the deepest trace possible.
|
||||||
while (tb->tb_next) {
|
while (tb->tb_next) {
|
||||||
@ -507,7 +508,7 @@ PYBIND11_NOINLINE std::string error_string(PyObject *type, PyObject *value, PyOb
|
|||||||
frame = frame->f_back;
|
frame = frame->f_back;
|
||||||
Py_DECREF(f_code);
|
Py_DECREF(f_code);
|
||||||
}
|
}
|
||||||
#endif
|
#endif //! defined(PYPY_VERSION)
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -517,9 +518,6 @@ PYBIND11_NOINLINE std::string error_string() {
|
|||||||
error_scope scope; // Preserve error state.
|
error_scope scope; // Preserve error state.
|
||||||
if (scope.type) {
|
if (scope.type) {
|
||||||
PyErr_NormalizeException(&scope.type, &scope.value, &scope.trace);
|
PyErr_NormalizeException(&scope.type, &scope.value, &scope.trace);
|
||||||
/*if (scope.trace != nullptr){
|
|
||||||
PyErr_SetTraceback(scope.value, scope.trace);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
return error_string(scope.type, scope.value, scope.trace);
|
return error_string(scope.type, scope.value, scope.trace);
|
||||||
}
|
}
|
||||||
|
@ -387,9 +387,6 @@ public:
|
|||||||
PyErr_Fetch(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
|
PyErr_Fetch(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
|
||||||
if (m_type) {
|
if (m_type) {
|
||||||
PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
|
PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
|
||||||
/*if (m_trace) {
|
|
||||||
PyException_SetTraceback(m_value.ptr(), m_trace.ptr());
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user