Fix invalid 'args' and 'kwargs' decoding in python3

When we set pass_arguments=True, we should unpickle
'args' and 'kwargs' first.

Without it '_decode_from_spooler' will fail on 'decoding' their
packed by pickle data, because pickled data has 'bytes' type.
This commit is contained in:
Yury Khalyavin
2014-10-30 18:00:56 +03:00
parent afeeecbb86
commit fe68884ea4
3 changed files with 22 additions and 7 deletions
@@ -20,8 +20,10 @@ class BitmapTest(unittest.TestCase):
spooler_handlers.controlled_task.spool(arg='barbis')
spooler_handlers.controlled_raw_task.spool(arg='alive', ghost='world')
spooler_handlers.controlled_raw_task.spool(arg='barbis')
spooler_handlers.controlled_arguments_task.spool(
{'key': 'value'}, 2, key1='value1')
for i in range(4):
for i in range(5):
uwsgi.signal_wait(20)
print("Signal received!")
@@ -6,6 +6,14 @@ import uwsgi
ghostpath = "/tmp/ghost"
@spool(pass_arguments=True)
def controlled_arguments_task(*args, **kwargs):
if args != ({'key': 'value'}, 2) or kwargs != {'key1': 'value1'}:
print("We have a problem!")
open(ghostpath, 'w').close()
uwsgi.signal(20)
@spool
def controlled_task(arguments):
if arguments['arg'] != 'alive' and 'ghost' in arguments: