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.

classification
Title: trace module does not annotate global statement
Type: behavior Stage:
Components: Extension Modules Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, calvin, gvanrossum
Priority: normal Keywords:

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:29adminsetgithub: 46046
2008-01-02 02:42:49gvanrossumsetstatus: open -> closed
nosy: + gvanrossum
messages: + msg59079
2007-12-30 23:18:27amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg59055
2007-12-28 10:47:25calvincreate