I returned to some old code (not that old - circa 6 months) and all of a sudden I'm getting a rather inexplicable error. What makes it particularly surprising is that this is not in my code - it's in the copy of the stdlib that goes with my Jython install, which I have not touched in any way (and which is local to my machine, so nobody else has touched it either).
To top it off the offending code looks completely innocuous to me. It's in standard imaplib.py, and it looks unproblematic. The error I get is:
File "C:\jython2.5.3\Lib\imaplib.py", line 504, in login
return login(user, password)
NameError: global name 'login' is not defined
And the code is:
def login(self, user, password):
"""Identify client using plaintext password.
(typ, [data]) = <instance>.login(user, password)
NB: 'password' will be quoted.
"""
typ, dat = self._simple_command('LOGIN', user, self._quote(password))
if typ != 'OK':
self.error(dat[-1])
time.sleep(15)
return login(user, password)
self.state = 'AUTH'
return typ, dat
That's just a vanilla recursion, yes?
Any thoughts on how to sherlock this? I'm pretty stumped.