[Python-Dev] Cython for cPickle?

Stefan Behnel stefan_ml at behnel.de
Fri Apr 20 00:21:25 CEST 2012


Brian Curtin, 19.04.2012 23:19:
> On Thu, Apr 19, 2012 at 16:08, Stefan Behnel
>>> While code generation alleviates the burden of tedious languages, it's also
>>> infinitely more complex, makes debugging very difficult and adds to
>>> prerequisite knowledge, among other drawbacks.
>>
>> You can use gdb for source level debugging of Cython code and cProfile to
>> profile it. Try that with C-API code.
> 
> I know I'm in the minority of committers being on Windows, but we do
> receive a good amount of reports and contributions from Windows users
> who dive into the C code.

Doesn't match my experience at all - different software target audiences, I
guess.


> Visual Studio by itself makes debugging unbelievably easy, and with
> the Python Tools for VS plugin it even allows Visual Studio's built-in
> profiler to work. I know Windows is not on most people's maps, but if
> we have to scrap the debugger, that's another learning curve
> attachment to evaluate.

What I meant was that there's pdb for debugging Python code (which doesn't
know about the C code it executes) and gdb (or VS) for debugging C code,
from which you can barely infer the Python code it executes. For Cython
code, you can use gdb for both Cython and C, and within limits also for
Python code. Here's a quick intro to see what I mean:

http://docs.cython.org/src/userguide/debugging.html

For profiling, you can use cProfile for Python code (which doesn't tell you
about the C code it executes) and oprofile, callgrind, etc. (incl. VS) for
C code, from which it's non-trivial to infer the relation to the Python
code. With Cython, you can use cProfile for both Cython and Python code as
long as you stay at the source code level, and only need to descend to a
low-level profiler when you care about the exact details, usually assembly
jumps and branches.

Anyway, I guess this is getting off-topic for this list.

Stefan



More information about the Python-Dev mailing list