Message120080
| Author |
lekma |
| Recipients |
lekma |
| Date |
2010年10月31日.18:53:33 |
| SpamBayes Score |
0.0013866137 |
| Marked as misclassified |
No |
| Message-id |
<1288551215.82.0.402250167562.issue10271@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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"); |
|
History
|
|---|
| 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 |
|