[Python-3000] No (C) optimization flag

Guido van Rossum guido at python.org
Fri Aug 10 16:44:14 CEST 2007


If you really need to step through the Python code, you can just
sabotage the loading of the non-Python version, e.g. remove or rename
the .so or .dll file temporarily.

I wonder about the usefulness of this debugging though -- if you're
debugging something that requires you to step through the C code, how
do you know that the same bug is present in the Python code you're
stepping through instead? Otherwise (if you're debugging a bug in your
own program) I'm not sure I see how stepping through the I/O library
is helpful.

Sounds like what you're really after is *understanding* how the I/O
library works. For that, perhaps reading the docs and then reading the
source code would be more effective.

--Guido

On 8/10/07, Christian Heimes <lists at cheimes.de> wrote:
> 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
>
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list