Message120080
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"); |
|
Date |
User |
Action |
Args |
2010-10-31 18:53:35 | lekma | set | recipients:
+ lekma |
2010-10-31 18:53:35 | lekma | set | messageid: <1288551215.82.0.402250167562.issue10271@psf.upfronthosting.co.za> |
2010-10-31 18:53:34 | lekma | link | issue10271 messages |
2010-10-31 18:53:33 | lekma | create | |
|