mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-23 00:49:36 +00:00
Reviewer suggestions
This commit is contained in:
parent
bdcd95aa73
commit
225dbae67e
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -402,7 +402,8 @@ jobs:
|
||||
-DCMAKE_CXX_STANDARD=11 \
|
||||
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \
|
||||
-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
|
||||
- name: Build
|
||||
|
@ -469,22 +469,23 @@ PYBIND11_NOINLINE bool isinstance_generic(handle obj, const std::type_info &tp)
|
||||
return isinstance(obj, type);
|
||||
}
|
||||
|
||||
PYBIND11_NOINLINE std::string error_string(PyObject *type, PyObject *value, PyObject *trace) {
|
||||
if (!type) {
|
||||
PYBIND11_NOINLINE std::string
|
||||
error_string(PyObject *exc_type, PyObject *exc_value, PyObject *exc_trace) {
|
||||
if (!exc_type) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "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 += ": ";
|
||||
|
||||
if (value) {
|
||||
result += (std::string) str(value);
|
||||
if (exc_value) {
|
||||
result += (std::string) str(exc_value);
|
||||
}
|
||||
|
||||
if (trace) {
|
||||
if (exc_trace) {
|
||||
#if !defined(PYPY_VERSION)
|
||||
auto *tb = (PyTracebackObject *) trace;
|
||||
auto *tb = (PyTracebackObject *) exc_trace;
|
||||
|
||||
// Get the deepest trace possible.
|
||||
while (tb->tb_next) {
|
||||
@ -507,7 +508,7 @@ PYBIND11_NOINLINE std::string error_string(PyObject *type, PyObject *value, PyOb
|
||||
frame = frame->f_back;
|
||||
Py_DECREF(f_code);
|
||||
}
|
||||
#endif
|
||||
#endif //! defined(PYPY_VERSION)
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -517,9 +518,6 @@ PYBIND11_NOINLINE std::string error_string() {
|
||||
error_scope scope; // Preserve error state.
|
||||
if (scope.type) {
|
||||
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);
|
||||
}
|
||||
|
@ -387,9 +387,6 @@ public:
|
||||
PyErr_Fetch(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
|
||||
if (m_type) {
|
||||
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