There aren't any known issues. In fact, it's likely to make people's
lives easier.
The reason for this is because python 2.5 allows the following construct:
try:
DoSomethingThatMightBreak()
finally:
exitLoop = True
inside a generator, allowing things like:
def main(self):
exitLoop = False
while not exitLoop:
try:
DoSomethingThatMightBreak()
finally:
exitLoop = True
yield 1
It used to be the case you couldn't do that (put a finally clause in a
generator) - you had to do something like this:
from lines 217 onwards of :
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM); yield 0.3
self.sock = sock
try:
sock.setblocking(0); yield 0.6
try:
while not self.safeConnect(sock,(self.host, self.port)):
if self.shutdown(): return
yield 1
yield newComponent(*self.setupCSA(sock))
while self.waitCSAClose():
self.pause()
yield 2
raise Finality
except Exception, x:
result = sock.shutdown(2) ; yield 3
raise x
except Exception, x:
sock.close() ; yield 4,x
raise x
except Finality:
yield 5
except socket.error, e:
self.send(shutdownMicroprocess(self), "signal")
That can now be simplified to:
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM); yield 0.3
self.sock = sock
try:
sock.setblocking(0); yield 0.6
try:
while not self.safeConnect(sock,(self.host, self.port)):
if self.shutdown(): return
yield 1
yield newComponent(*self.setupCSA(sock))
while self.waitCSAClose():
self.pause(); yield 2
finally:
result = sock.shutdown(2) ; yield 3
finally:
sock.close() ; yield 4,x
finally:
yield 5
except socket.error, e:
self.send(shutdownMicroprocess(self), "signal")
(the numbered yields are just useful for debugging/testing, and only
have significance for that purpose, nothing else)
That said, we don't currently take advantage of any 2.5 features,
largely because our code is still python 2.2 compatible. (Which
means there's no reason it won't run on Series 60 mobiles for
example, though in practice, it's been significant time since we
tested that).
At some point we probably will add in python 2.5 features, probably
something like have a threaded generator component. The advantage
of putting a generator into a thread is non-obvious - if you do, you gain
the ability to kill the thread by killing the generator - since you can now
send exceptions into generators.
That said, I personally haven't had a chance to test with python 2.5,
since I prefer to use a prebuilt distribution rather than build my own
binaries. (I can do that, but got bored of the admin overhead sometime
ago! :-)
I suppose it's time to upgrade my distro...
Happy New Year all,
Regards,
Michael
if self.shutdown (): return
yield 1
yield newComponent(*self.setupCSA(sock))
while self.waitCSAClose():
self.pause()
yield 2
raise Finality
except Exception, x:
result = sock.shutdown(2) ; yield 3
raise x
except Exception, x:
sock.close() ; yield 4,x
raise x
except Finality:
yield 5
except socket.error, e:
self.send(shutdownMicroprocess(self), "signal")
That can now be simplified to:
try:
sock = socket.socket(socket.AF_INET , socket.SOCK_STREAM); yield 0.3
self.sock = sock
try:
sock.setblocking(0); yield 0.6
try:
while not self.safeConnect(sock,(self.host, self.port)):
if self.shutdown(): return
yield 1
yield newComponent(*self.setupCSA(sock))
while self.waitCSAClose():
self.pause(); yield 2
finally:
result = sock.shutdown(2) ; yield 3
finally:
sock.close() ; yield 4,x
finally:
yield 5
except socket.error, e:
self.send (shutdownMicroprocess(self), "signal")
(the numbered yields are just useful for debugging/testing, and only
have significance for that purpose, nothing else)
That said, we don't currently take advantage of any 2.5 features,
largely because our code is still python 2.2 compatible. (Which
means there's no reason it won't run on Series 60 mobiles for
example, though in practice, it's been significant time since we
tested that).
At some point we probably will add in python 2.5 features, probably
something like have a threaded generator component. The advantage
of putting a generator into a thread is non-obvious - if you do, you gain
the ability to kill the thread by killing the generator - since you can now
send exceptions into generators.
That said, I personally haven't had a chance to test with python 2.5,
since I prefer to use a prebuilt distribution rather than build my own
binaries. (I can do that, but got bored of the admin overhead sometime
ago! :-)
I suppose it's time to upgrade my distro...
Happy New Year all,
Regards,
Michael