This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author isandler
Recipients
Date 2006-07-22.17:46:44
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=971153

>> Is your comment directly related to this bug?

Yes, my suggestion was to call settrace() after 

  cmd = cmd+'\n'

which should solve the original (bdb leaving tracing on)
problem.. Your latest suggestion would do the same thing by
different means..

However, I think there an even better way: can we simply remove

-    if not isinstance(cmd, types.CodeType):
-        cmd = cmd+'\n'

from bdb.py???

This would both solve the original problem and make error
message more meaningful IMO..

 > exec: arg 1 must be a string, file, or code object

Rather than:

 >Unsupported operand type(s) for +: 'NoneType' and 'str'

This seems to work for me, would you be interested in
testing and submitting a patch for this?


A bit more information: it appears that older versions of
python in some cases required string passed to exec to end
with '\n', this was even mentioned in python FAQ.. E.g if I
feed  
  
 exec 'for i in range(4):\nx=i'

into python2.1, I get a Syntax error..

However, this does work in python2.3.3, 2.4,2.5...

So was this + '\n' indeed a workaround for a deficiency in exec?





apparently older versions of python required the string
passed to exec to end with '\n'. It was even mentioned in
older FAQs... However, latest versions of python seem to
accept strings without new line... Eg. even
History
Date User Action Args
2007-08-23 14:39:31adminlinkissue1472251 messages
2007-08-23 14:39:31admincreate