From 291649892f4972e46c5823bfa359b37ad94d6cd5 Mon Sep 17 00:00:00 2001
From: Matthias Diener <mdiener@illinois.edu>
Date: Thu, 17 Feb 2022 22:49:06 -0600
Subject: [PATCH] remove some Python 2 code (#539)

* remove some Python 2 code

* also remove unused function
---
 pyopencl/__init__.py    |  8 --------
 pyopencl/ipython_ext.py | 11 -----------
 2 files changed, 19 deletions(-)

diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index bf09cf55..0a965564 100644
--- a/pyopencl/__init__.py
+++ b/pyopencl/__init__.py
@@ -408,14 +408,6 @@ class Program:
                 self._prg = _cl._create_program_with_il(context, source)
                 return
 
-            import sys
-            if isinstance(source, str) 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 = source.encode()
-
             self._context = context
             self._source = source
             self._prg = None
diff --git a/pyopencl/ipython_ext.py b/pyopencl/ipython_ext.py
index 619ac590..c0b80fa5 100644
--- a/pyopencl/ipython_ext.py
+++ b/pyopencl/ipython_ext.py
@@ -1,22 +1,11 @@
 from IPython.core.magic import (magics_class, Magics, cell_magic, line_magic)
 
 import pyopencl as cl
-import sys
-
-
-def _try_to_utf8(text):
-    if isinstance(text, str):
-        return text.encode("utf8")
-    return text
 
 
 @magics_class
 class PyOpenCLMagics(Magics):
     def _run_kernel(self, kernel, options):
-        if sys.version_info < (3,):
-            kernel = _try_to_utf8(kernel)
-            options = _try_to_utf8(options).strip()
-
         try:
             ctx = self.shell.user_ns["cl_ctx"]
         except KeyError:
-- 
GitLab