New submission from Guilherme Salgado <gsalg...@gmail.com>:

multiprocessing.Server swallows original exception traceback, making it hard to 
debug. For example, the following code:

```
from multiprocessing.managers import BaseManager

class FooBar(object):
    def m(self):
        self._raise()
    def _raise(self):
        raise ValueError

class MyManager(BaseManager):
    pass

MyManager.register('Foo', callable=FooBar)
manager = MyManager()
manager.start()
manager.Foo()._callmethod('m')
manager.shutdown()
```
Gives me the following exception:

```
Traceback (most recent call last):
  File "/tmp/foo.py", line 15, in <module>
    manager.Foo()._callmethod('m')
  File "/usr/lib/python3.6/multiprocessing/managers.py", line 772, in 
_callmethod
    raise convert_to_error(kind, result)
ValueError
```

Ideally, I'd like to get something like this:

```
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/salgado/src/cpython/Lib/multiprocessing/managers.py", line 254, 
in serve_client
    res = function(*args, **kwds)
  File "/tmp/foo.py", line 5, in m
    self._raise()
  File "/tmp/foo.py", line 7, in _raise
    raise ValueError
ValueError
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/tmp/foo.py", line 15, in <module>
    manager.Foo()._callmethod('m')
  File "/home/salgado/src/cpython/Lib/multiprocessing/managers.py", line 811, 
in _callmethod
    raise convert_to_error(kind, result)
ValueError
```

----------
components: Library (Lib)
messages: 321480
nosy: salgado
priority: normal
severity: normal
status: open
title: multiprocessing.Server swallows original exception traceback
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34098>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to