New submission from lekma <[email protected]>:
Overriding warnings.showwarning() with a c/python module function (from a
c/python module) doesn't work because warn_explicit() only allow PyFunction or
PyMethod objects to be called (unfortunately c/python module functions are of
type PyCFunction).
Suggested changes in _warnings.c (from py3k) - not tested at all:
from:
412 if (!PyMethod_Check(show_fxn) && !PyFunction_Check(show_fxn)) {
413 PyErr_SetString(PyExc_TypeError,
414 "warnings.showwarning() must be set to a "
415 "function or method");
to:
412 if (!PyCallable_Check(show_fxn)) {
413 PyErr_SetString(PyExc_TypeError,
414 "warnings.showwarning() must be set to a "
415 "callable");
----------
components: Library (Lib)
messages: 120080
nosy: lekma
priority: normal
severity: normal
status: open
title: warnings.showwarning should allow any callable object
type: feature request
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue10271>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com