Thriftpy / thriftpy

Thriftpy has been deprecated, please migrate to https://github.com/Thriftpy/thriftpy2
MIT License
1.15k stars 286 forks source link

Fixes #302 -- deprecation warnings when array.tostring() is called on Python 3.3+ #303

Open terwilliger42 opened 7 years ago

terwilliger42 commented 7 years ago

Fixes #302; calls appropriate array.tobytes / array.tostring depending on Python version.

terwilliger42 commented 7 years ago

Not sure why this fails Travis for Python 2.6, but don't think it has anything to do with my change.

michcio1234 commented 7 years ago

Would be awesome if someone merged it. My logs are rather unreadable because of tons of deprecation warnings. :/

terwilliger42 commented 7 years ago

@michcio1234 FYI: You can use Python's 'warnings' module to suppress these messages. Here's what we've done in the interim. This disables this specific warning only within the context manager.

import warnings

with warnings.catch_warnings():
    # Filter out Thriftpy deprecation warnings
    warnings.filterwarnings(action='ignore', message=r'tostring\(\) is deprecated. Use tobytes\(\) instead.', module='thriftpy.protocol.compact',
                            category=DeprecationWarning)
    <thrift code here>
ethe commented 6 years ago

Thriftpy was not supported any more, and it already be resolved in thriftpy2, thanks!