Message148258
| Author |
eric.araujo |
| Recipients |
alexis, brett.cannon, eric.araujo, ncoghlan, tarek |
| Date |
2011年11月24日.14:45:08 |
| SpamBayes Score |
4.324302e-11 |
| Marked as misclassified |
No |
| Message-id |
<1322145911.61.0.528651769931.issue13473@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I recently changed packaging.util.byte_compile, the function used by the build_py and install_lib commands, so that it can create .pyc and/or .pyo files independently of the calling’s Python -O or -B flags (dad02a080bbc), but I think I introduced a bug. To check that bug and fully test byte_compile before I further simplify the function and backport the whole fix to distutils, I wanted to add tests that load a .pyc or .pyo file and make sure that the right optimization level is used (nothing for --compile, level one for --optimize=1, level 2 for --optimize=2).
In the attached patch, I run a Python with -O, -OO or no flag in a subprocess to import a module that prints different things depending on the optimization level. The .pyc or .pyo file is already created by packaging, but I have no check that makes sure that they are not recreated (which I don’t want) and I don’t know if the optimizations in compile.c are applied during byte-compilation or after import (which would make my tests not exercise what I want).
(I tried to use imp.load_module at first but it’s not very friendly. Other ideas that I had after the patch was done: Use subprocess + imp so that I can import pyc or pyo as I wish; use open + dis module.)
So, could you import experts review the functions added in packaging.tests.support and tell me if they exercise what I want? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年11月24日 14:45:13 | eric.araujo | set | recipients:
+ eric.araujo, brett.cannon, ncoghlan, tarek, alexis |
| 2011年11月24日 14:45:11 | eric.araujo | set | messageid: <1322145911.61.0.528651769931.issue13473@psf.upfronthosting.co.za> |
| 2011年11月24日 14:45:10 | eric.araujo | link | issue13473 messages |
| 2011年11月24日 14:45:10 | eric.araujo | create |
|