[Python-Dev] Warning Framework (PEP 230)

Guido van Rossum guido@python.org
Fri, 08 Dec 2000 17:58:03 -0500


Nobody seems to care much about the warnings PEP so far.  What's up?
Are you all too busy buying presents for the holidays?  Then get me
some too, please? :-)

>   http://python.sourceforge.net/peps/pep-0230.html

I've now produced a prototype implementation for the C code:

http://sourceforge.net/patch/?func=detailpatch&patch_id=102715&group_id=5470

Issues:

- This defines a C API PyErr_Warn(category, message) instead of
  Py_Warn(message, category) as the PEP proposes.  I actually like
  this better: it's consistent with PyErr_SetString() etc. rather than
  with the Python warn(message[, category]) function.

- This calls the Python module from C.  We'll have to see if this is
  fast enough.  I wish I could postpone the import of warnings.py
  until the first call to PyErr_Warn(), but unfortunately the warning
  category classes must be initialized first (so they can be passed
  into PyErr_Warn()).  The current version of warnings.py imports
  rather a lot of other modules (e.g. re and getopt); this can be
  reduced by placing those imports inside the functions that use them.

- All the issues listed in the PEP.

Please comment!

BTW: somebody overwrote the PEP on SourceForge with an older version.
Please remember to do a "cvs update" before running "make install" in
the peps directory!

--Guido van Rossum (home page: http://www.python.org/~guido/)