Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*.pyo file handling in CodeUnit #195

Closed
nedbat opened this issue Sep 6, 2012 · 1 comment
Closed

*.pyo file handling in CodeUnit #195

nedbat opened this issue Sep 6, 2012 · 1 comment
Labels
bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented Sep 6, 2012

Originally reported by Marius Gedminas (Bitbucket: mgedmin, GitHub: mgedmin)


I was reading the source code and this bit in CodeUnit.init caught my eye. Shouldn't it handle *.pyo in addition to *.pyc?

#!diff
diff -r [b65fad3cee1d (bb)](https://bitbucket.org/ned/coveragepy/commits/b65fad3cee1d) coverage/codeunit.py
--- a/coverage/codeunit.py      Sun Sep 02 15:00:20 2012 -0400
+++ b/coverage/codeunit.py      Thu Sep 06 13:53:56 2012 +0300
@@ -52,7 +52,7 @@
         else:
             f = morf
         # .pyc files should always refer to a .py instead.
-        if f.endswith('.pyc'):
+        if f.endswith('.pyc') or f.endswith('.pyo'):
             f = f[:-1]
         self.filename = self.file_locator.canonical_filename(f)

@nedbat nedbat closed this as completed Sep 7, 2012
@nedbat
Copy link
Owner Author

nedbat commented Sep 7, 2012

Hmm, I have no idea why I didn't deal with .pyo files. Embarrasingly, I also have no idea how to write a test for this... :( In any case, it's fixed in <<changeset dc19cc221609 (bb)>>.

@nedbat nedbat added minor bug Something isn't working labels Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant