Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Propagate decode_response to nested structs #194

Merged
merged 1 commit into from
Mar 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions thriftpy/protocol/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def read_val(inbuf, ttype, spec=None, decode_response=True):
return []

for i in range(sz):
result.append(read_val(inbuf, v_type, v_spec))
result.append(read_val(inbuf, v_type, v_spec, decode_response))
return result

elif ttype == TType.MAP:
Expand All @@ -277,15 +277,15 @@ def read_val(inbuf, ttype, spec=None, decode_response=True):
return {}

for i in range(sz):
k_val = read_val(inbuf, k_type, k_spec)
v_val = read_val(inbuf, v_type, v_spec)
k_val = read_val(inbuf, k_type, k_spec, decode_response)
v_val = read_val(inbuf, v_type, v_spec, decode_response)
result[k_val] = v_val

return result

elif ttype == TType.STRUCT:
obj = spec()
read_struct(inbuf, obj)
read_struct(inbuf, obj, decode_response)
return obj


Expand Down
7 changes: 4 additions & 3 deletions thriftpy/protocol/cybin/cybin.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ cdef c_read_val(CyTransportBase buf, TType ttype, spec=None,
skip(buf, orig_type)
return []

return [c_read_val(buf, v_type, v_spec) for _ in range(size)]
return [c_read_val(buf, v_type, v_spec, decode_response)
for _ in range(size)]

elif ttype == T_MAP:
key = spec[0]
Expand Down Expand Up @@ -317,11 +318,11 @@ cdef c_read_val(CyTransportBase buf, TType ttype, spec=None,
skip(buf, orig_type)
return {}

return {c_read_val(buf, k_type, k_spec): c_read_val(buf, v_type, v_spec)
return {c_read_val(buf, k_type, k_spec, decode_response): c_read_val(buf, v_type, v_spec, decode_response)
for _ in range(size)}

elif ttype == T_STRUCT:
return read_struct(buf, spec())
return read_struct(buf, spec(), decode_response)


cdef c_write_val(CyTransportBase buf, TType ttype, val, spec=None):
Expand Down