Issue 1705: trace module does not annotate global statement (original) (raw)

Issue1705

Created on 2007-12-28 10:47 by calvin, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mytest.py calvin,2007-12-28 10:47
Messages (3)
msg59021 - (view) Author: Bastian Kleineidam (calvin) Date: 2007-12-28 10:47
Hi, the trace module does not properly count the global statement. So coverage tests of functions that use the global statement always file. To reproduce write a simple function using the global statement and store it in "mytest.py" (which is attached). Then run "python -m trace -c mytest.py". You'll see that the global statement line will not be covered (ie. there is no "1:" at the beginning of the line). I tested with Python 2.5 and 2.4.
msg59055 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2007-12-30 23:18
But 'global' is a directive to the compiler, and won't generate any bytecode itself. There is no code at this line.
msg59079 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-01-02 02:42
I don't see a bug here. It is as Amaury explains.
History
Date User Action Args
2022-04-11 14:56:29 admin set github: 46046
2008-01-02 02:42:49 gvanrossum set status: open -> closednosy: + gvanrossummessages: +
2007-12-30 23🔞27 amaury.forgeotdarc set nosy: + amaury.forgeotdarcmessages: +
2007-12-28 10:47:25 calvin create