Python 2.5でPyDbgを動かす

リバースエンジニアリングフレームワークPaiMei(http://pedram.redhive.com/PyDbg/docs/)の中に含まれているピュアPythonWindowsデバッガーPyDbgがPython 2.5で動かない!

Traceback (most recent call last):
  File "C:\Python25\test.py", line 2, in <module>
    from pydbg import *
  File "C:\Python25\Lib\site-packages\pydbg\__init__.py", line 41, in <module>
    from defines                 import *
  File "C:\Python25\Lib\site-packages\pydbg\defines.py", line 36, in <module>
    from my_ctypes import *
  File "pydbg\my_ctypes.py", line 80, in <module>
    typ.__reduce__ = _reduce
TypeError: can't set attributes of built-in/extension 
type '_ctypes.Structure'

どうもPython 2.4の段階で開発が停滞しているプロジェクトみたい・・・。


でも苦肉の策としてGoogle CodeのIssues内で紹介されていた方法試してみたら一応動いた!
ctypes/__init__.pyに

 + from _ctypes import Structure as _ctypesStructure
 + class Structure (_ctypesStructure):
 +    pass

するとおk。