Skip to content

Commit 1efde2d

Browse files
committed
Fix UnicodeDecodeError in Python 2 object macros
1 parent aba2721 commit 1efde2d

5 files changed

Lines changed: 9 additions & 4 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ python:
66
- "3.4"
77
- "3.5"
88
- "3.5-dev" # 3.5 development branch
9-
- "nightly"
9+
# - "nightly"
1010
install: "pip install -r requirements.txt"
1111
script: nosetests

Changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Revision history for the Python package RiveScript.
22

3+
1.12.3 Jul 8 2016
4+
- Fix the Python object macro handler to use `six.text_type` on the return
5+
value, allowing Python 2 objects to return Unicode strings.
6+
37
1.12.2 May 31 2016
48
- Fix a couple of bugs with `set_uservars()`.
59

python-rivescript.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%global desc A scripting language to make it easy to write responses for a chatterbot.
44

55
Name: python-%{srcname}
6-
Version: 1.12.2
6+
Version: 1.12.3
77
Release: 1%{?dist}
88
Summary: %{sum}
99

rivescript/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
__docformat__ = 'plaintext'
4040

4141
__all__ = ['rivescript']
42-
__version__ = '1.12.2'
42+
__version__ = '1.12.3'
4343

4444
from .rivescript import RiveScript, RiveScriptError, NoMatchError, NoReplyError,\
4545
ObjectError, DeepRecursionError, NoDefaultRandomTopicError, RepliesNotSortedError

rivescript/python.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
# Python3 compat
2626
from __future__ import print_function, unicode_literals
27+
from six import text_type
2728

2829
__docformat__ = 'plaintext'
2930

@@ -98,7 +99,7 @@ def call(self, rs, name, user, fields):
9899
reply = ''
99100
except Exception as e:
100101
raise PythonObjectError("Error executing Python object: " + str(e))
101-
return str(reply)
102+
return text_type(reply)
102103

103104

104105
class PythonObjectError(Exception):

0 commit comments

Comments
 (0)