Skip to content

add TDecodeException to pure python binary.py's write_struct - #289

Open
pawl wants to merge 1 commit into
Thriftpy:developfrom
pawl:add_TDecodeException
Open

pawl wants to merge 1 commit into
Thriftpy:developfrom
pawl:add_TDecodeException

Conversation

@pawl

@pawl pawl commented Mar 21, 2017

Copy link
Copy Markdown

The pure python binary protocol will throw errors like this when it's unable to decode a value:

AttributeError: 'int' object has no attribute 'encode'

The cython version of the binary protocol throws more helpful errors like this:

ERROR:thriftpy.server:Field 'success(0)' of 'ping_result' needs type 'STRING', but the value is `123`

This changes the pure python version to behave more like the cython version.

This PR also refactors write_val in thriftpy/protocol/binary.py to look similar to c_write_val in thriftpy/protocol/cybin/cybin.c.


from io import BytesIO

import pytest

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not import a third-party package IMHO

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants