[issue29615] SimpleXMLRPCDispatcher._dispatch mangles tracebacks when invoking RPC calls through _dispatch

2017-03-05 Thread Petr MOTEJLEK

Changes by Petr MOTEJLEK :


--
pull_requests: +391

___
Python tracker 
<http://bugs.python.org/issue29615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29615] SimpleXMLRPCDispatcher._dispatch mangles tracebacks when invoking RPC calls through _dispatch

2017-03-05 Thread Petr MOTEJLEK

Changes by Petr MOTEJLEK :


--
pull_requests: +392

___
Python tracker 
<http://bugs.python.org/issue29615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29374] Doc bug: signal.sigwait and signal.sigtimedwait do not work outside the Main thread

2017-01-25 Thread Petr MOTEJLEK

New submission from Petr MOTEJLEK:

Hi,

The documentation for signal.signal() clearly states that it is only supposed 
to be called on MainThread

However, it does not say so for the signal.sigwait() and neither 
signal.sigtimedwait()

I think this is an error on the documentation side of things (unless I misread 
it). When either signal.sigwait or signal.sigtimedwait are called outside 
MainThread, they simply never catch any signals (signal.sigwait blocks 
indefinitely)

I did not test this on Windows, but on both Linux and OS X the behavior is the 
same

Consider the below simple code

  import signal
  import os
  def sigwait():
print("Send me a signal, my PID is {p}".format(p=os.getpid()))  
print("Got the signal: {i}".format(i=signal.sigwait((signal.SIGUSR1,

If sigwait() is called on MainThread and the process receives SIGUSR1, "Got the 
signal: ..." gets printed. However, calling sigwait in a different thread 
blocks the thread indefinitely. The behavior is the same with 
signal.sigtimedwait() as well

--
assignee: docs@python
components: Documentation
messages: 286269
nosy: docs@python, p...@motejlek.net
priority: normal
severity: normal
status: open
title: Doc bug: signal.sigwait and signal.sigtimedwait do not work outside the 
Main thread
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 
<http://bugs.python.org/issue29374>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29615] SimpleXMLRPCDispatcher._dispatch mangles tracebacks when invoking RPC calls through _dispatch

2017-02-21 Thread Petr MOTEJLEK

New submission from Petr MOTEJLEK:

Hello,

We discovered that SimpleXMLRPCDispatcher mangles tracebacks printed from 
within the invoked RPC methods when an object that has _dispatch(method, 
params) defined has been registered with it

Steps to reproduce
- use 
https://docs.python.org/3.4/library/xmlrpc.server.html#xmlrpc.server.SimpleXMLRPCServer.register_instance
 and register within SimpleXMLRPCDispatcher an object with the 
_dispatch(method, params) method defined
- invoke any RPC method that prints a traceback (perhaps raise an exception in 
it, catch it and use logging.exception to log it) --> the traceback will 
display a very strange looking KeyError (its value being the name of the 
invoked method) and then the actual exception that was fed into 
logging.exception

The reason for this is that SimpleXMLRPCDispatcher._dispatch first attempts to 
acquire the function to invoke by reading from the functions registered with 
the dispatcher. When this attempt fails, KeyError is raised. During its 
handling different approaches are taken to acquire the function and for all but 
one when the function is acquired, handling of the KeyError ends and the 
function is called properly, outside of the except block

However, in the case of objects that define the _dispatch(method, params) 
function, the _dispatch(method, params) function is called straight away, still 
within the except block handling the KeyError, and this leads to the mangled 
traceback

This behavior is neither documented, nor expected (we believe) and thus the 
code should be changed

Will submit a PR (incl. tests) for this later on

--
components: Library (Lib)
messages: 288319
nosy: p...@motejlek.net
priority: normal
severity: normal
status: open
title: SimpleXMLRPCDispatcher._dispatch mangles tracebacks when invoking RPC 
calls through _dispatch
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 
<http://bugs.python.org/issue29615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29615] SimpleXMLRPCDispatcher._dispatch mangles tracebacks when invoking RPC calls through _dispatch

2017-02-23 Thread Petr MOTEJLEK

Changes by Petr MOTEJLEK :


--
pull_requests: +231

___
Python tracker 
<http://bugs.python.org/issue29615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com