winpdb not working with python 3.3

不羁的心 提交于 2019-12-04 09:03:29

Got the same problem today here is what i've done for it to work. Still i'm not too sure if this is correct to do it this way.

From:

def __getsignal(signum):
    handler = g_signal_handlers.get(signum, g_signal_getsignal(signum))
    return handler

To:

def __getsignal(signum):
    try:
        # The problems come from the signum which was 0.
        g_signal_getsignal(signum)
    except ValueError:
        return None
    handler = g_signal_handlers.get(signum, g_signal_getsignal(signum))
    return handler

This function shall be at line 13681 or something like.

The reason of a problem is the extended list of attributes in a signal module that was used by rpdb2 to list all signals. New python versions added attributes like SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK

So the filtering should be extended too (patch changes just one line):

--- rpdb2.py
+++ rpdb2.py
@@ -7278,11 +7278,11 @@
     def __set_signal_handler(self):
         """
         Set rpdb2 to wrap all signal handlers.
         """
         for key, value in list(vars(signal).items()):
-            if not key.startswith('SIG') or key in ['SIGRTMIN', 'SIGRTMAX'] or key.startswith('SIG_'):
+            if not key.startswith('SIG') or key in ['SIG_IGN', 'SIG_DFL', 'SIGRTMIN', 'SIGRTMAX']:
             continue

         handler = signal.getsignal(value)
         if handler in [signal.SIG_IGN, signal.SIG_DFL]:
             continue

Unfortunately there is no current official development or fork of winpdb, so by now this patch would be just stored on SO.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!