[Python-3000] No (C) optimization flag
Alexandre Vassalotti
alexandre at peadrop.com
Fri Aug 10 23:20:21 CEST 2007
On 8/10/07, Nick Coghlan <ncoghlan at gmail.com> wrote:
> However we select between Python and native module versions, the build
> bots need be set up to run the modules both ways (with and without C
> optimisation).
That is trivial to do without any runtime flags. For example for
testing both the C and Python implementations of StringIO (and
BytesIO), I define the Python implementation with a leading underscore
and rename it if the C implementation is available:
class _StringIO(TextIOWrapper):
...
# Use the faster implementation of StringIO if available
try:
from _stringio import StringIO
except ImportError:
StringIO = _StringIO
With this way, the Python implementation remains available for testing
(or debugging). For testing the modules, I first check if the C
implementation is available, then define the test according to that --
just check out by yourself:
http://svn.python.org/view/python/branches/cpy_merge/Lib/test/test_memoryio.py?rev=56445&view=markup
-- Alexandre
More information about the Python-3000
mailing list