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
d2950329
Commit
d2950329
authored
May 06, 2008
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix logic error in Python/_warnings.c and add a test to verify
parent
c730d5f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
Lib/test/test_warnings.py
Lib/test/test_warnings.py
+9
-0
Python/_warnings.c
Python/_warnings.c
+2
-0
No files found.
Lib/test/test_warnings.py
View file @
d2950329
...
...
@@ -388,6 +388,15 @@ class _WarningsTests(BaseTest):
result
=
stream
.
getvalue
()
self
.
failUnless
(
text
in
result
)
def
test_showwarning_not_callable
(
self
):
self
.
module
.
filterwarnings
(
"always"
,
category
=
UserWarning
)
old_showwarning
=
self
.
module
.
showwarning
self
.
module
.
showwarning
=
23
try
:
self
.
assertRaises
(
TypeError
,
self
.
module
.
warn
,
"Warning!"
)
finally
:
self
.
module
.
showwarning
=
old_showwarning
def
test_show_warning_output
(
self
):
# With showarning() missing, make sure that output is okay.
text
=
'test show_warning'
...
...
Python/_warnings.c
View file @
d2950329
...
...
@@ -400,6 +400,8 @@ warn_explicit(PyObject *category, PyObject *message,
PyErr_SetString
(
PyExc_TypeError
,
"warnings.showwarning() must be set to a "
"function or method"
);
Py_DECREF
(
show_fxn
);
goto
cleanup
;
}
defaults
=
PyFunction_GetDefaults
(
check_fxn
);
...
...
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