Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
079c9988
Commit
079c9988
authored
Nov 13, 2013
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adjust style
parent
8ff3e8af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
Objects/exceptions.c
Objects/exceptions.c
+8
-12
No files found.
Objects/exceptions.c
View file @
079c9988
...
@@ -2633,13 +2633,12 @@ _PyErr_TrySetFromCause(const char *format, ...)
...
@@ -2633,13 +2633,12 @@ _PyErr_TrySetFromCause(const char *format, ...)
va_list
vargs
;
va_list
vargs
;
PyErr_Fetch
(
&
exc
,
&
val
,
&
tb
);
PyErr_Fetch
(
&
exc
,
&
val
,
&
tb
);
caught_type
=
(
PyTypeObject
*
)
exc
;
caught_type
=
(
PyTypeObject
*
)
exc
;
/* Ensure type info indicates no extra state is stored at the C level */
/* Ensure type info indicates no extra state is stored at the C level */
if
(
caught_type
->
tp_init
!=
(
initproc
)
BaseException_init
||
if
(
caught_type
->
tp_init
!=
(
initproc
)
BaseException_init
||
caught_type
->
tp_new
!=
BaseException_new
||
caught_type
->
tp_new
!=
BaseException_new
||
caught_type
->
tp_basicsize
!=
_PyExc_BaseException
.
tp_basicsize
||
caught_type
->
tp_basicsize
!=
_PyExc_BaseException
.
tp_basicsize
||
caught_type
->
tp_itemsize
!=
_PyExc_BaseException
.
tp_itemsize
caught_type
->
tp_itemsize
!=
_PyExc_BaseException
.
tp_itemsize
)
{
)
{
/* We can't be sure we can wrap this safely, since it may contain
/* We can't be sure we can wrap this safely, since it may contain
* more state than just the exception type. Accordingly, we just
* more state than just the exception type. Accordingly, we just
* leave it alone.
* leave it alone.
...
@@ -2650,13 +2649,11 @@ _PyErr_TrySetFromCause(const char *format, ...)
...
@@ -2650,13 +2649,11 @@ _PyErr_TrySetFromCause(const char *format, ...)
/* Check the args are empty or contain a single string */
/* Check the args are empty or contain a single string */
PyErr_NormalizeException
(
&
exc
,
&
val
,
&
tb
);
PyErr_NormalizeException
(
&
exc
,
&
val
,
&
tb
);
instance_args
=
((
PyBaseExceptionObject
*
)
val
)
->
args
;
instance_args
=
((
PyBaseExceptionObject
*
)
val
)
->
args
;
num_args
=
PyTuple_GET_SIZE
(
instance_args
);
num_args
=
PyTuple_GET_SIZE
(
instance_args
);
if
(
(
num_args
>
1
)
||
if
(
num_args
>
1
||
(
num_args
==
1
&&
(
num_args
==
1
&&
!
PyUnicode_CheckExact
(
PyTuple_GET_ITEM
(
instance_args
,
0
))
!
PyUnicode_CheckExact
(
PyTuple_GET_ITEM
(
instance_args
,
0
))))
{
)
)
{
/* More than 1 arg, or the one arg we do have isn't a string
/* More than 1 arg, or the one arg we do have isn't a string
*/
*/
PyErr_Restore
(
exc
,
val
,
tb
);
PyErr_Restore
(
exc
,
val
,
tb
);
...
@@ -2665,9 +2662,8 @@ _PyErr_TrySetFromCause(const char *format, ...)
...
@@ -2665,9 +2662,8 @@ _PyErr_TrySetFromCause(const char *format, ...)
/* Ensure the instance dict is also empty */
/* Ensure the instance dict is also empty */
dictptr
=
_PyObject_GetDictPtr
(
val
);
dictptr
=
_PyObject_GetDictPtr
(
val
);
if
((
dictptr
!=
NULL
)
&&
(
*
dictptr
!=
NULL
)
&&
if
(
dictptr
!=
NULL
&&
*
dictptr
!=
NULL
&&
(
PyObject_Length
(
*
dictptr
)
>
0
)
PyObject_Length
(
*
dictptr
)
>
0
)
{
)
{
/* While we could potentially copy a non-empty instance dictionary
/* While we could potentially copy a non-empty instance dictionary
* to the replacement exception, for now we take the more
* to the replacement exception, for now we take the more
* conservative path of leaving exceptions with attributes set
* conservative path of leaving exceptions with attributes set
...
...
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