eval() of empty string hangs
chrisccc_3k at yahoo.com
Wed Jul 28 17:04:53 CEST 2004
Peter Hansen wrote:
> As an alternative, and not requiring that you special case
> anything, does it work if you simply append '\n' to the
> string to be eval'ed in all cases?
I did try a number of ways of massaging the input string, though far
from exhaustive; I tried adding the single newline - it didn't help.
I did however localize the problem more tightly. It does not seem to be
eval that's hanging, but raise-ing is not working. When I tried my
original plan of special casing '', I added a check for equality, then
manually raised a SyntaxError. This exhibited the same behavior. I
then tried unconditionally raising SyntaxError, same result. Is it
possible that the exception is propagating up the wrong stack? This is
a separate thread, could it be on the main thread somehow? The creating
thread has ended by the time this exception is due to be raised. There
are numerous try-excepts to catch this, all should log at least some
message, but the log shows nothing.
More information about the Python-list