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

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

pawl
Copy link

@pawl pawl commented Mar 21, 2017

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.

@@ -2,8 +2,10 @@

from io import BytesIO

import pytest
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants