Skip to content
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ install:
- python setup.py install
script:
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then flake8 stripe; fi
- python -W all setup.py test
- python -W all -bb -W error::BytesWarning setup.py test
matrix:
allow_failures:
- python: 3.7-dev
Expand Down
3 changes: 3 additions & 0 deletions stripe/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def dashboard_link(request_id):

def logfmt(props):
def fmt(key, val):
# Handle case where val is a bytes or bytesarray
if sys.version_info[0] == 3 and hasattr(val, 'decode'):
val = val.decode('utf-8')
# Check if val is already a string to avoid re-encoding into
# ascii. Since the code is sent through 2to3, we can't just
# use unicode(val, encoding='utf8') since it will be
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ deps =
mock
commands =
python setup.py clean --all
python -W all setup.py test {posargs}
python -W all -bb -W error::BytesWarning setup.py test {posargs}
setenv =
STRIPE_TEST_PYCURL = true

Expand All @@ -28,4 +28,4 @@ deps =
commands =
flake8 stripe
python setup.py clean --all
python -W all setup.py test {posargs}
python -W all -bb -W error::BytesWarning setup.py test {posargs}