homepage

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: 3rd party program calls trace.py on non Python files
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Gustavo, amaury.forgeotdarc, jerry.seutter, terry.reedy
Priority: normal Keywords: patch

Created on 2008年07月24日 10:39 by Gustavo, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
trace.diff Gustavo, 2008年07月24日 10:38 Patch to fix this bug
Messages (4)
msg70197 - (view) Author: Gustavo Narea (Gustavo) Date: 2008年07月24日 10:38
trace.py tries to get coverage information from non Python files, which raises a
SyntaxError because the file doesn't contain valid Python code.
I've attached a path that fixes this problem in Python 2.5.
msg70198 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008年07月24日 11:08
Your remark is certainly valid, but where does this occur? Some tool
that generate python code on the fly?
Do you have an example, a use case?
msg70199 - (view) Author: Gustavo Narea (Gustavo) Date: 2008年07月24日 11:19
Hi, Amaury.
I found this problem using the Bitten continuous integration system
(http://bitten.edgewall.org/ticket/304).
I'm using the TurboGears framework with Genshi, and therefore
mypackage.templates module should contain non-Python files. Here you'll find
its contents:
https://tracker.gnulinuxmatters.org/browser/animador/trunk/animador/template
This is the only situation where the problem occurs, AFAIK.
If you want to reproduce it, you can:
 1.- Install Bitten:
easy_install http://svn.edgewall.org/repos/bitten/trunk/
 2.- Install my package:
svn co https://svn.gnulinuxmatters.org:81/animador/trunk/ animador
cd animador
./setup.py develop
 3.- Run Bitten's "unittest" extension for setuptools under my package with the
following options:
./setup.py unittest --xml-output build/test-results.xml --coverage-summary
build/test-coverage.txt --coverage-dir build/coverage
Then you'll get a SyntaxError if the patch I attached is not applied.
Cheers.
msg139214 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011年06月26日 20:41
The patch adds this check:
+	 if not filename.endswith((".pyc", ".pyo", ".py")):
+ continue
This is not valid. A Python file is a text file with python code. In spite of import conventions, they are not required to have any particular extension and some people omit them from main scripts. Trace works fine with such files now and your patch would prevent that. Python files are only identified as such by trying to parse them.
The problem and solution lie with your setup. Arrange things so Bitten only treats Python files as Python files.
History
Date User Action Args
2022年04月11日 14:56:36adminsetgithub: 47685
2011年06月26日 20:41:13terry.reedysetstatus: open -> closed


title: trace.py tries to get coverage data from non Python files -> 3rd party program calls trace.py on non Python files
nosy: + terry.reedy
versions: + Python 2.7, Python 3.2, - Python 2.6, Python 3.1
messages: + msg139214
resolution: not a bug
stage: test needed -> patch review
2009年05月16日 20:38:10ajaksu2setpriority: normal
stage: test needed
versions: + Python 2.6, Python 3.1, - Python 2.5
2008年10月17日 21:36:01jerry.seuttersetnosy: + jerry.seutter
2008年07月24日 11:19:23Gustavosetmessages: + msg70199
2008年07月24日 11:08:07amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg70198
2008年07月24日 10:39:00Gustavocreate

AltStyle によって変換されたページ (->オリジナル) /