Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
e72d958a
Commit
e72d958a
authored
Nov 24, 2016
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
detail::error_string: handle call stacks that switch between C++ and Python multiple times
parent
fbec17ce
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
include/pybind11/cast.h
+13
-3
No files found.
include/pybind11/cast.h
View file @
e72d958a
...
@@ -136,9 +136,19 @@ PYBIND11_NOINLINE inline std::string error_string() {
...
@@ -136,9 +136,19 @@ PYBIND11_NOINLINE inline std::string error_string() {
PyErr_NormalizeException
(
&
scope
.
type
,
&
scope
.
value
,
&
scope
.
trace
);
PyErr_NormalizeException
(
&
scope
.
type
,
&
scope
.
value
,
&
scope
.
trace
);
#if PY_MAJOR_VERSION >= 3
if
(
scope
.
trace
!=
nullptr
)
PyException_SetTraceback
(
scope
.
value
,
scope
.
trace
);
#endif
if
(
scope
.
trace
)
{
if
(
scope
.
trace
)
{
PyFrameObject
*
frame
=
((
PyTracebackObject
*
)
scope
.
trace
)
->
tb_frame
;
PyTracebackObject
*
trace
=
(
PyTracebackObject
*
)
scope
.
trace
;
if
(
frame
)
{
/* Get the deepest trace possible */
while
(
trace
->
tb_next
)
trace
=
trace
->
tb_next
;
PyFrameObject
*
frame
=
trace
->
tb_frame
;
errorString
+=
"
\n\n
At:
\n
"
;
errorString
+=
"
\n\n
At:
\n
"
;
while
(
frame
)
{
while
(
frame
)
{
int
lineno
=
PyFrame_GetLineNumber
(
frame
);
int
lineno
=
PyFrame_GetLineNumber
(
frame
);
...
@@ -148,7 +158,7 @@ PYBIND11_NOINLINE inline std::string error_string() {
...
@@ -148,7 +158,7 @@ PYBIND11_NOINLINE inline std::string error_string() {
handle
(
frame
->
f_code
->
co_name
).
cast
<
std
::
string
>
()
+
"
\n
"
;
handle
(
frame
->
f_code
->
co_name
).
cast
<
std
::
string
>
()
+
"
\n
"
;
frame
=
frame
->
f_back
;
frame
=
frame
->
f_back
;
}
}
}
trace
=
trace
->
tb_next
;
}
}
return
errorString
;
return
errorString
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment