Re: [Python-3000] [Python-Dev] warnings.showwarning (was Re:	Reminder: last alphas next Wednesday 07-May-2008) On Fri, May 2, 2008 at 6:47 AM, Jean-Paul Calderone  wrote:
[SNIP]
> > Hi Brett,
> >
> > I'm still seeing some strange behavior from the warnings module,  This
> > can be observed on the community buildbot for Twisted, for example:
> >
> >
> http://python.org/dev/buildbot/community/trunk/x86%20Ubuntu%20Hardy%20trunk/builds/171
> /step-Twisted.zope.stable/0
> >
> > The log ends with basically all of the warning-related tests in Twisted
> > failing, reporting that no warnings happened.
> >
>
>  Just to follow up on this part, the failures are due to the tests expecting
>  to be able to override a different function in the warnings module, not
>  showwarning (warn_explicit).  We used warn_explicit because there's no way
>  to clear way to disable the filtering that gets applied to showwarning.
>  warn_explicit doesn't claim to be a public hook, so I guess I won't
> complain
>  about this. :)
>

Yeah, you guys are being naughty by replacing that and expecting stuff
still to work. =)

>  The below behavior still seems wrong to me, though.
>
>
> > There is also some strange behavior that can be easily observed in the
> REPL:
> >
> >   mhmhlmq@boson:~/Projects/python/trunk$ ./python
> /home/exarkun/Projects/Divmod/trunk/Combinator/combinator/xsite.py:7:
> DeprecationWarning: the sets module is deprecated
> >     from sets import Set
> >   Python 2.6a2+ (trunk:62636M, May  2 2008, 09:19:41)    [GCC 4.1.3
> 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
> >   Type "help", "copyright", "credits" or "license" for more information.
> >   >>> import warnings
> >   >>> warnings.warn("foo")
> >   :1: UserWarning: foo       # Where'd the module name go?
> >   >>> def f(*a):
> >   ...     print a
> >   ...
> >   >>> warnings.showwarning = f
> >   >>> warnings.warn("foo")
> >   >>>                        # Where'd the warning go?
> >
> > Any ideas on this?

If you run this in a stock 2.5 interpreter I get something similar
except the missing '__main__'. If I run it with PYTHONSTARTUP set it
actually uses that module for some reason as the source.

I created issue2743 to fix the output at the interpreter, but I made
it a critical bug since it is only at the interpreter (and thus
breaking people's code will be small), but it should still be fixed
since 'warnings' is a core piece of infrastructure.

-Brett

-Brett
_______________________________________________
Python-3000 mailing list
smsbmo-9552@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: http://mail.python.org/mailman/options/python-3000/python-3000%40tangomu.com


