question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_deserialize() got an unexpected keyword argument 'partial'

See original GitHub issue

I recently updated to 3.0.0rc8 (see https://github.com/raiden-network/raiden/pull/4334), and now run into a stacktrace in one test that I cannot make sense of.

i’m posting this here in the hope that someone can give me a hint on how to proceed in finding the problem.

The stacktrace is the following:

raiden/tests/integration/long_running/test_settlement.py::test_batch_unlock[matrix-False-2] Traceback (most recent call last):
  File "src/gevent/greenlet.py", line 716, in gevent._greenlet.Greenlet.run
  File "/Users/paul/Projects/brainbot/raiden/raiden/tests/integration/long_running/test_settlement.py", line 344, in run_test_batch_unlock
    state_change_identifier=HIGH_STATECHANGE_ULID,
  File "/Users/paul/Projects/brainbot/raiden/raiden/storage/restore.py", line 42, in channel_state_until_state_change
    state_change_identifier=state_change_identifier,
  File "/Users/paul/Projects/brainbot/raiden/raiden/storage/wal.py", line 25, in restore_to_state_change
    state_change_identifier=state_change_identifier
  File "/Users/paul/Projects/brainbot/raiden/raiden/storage/sqlite.py", line 788, in get_snapshot_before_state_change
    row.identifier, row.state_change_identifier, self.serializer.deserialize(row.data)
  File "/Users/paul/Projects/brainbot/raiden/raiden/storage/serialization/serializer.py", line 68, in deserialize
    data = DictSerializer.deserialize(json.loads(data))
  File "/Users/paul/Projects/brainbot/raiden/raiden/storage/serialization/serializer.py", line 56, in deserialize
    return schema.load(deepcopy(data))
  File "/Users/paul/Projects/brainbot/raiden/venv/lib/python3.7/site-packages/marshmallow/schema.py", line 732, in load
    data, many=many, partial=partial, unknown=unknown, postprocess=True
  File "/Users/paul/Projects/brainbot/raiden/venv/lib/python3.7/site-packages/marshmallow/schema.py", line 851, in _do_load
    index_errors=self.opts.index_errors,
  File "/Users/paul/Projects/brainbot/raiden/venv/lib/python3.7/site-packages/marshmallow/schema.py", line 686, in _deserialize
    index=index,
  File "/Users/paul/Projects/brainbot/raiden/venv/lib/python3.7/site-packages/marshmallow/schema.py", line 438, in _call_and_store
    value = getter_func(data)
  File "/Users/paul/Projects/brainbot/raiden/venv/lib/python3.7/site-packages/marshmallow/schema.py", line 679, in <lambda>
    val, field_name, data, **d_kwargs
  File "/Users/paul/Projects/brainbot/raiden/venv/lib/python3.7/site-packages/marshmallow/fields.py", line 300, in deserialize
    output = self._deserialize(value, attr, data, **kwargs)
  File "/Users/paul/Projects/brainbot/raiden/venv/lib/python3.7/site-packages/marshmallow/fields.py", line 1373, in _deserialize
    deser_val = self.value_field.deserialize(val, **kwargs)
  File "/Users/paul/Projects/brainbot/raiden/venv/lib/python3.7/site-packages/marshmallow/fields.py", line 300, in deserialize
    output = self._deserialize(value, attr, data, **kwargs)
  File "/Users/paul/Projects/brainbot/raiden/venv/lib/python3.7/site-packages/marshmallow/fields.py", line 609, in _deserialize
    result.append(self.inner.deserialize(each, **kwargs))
  File "/Users/paul/Projects/brainbot/raiden/venv/lib/python3.7/site-packages/marshmallow/fields.py", line 300, in deserialize
    output = self._deserialize(value, attr, data, **kwargs)
TypeError: _deserialize() got an unexpected keyword argument 'partial'
2019-07-05T13:47:51Z <Greenlet "Greenlet-6" at 0x1096ef6a8: run_test_batch_unlock(raiden_network=[<App 0xe3B942e7821A0970EA79185A738BfBd3BC382AAb>,, token_addresses=[b"/\xde\x9d\xc4\xdedR\x87\xe5\xce\xeb:\x88\xe7a\x, secret_registry_address=b'\x96\xd1>\x04\x07tI\x9bF~1\xc7H\x94\xf8\xe2Ql\x9, blockchain_type='geth', deposit=200)> failed with TypeError

The value at that point is

{'message_identifier': '707648407656946282', 'recipient': '0x87A749D9b9c0c91AC009AeeBd74313D1a736A24C', 'canonical_identifier': {'token_network_address': '0x31F486f03875aA82781F3d1207294Cf7F4B0399F', 'chain_identifier': '337', 'channel_identifier': '1'}, 'transfer': {'target': '0x87A749D9b9c0c91AC009AeeBd74313D1a736A24C', 'token': '0x2fdE9dC4De645287e5CEeb3A88e7610ccE06db27', 'initiator': '0xe3B942e7821A0970EA79185A738BfBd3BC382AAb', 'balance_proof': {'locksroot': '0x31859db4b92d706b10dc04a7da091f56c59d0bd31271e8af86cd70c48f9f7f15', 'transferred_amount': 0, 'canonical_identifier': {'token_network_address': '0x31F486f03875aA82781F3d1207294Cf7F4B0399F', 'chain_identifier': '337', 'channel_identifier': '1'}, 'balance_hash': '0x099f54eb555c61ac9d218d789f1314d0f49ce18bf1d918c102abbd343a077324', 'nonce': '1', 'locked_amount': 10}, 'route_states': [{'route': ['0x87A749D9b9c0c91AC009AeeBd74313D1a736A24C'], 'forward_channel_id': '1'}], 'lock': {'amount': '10', 'secrethash': '0xca6730d3e5cb46a8dbed803cb3de6a3357a00ee27f0871c8919ff0eb39fff727', 'expiration': '90'}, 'payment_identifier': '1'}, '_type': 'raiden.transfer.mediated_transfer.events.SendLockedTransfer'}

and kwargs is {'partial': False}.

Some more background: We have a deeply nested tree of state objects. These state objects are dataclasses, and we use marshmallow-dataclasses to automatically create schemas for them. There are also some Field definitions, they can be seen in the PR linked above.

I’d be thankful for for any hint or idea 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
charlaxcommented, Aug 26, 2019

Sure.

2reactions
lafrechcommented, Jul 5, 2019

_deserialize should accept **kwargs. Which Field is it? I saw you added **kwargs to your custom fields in https://github.com/raiden-network/raiden/pull/4334/files.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - TypeError: _deserialize() got an unexpected keyword ...
Since marshmallow 3, _deserialize may receive partial kwarg. Every custom field should copy Field._deserialize signature and accept unknown ...
Read more >
Issue #934: [CLI] TypeError: __init__() got an unexpected ...
We have this issue now in Mageia when building python-copr. Marshmallow version is 3.0.3. After removing all 'strict=True' references build fails due to...
Read more >
Upgrading to Newer Releases — marshmallow 3.19.0 ...
Schema.handle_error also receives many and partial as keyword arguments. ... where fields are missing from the deserialized data (due to validation errors).
Read more >
marshmallow - Read the Docs
receives a dictionary of deserialized data as its only parameter. from marshmallow import Schema, fields, post_load class UserSchema(Schema): name = fields.
Read more >
Got got an unexpected keyword argument after Nested serializer
I have been Django working on RoutePrice Model and I tried to serialize data in nested serializer, before nested serializer it was fine ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found