Skip to content

Commit 323bd74

Browse files
committed
remove python 2 compatibility code
1 parent f50cbfd commit 323bd74

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

llvmlite/binding/value.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from ctypes import POINTER, c_char_p, c_int, c_size_t, c_uint, c_uint64, c_bool, c_void_p
22
import enum
33

4-
from . import ffi
5-
from .common import _decode_string, _encode_string
6-
from .. import six
4+
from llvmlite.binding import ffi
5+
from llvmlite.binding.common import _decode_string, _encode_string
76

87

98
class Linkage(enum.IntEnum):
@@ -202,7 +201,7 @@ def add_function_attribute(self, attr, val=None):
202201
# if attribute is not an EnumAttribute, add it as a StringAttribute
203202
val = 'true' if val is True or val is None else val
204203
val = 'false' if val is False else val
205-
if not isinstance(val, six.string_types):
204+
if not isinstance(val, str):
206205
raise ValueError(
207206
"attribute '%s' takes only string or boolean values, got '%s'" % (attrname, type(val)))
208207
ffi.lib.LLVMPY_AddFunctionStringAttr(

llvmlite/tests/test_binding.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -859,14 +859,9 @@ def test_add_function_attribute(self):
859859
"attribute 'nocapture' only takes 'None' as value")
860860
with self.assertRaises(ValueError) as raises:
861861
fn.add_function_attribute("no-nans-fp-math", 1)
862-
if six.PY2:
863-
self.assertEqual(
864-
str(raises.exception),
865-
"attribute 'no-nans-fp-math' takes only string or boolean values, got '<type 'int'>'")
866-
else:
867-
self.assertEqual(
868-
str(raises.exception),
869-
"attribute 'no-nans-fp-math' takes only string or boolean values, got '<class 'int'>'")
862+
self.assertEqual(
863+
str(raises.exception),
864+
"attribute 'no-nans-fp-math' takes only string or boolean values, got '<class 'int'>'")
870865

871866
def test_module(self):
872867
mod = self.module()

0 commit comments

Comments
 (0)