GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • [Python-Dev] Warning Framework (PEP 230)
  • [Python-Dev] Warning Framework (PEP 230)
  • [ date ]
  • [ thread ]
  • [ subject ]
  • [ author ]

This view

  • Original page
  • New address

GeezerVison is showing mail.python.org — [Python-Dev] Warning Framework (PEP 230)

[Python-Dev] Warning Framework (PEP 230)

Guido van Rossum [email protected]
Mon, 11 Dec 2000 20:21:41 -0500

  • Previous message: [Python-Dev] Warning Framework (PEP 230)
  • Next message: [Python-Dev] Warning Framework (PEP 230)
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

> > PyErr_Warn() imports the warnings module on its first call.  But the
> > value of PyExc_DeprecationWarning c.s. must be available *before* the
> > first call, so they can't be imported from the warnings module!
> 
> Do the following:
> 
> pywarn.h or pyerrors.h:
> 
> #define PyWARN_DEPRECATION "DeprecationWarning"
> 
>      ...
>      if (PyErr_Warn(PyWARN_DEPRECATION,
>  		   "the strop module is deprecated"))
>              return NULL;
> 
> The PyErr_Warn would then use the string to dynamically look up / bind to
> the correct value from the warnings module. By using the symbolic constant,
> you will catch typos in the C code (e.g. if people passed raw strings, then
> a typo won't be found until runtime; using symbols will catch the problem at
> compile time).
> 
> The above strategy will allow for fully-delayed loading, and for all the
> warnings to be located in the "warnings" module.

Yeah, that would be a possibility, if it was deemed evil that the
warnings appear in __builtin__.  I don't see what's so evil about
that.

(There's also the problem that the C code must be able to create new
warning categories, as long as they are derived from the Warning base
class.  Your approach above doesn't support this.  I'm sure you can
figure a way around that too.  But I prefer to hear why you think it's
needed first.)

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



  • Previous message: [Python-Dev] Warning Framework (PEP 230)
  • Next message: [Python-Dev] Warning Framework (PEP 230)
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.