Skip to content

Commit

Permalink
Fix UnicodeDecodeError in Python 2 object macros
Browse files Browse the repository at this point in the history
  • Loading branch information
kirsle committed Jul 8, 2016
1 parent aba2721 commit 1efde2d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -6,6 +6,6 @@ python:
- "3.4"
- "3.5"
- "3.5-dev" # 3.5 development branch
- "nightly"
# - "nightly"
install: "pip install -r requirements.txt"
script: nosetests
4 changes: 4 additions & 0 deletions Changes.md
@@ -1,5 +1,9 @@
Revision history for the Python package RiveScript.

1.12.3 Jul 8 2016
- Fix the Python object macro handler to use `six.text_type` on the return
value, allowing Python 2 objects to return Unicode strings.

1.12.2 May 31 2016
- Fix a couple of bugs with `set_uservars()`.

Expand Down
2 changes: 1 addition & 1 deletion python-rivescript.spec
Expand Up @@ -3,7 +3,7 @@
%global desc A scripting language to make it easy to write responses for a chatterbot.

Name: python-%{srcname}
Version: 1.12.2
Version: 1.12.3
Release: 1%{?dist}
Summary: %{sum}

Expand Down
2 changes: 1 addition & 1 deletion rivescript/__init__.py
Expand Up @@ -39,7 +39,7 @@
__docformat__ = 'plaintext'

__all__ = ['rivescript']
__version__ = '1.12.2'
__version__ = '1.12.3'

from .rivescript import RiveScript, RiveScriptError, NoMatchError, NoReplyError,\
ObjectError, DeepRecursionError, NoDefaultRandomTopicError, RepliesNotSortedError
3 changes: 2 additions & 1 deletion rivescript/python.py
Expand Up @@ -24,6 +24,7 @@

# Python3 compat
from __future__ import print_function, unicode_literals
from six import text_type

__docformat__ = 'plaintext'

Expand Down Expand Up @@ -98,7 +99,7 @@ def call(self, rs, name, user, fields):
reply = ''
except Exception as e:
raise PythonObjectError("Error executing Python object: " + str(e))
return str(reply)
return text_type(reply)


class PythonObjectError(Exception):
Expand Down

0 comments on commit 1efde2d

Please sign in to comment.