Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
d4e924b0
Commit
d4e924b0
authored
Jan 08, 2016
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add warning tests
parent
32657208
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
from_cpython/Python/_warnings.c
from_cpython/Python/_warnings.c
+3
-3
test/tests/warnings_test.py
test/tests/warnings_test.py
+12
-3
No files found.
from_cpython/Python/_warnings.c
View file @
d4e924b0
...
...
@@ -901,7 +901,7 @@ _PyWarnings_Init(void)
if
(
_filters
==
NULL
)
return
;
// Pyston change: let the GC scan the filters
PyGC_AddPotentialRoot
(
_filters
,
sizeof
(
_filters
));
PyGC_AddPotentialRoot
(
&
_filters
,
sizeof
(
_filters
));
Py_INCREF
(
_filters
);
if
(
PyModule_AddObject
(
m
,
"filters"
,
_filters
)
<
0
)
return
;
...
...
@@ -910,7 +910,7 @@ _PyWarnings_Init(void)
if
(
_once_registry
==
NULL
)
return
;
// Pyston change: let the GC scan the registry
PyGC_AddPotentialRoot
(
_once_registry
,
sizeof
(
_once_registry
));
PyGC_AddPotentialRoot
(
&
_once_registry
,
sizeof
(
_once_registry
));
Py_INCREF
(
_once_registry
);
if
(
PyModule_AddObject
(
m
,
"once_registry"
,
_once_registry
)
<
0
)
return
;
...
...
@@ -919,7 +919,7 @@ _PyWarnings_Init(void)
if
(
_default_action
==
NULL
)
return
;
// Pyston change: let the GC scan the action
PyGC_AddPotentialRoot
(
_default_action
,
sizeof
(
_default_action
));
PyGC_AddPotentialRoot
(
&
_default_action
,
sizeof
(
_default_action
));
Py_INCREF
(
_default_action
);
if
(
PyModule_AddObject
(
m
,
"default_action"
,
_default_action
)
<
0
)
return
;
...
...
test/tests/warnings_test.py
View file @
d4e924b0
import
warnings
import
_warnings
# Specifying this as a DeprecationWarning is a hacky way of supressing the warning,
# since we don't output the exact same error message as CPython right now:
warnings
.
warn
(
"hello world"
,
DeprecationWarning
)
warnings
.
filterwarnings
(
'error'
)
try
:
warnings
.
warn
(
"hello world"
,
Warning
)
except
Warning
as
w
:
print
(
w
.
args
[
0
])
try
:
_warnings
.
warn
(
"deperecated"
,
Warning
)
except
Warning
as
w
:
print
(
w
.
args
[
0
])
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