4

我无法让 rpdb2 与 python 3.3 一起运行,但根据几个来源,这应该是可能的。

$ rpdb2 -d myscript.py
A password should be set to secure debugger client-server communication.
Please type a password:x
Password has been set.
Traceback (most recent call last):
  File "/usr/local/bin/rpdb2", line 31, in <module>
    rpdb2.main()
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 14470, in main
    StartServer(_rpdb2_args, fchdir, _rpdb2_pwd, fAllowUnencrypted, fAllowRemote, secret)
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 14212, in StartServer
    g_module_main = -1
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 14212, in StartServer
    g_module_main = -1
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 7324, in trace_dispatch_init
    self.__set_signal_handler()
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 7286, in __set_signal_handler
    handler = signal.getsignal(value)
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 13682, in __getsignal
    handler = g_signal_handlers.get(signum, g_signal_getsignal(signum))
ValueError: signal number out of range

rpdb2 的版本是RPDB 2.4.8 - Tychod. 我通过运行安装它pip-3.3 install winpdb

有什么线索吗?

4

2 回答 2

1

今天遇到了同样的问题,这是我为它所做的工作。我仍然不太确定这样做是否正确。

从:

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

至:

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

这个函数应该在第13681行或类似的地方。

于 2014-05-25T18:05:33.340 回答
1

signal问题的原因是rpdb2 使用模块中的扩展属性列表来列出所有信号。新的 python 版本添加了属性,如SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK

所以过滤也应该扩展(补丁只改变一行):

--- 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

不幸的是,目前还没有正式的 winpdb 开发或分支,所以现在这个补丁只存储在 SO 上。

于 2016-06-29T19:00:45.400 回答