Debugging Python extensions

Mike Rovner mike at nospam.com
Thu Mar 4 16:48:39 EST 2004


Gus Tabares wrote:
> So far I have compiled a debug version of the 'pythoncore' project
> that is located in the Python sources. This has produced the
> python23_d.dll which I will use to link with my pyd.

You don't have to.

> I have a few questions after this step:
>
> 1. Do I need to compile my own version of Python2.3 to debug my pyd?

no

> 2. Do I have to name my debug pyd as filename_d.pyd?

no

> 3. Does the init function need to be named initfilename_d?

no

> I understand that .NET 2003 is not "supported" (I believe only VS6 is)

no. support code is already in cvs

> but I would think using .NET 2003 would not be much different aside
> from converting the projects to the new format.

It's straightforward:

1. use stock python.exe
2. compile (debug version) of your extension module as DLL project and name
output mymodule.dll (make sure you use initmymodule() inside.
3. in project properties set
  debugging /command >  <full path to python.exe> i.e.
c:\python23\python.exe
  debugging /command arguments > <simple test script or even -c "import
mymodule">
also usefull:
  debugging /working directory > <full path to your script>

Make sure you have mymodule.dll in the same place as test script and you are
all set.
Put breakpoints, hit run, do as usual in VS.NET.

HTH,
Mike








More information about the Python-list mailing list