[Python-3000] No (C) optimization flag

Christian Heimes lists at cheimes.de
Fri Aug 10 11:20:23 CEST 2007


Good morning py3k-dev!

If I understand correctly the new C optimization for io,py by Alexandre
Vassalotti and possible other optimization for modules likes pickle.py
are going to be dropped in automatically. The Python implementation is a
reference implementation and will be used as fall back only.

On the one hand it is an improvement. We are getting instant
optimization without teaching people to use a cFoo module. But on the
other hand it is going to make debugging with pdb much harder because
pdb can't step into C code.

I like to propose a --disable-optimization (-N for no optimization) flag
for Python that disables the usage of optimized implementation. The
status of the flag can be set by either a command line argument or a C
function call before Py_Initialize() and it can be queried by
sys.getoptimization(). It's not possible to chance the flag during
runtime. That should make the code simple and straight forward.

When the flag is set modules like io and pickle must not use their
optimized version and fall back to their Python implementation. I'm
willing to give it a try writing the necessary code myself. I think I'm
familiar enough with the Python C API after my work on PythonNet for
this simple task.

Christian



More information about the Python-3000 mailing list