Re: Python 2.5a1 and SkunkWeb 3.4.1
Jacob Smullyan <[email protected]> Mon, 10 Apr 2006 10:49:24 -0400
| Newsgroups | gmane.comp.web.skunkweb |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Apr 07, 2006 at 12:04:23PM -0700, Drew Csillag wrote:
> Now that they've officially deprecated string exceptions in Python 2.5, if you
> use any amount of data components, you'll get a large slew of
> DeprecationWarnings to the terminal that started SkunkWeb. This fixes the case
> for data components, I'm pretty sure there are others floating about. There
> is, however, a caveat that:
> raise ReturnValue, 5
> is now indistinguishable from:
> raise ReturnValue, (5,)
> but *is* distinct from:
> raise ReturnValue, [5]
>
> And I don't see any easy way to work around things so raising (5,) would come
> out as (5,) and raising 5 also comes out as 5. So if you return variable
> length tuples with this patch, be careful. If anybody has a better fix for
> this, that'd be good.
Looks like a Python bug to me. Do you know if it has been
discussed/reported?
If they do stick with this insane behavior, using "ReturnValue(thing)"
syntax will side-step the problem.
Another implementation that I think would work in Executables would be:
try:
return val.message
except AttributeError:
return val.args
'message' is a 2.5-ism. This way we don't need to look at the type of
args.
Cheers,
js
>
> Cheers,
> Drew
>
>
> diff -r /sai/skunkweb/lib/pylibs/AE/Exceptions.py ./Exceptions.py
> 11c11,12
> < ReturnValue = "ReturnValue"
> ---
> > class ReturnValue(Exception):
> > pass
> diff -r /sai/skunkweb/lib/pylibs/AE/Executables.py ./Executables.py
> 74c74,76
> < return val
> ---
> > if type(val.args) == type(()) and len(val.args) == 1:
> > return val.args[0]
> > return val.args
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Skunkweb-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/skunkweb-list
>
--
Jacob Smullyan
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFEOnB0uqamFyFXXLIRAvUVAJ0WSWfKpgiNDEx7U3xbYTH+G1u2+gCgwfIc FDQYFQ1a7l26gJKKWiSKFA8= =01fN -----END PGP SIGNATURE-----