Re: string exceptions

Godefroid Chapelle <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
Le 25/02/11 12:03, Laurence Rowe a écrit :
> On 25 February 2011 10:58, Godefroid Chapelle<[email protected]>  wrote:
>> Hi,
>>
>> I find a few string exceptions leftover in Zope 2.13 code.
>>
>> However, they are not allowed anymore in Python 2.6.
>>
>> I guess that the remaining string exceptions are in dead/semidead code.
>>
>> What practice has been followed until now regarding fixing those
>> exceptions ?
>
> According to this doc,
> http://docs.python.org/c-api/exceptions.html#deprecation-of-string-exceptions
>
> "String exceptions are still supported in the interpreter to allow
> existing code to run unmodified, but this will also change in a future
> release."
>
> It will of course be important to fix these before we move to Python
> 3.x, but I would expect that the dead/semidead code will not be
> ported.
>
> Laurence

I just tried to run the code hereunder with Python 2.6.5:

def main():
     raise "Abc"

main()

This is what I get :

Traceback (most recent call last):
   File "test.py", line 4, in <module>
     main()
   File "test.py", line 2, in main
     raise "Abc"
TypeError: exceptions must be old-style classes or derived from 
BaseException, not str

I am not sure what the documentation above means but it seems to be text 
that was not fixed...
-- 
Godefroid Chapelle (aka __gotcha) http://bubblenet.be
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.