*.pyo file handling in CodeUnit

Issue #195 resolved
Marius Gedminas created an issue

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 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)

}}}

Comments (2)

  1. Ned Batchelder repo owner

    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 dc19cc221609 .

  2. Log in to comment