From 9a9733aa1b4d768659a3a3ea32225dce505456c1 Mon Sep 17 00:00:00 2001 From: Yichao Yu <yyc1992@gmail.com> Date: Fri, 23 May 2014 18:49:23 -0400 Subject: [PATCH] use the correct way to convert unicode to string. I also think this warning should be removed since it can happen when unicode_literals from __future__ is enabled. --- pyopencl/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py index 88749a73..55ea15cd 100644 --- a/pyopencl/__init__.py +++ b/pyopencl/__init__.py @@ -115,9 +115,9 @@ class Program(object): if isinstance(source, unicode) and sys.version_info < (3,): from warnings import warn warn("Received OpenCL source code in Unicode, " - "should be ASCII string. Attempting conversion.", - stacklevel=2) - source = str(source) + "should be ASCII string. Attempting conversion.", + stacklevel=2) + source = source.encode() self._context = context self._source = source -- GitLab