Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
22602c2e
Commit
22602c2e
authored
Apr 07, 2022
by
Jakub Kulík
Committed by
GitHub
Apr 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent Python call with exception set in __Pyx_AddTraceback() (GH-4723)
Closes
https://github.com/cython/cython/issues/4722
parent
a7bee4dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
Cython/Utility/Exceptions.c
Cython/Utility/Exceptions.c
+11
-1
No files found.
Cython/Utility/Exceptions.c
View file @
22602c2e
...
@@ -870,6 +870,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
...
@@ -870,6 +870,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
PyCodeObject
*
py_code
=
0
;
PyCodeObject
*
py_code
=
0
;
PyFrameObject
*
py_frame
=
0
;
PyFrameObject
*
py_frame
=
0
;
PyThreadState
*
tstate
=
__Pyx_PyThreadState_Current
;
PyThreadState
*
tstate
=
__Pyx_PyThreadState_Current
;
PyObject
*
ptype
,
*
pvalue
,
*
ptraceback
;
if
(
c_line
)
{
if
(
c_line
)
{
c_line
=
__Pyx_CLineForTraceback
(
tstate
,
c_line
);
c_line
=
__Pyx_CLineForTraceback
(
tstate
,
c_line
);
...
@@ -878,9 +879,18 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
...
@@ -878,9 +879,18 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
// Negate to avoid collisions between py and c lines.
// Negate to avoid collisions between py and c lines.
py_code
=
$
global_code_object_cache_find
(
c_line
?
-
c_line
:
py_line
);
py_code
=
$
global_code_object_cache_find
(
c_line
?
-
c_line
:
py_line
);
if
(
!
py_code
)
{
if
(
!
py_code
)
{
__Pyx_ErrFetchInState
(
tstate
,
&
ptype
,
&
pvalue
,
&
ptraceback
);
py_code
=
__Pyx_CreateCodeObjectForTraceback
(
py_code
=
__Pyx_CreateCodeObjectForTraceback
(
funcname
,
c_line
,
py_line
,
filename
);
funcname
,
c_line
,
py_line
,
filename
);
if
(
!
py_code
)
goto
bad
;
if
(
!
py_code
)
{
/* If the code object creation fails, then we should clear the
fetched exception references and propagate the new exception */
Py_XDECREF
(
ptype
);
Py_XDECREF
(
pvalue
);
Py_XDECREF
(
ptraceback
);
goto
bad
;
}
__Pyx_ErrRestoreInState
(
tstate
,
ptype
,
pvalue
,
ptraceback
);
$
global_code_object_cache_insert
(
c_line
?
-
c_line
:
py_line
,
py_code
);
$
global_code_object_cache_insert
(
c_line
?
-
c_line
:
py_line
,
py_code
);
}
}
py_frame
=
PyFrame_New
(
py_frame
=
PyFrame_New
(
...
...
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