Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(9)

Unified Diff: Python/_warnings.c

Issue 3255: Issue #3602 (Closed) SVN Base: http://svn.python.org/view/*checkout*/python/trunk/
Patch Set: Created 1 year, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side by-side-diff with in-line comments
Download patch
« Lib/warnings.py ('k') | no next file » | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Python/_warnings.c
===================================================================
--- Python/_warnings.c (revision 65979)
+++ Python/_warnings.c (working copy)
@@ -1,4 +1,5 @@
#include "Python.h"
+#include "code.h" /* For DeprecationWarning about adding 'line'. */
#include "frameobject.h"
#define MODULE_NAME "_warnings"
@@ -416,11 +417,16 @@
/* A proper implementation of warnings.showwarning() should
have at least two default arguments. */
if ((defaults == NULL) || (PyTuple_Size(defaults) < 2)) {
- if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1) < 0) {
- Py_DECREF(show_fxn);
- goto cleanup;
+ PyCodeObject *code = (PyCodeObject *)
+ PyFunction_GetCode(check_fxn);
+ if (!(code->co_flags & CO_VARARGS)) {
+ if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1) <
+ 0) {
+ Py_DECREF(show_fxn);
+ goto cleanup;
+ }
}
- }
+ }
res = PyObject_CallFunctionObjArgs(show_fxn, message, category,
filename, lineno_obj,
NULL);
« Lib/warnings.py ('k') | no next file »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r483