Skip to content

Commit 7dec59d

Browse files
author
benjamin.peterson
committed
turn PyErr_WarnPy3k into a macro
git-svn-id: http://svn.python.org/projects/python/trunk@63704 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 76745a2 commit 7dec59d

3 files changed

Lines changed: 3 additions & 12 deletions

File tree

Include/warnings.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ PyAPI_FUNC(void) _PyWarnings_Init(void);
99
PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t);
1010
PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *, const char *, int,
1111
const char *, PyObject *);
12-
PyAPI_FUNC(int) PyErr_WarnPy3k(const char *, Py_ssize_t);
12+
13+
#define PyErr_WarnPy3k(msg, stacklevel) (Py_Py3kWarningFlag ? PyErr_WarnEx(PyExc_DeprecationWarning, msg, stacklevel) : 0)
1314

1415
/* DEPRECATED: Use PyErr_WarnEx() instead. */
1516
#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1)

Misc/NEWS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,7 @@ C API
409409
which provide the functions through their libm. The files also
410410
contains several helpers and constants for math.
411411

412-
- Added a new convenience function, PyErr_WarnPy3k, for issuing Py3k
413-
warnings.
412+
- Added a new convenience macro, PyErr_WarnPy3k, for issuing Py3k warnings.
414413

415414

416415
What's New in Python 2.6 alpha 2?

Python/_warnings.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -775,15 +775,6 @@ PyErr_WarnExplicit(PyObject *category, const char *text,
775775
}
776776

777777

778-
int
779-
PyErr_WarnPy3k(const char *text, Py_ssize_t stacklevel)
780-
{
781-
if (Py_Py3kWarningFlag)
782-
return PyErr_WarnEx(PyExc_DeprecationWarning, text, stacklevel);
783-
return 0;
784-
}
785-
786-
787778
PyDoc_STRVAR(warn_doc,
788779
"Issue a warning, or maybe ignore it or raise an exception.");
789780

0 commit comments

Comments
 (0)