summaryrefslogtreecommitdiff
path: root/tests/run/bytesmethods.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/bytesmethods.pyx')
-rw-r--r--tests/run/bytesmethods.pyx12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/run/bytesmethods.pyx b/tests/run/bytesmethods.pyx
index f2a10e1d2..fecdcc668 100644
--- a/tests/run/bytesmethods.pyx
+++ b/tests/run/bytesmethods.pyx
@@ -11,6 +11,8 @@ SSIZE_T_MIN = PY_SSIZE_T_MIN
b_a = b'a'
b_b = b'b'
+import sys
+
@cython.test_assert_path_exists(
"//PythonCapiCallNode")
@@ -277,3 +279,13 @@ def literal_join(*args):
result = b'|'.join(args)
assert cython.typeof(result) == 'Python object', cython.typeof(result)
return result
+
+def fromhex(bytes b):
+ """
+ https://github.com/cython/cython/issues/5051
+ Optimization of bound method calls was breaking classmethods
+ >>> fromhex(b"")
+ """
+ if sys.version_info[0] > 2:
+ assert b.fromhex('2Ef0 F1f2 ') == b'.\xf0\xf1\xf2'
+ # method doesn't exist on Py2!