aboutsummaryrefslogtreecommitdiffstats
path: root/tests/util/py3xfunctions.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/util/py3xfunctions.py')
-rw-r--r--tests/util/py3xfunctions.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/util/py3xfunctions.py b/tests/util/py3xfunctions.py
index 1dd5148df..3b89867a6 100644
--- a/tests/util/py3xfunctions.py
+++ b/tests/util/py3xfunctions.py
@@ -1,6 +1,14 @@
def b(s):
return bytes(s, "UTF8")
+def buffer_(s):
+ if s == None:
+ return None
+ elif type(s) == str:
+ return bytes(s, "UTF8")
+ else:
+ memoryview(s)
+
def l(n):
return n
@@ -11,4 +19,4 @@ unicode = str
unichr = chr
long = int
unichr = chr
-buffer = b
+buffer = buffer_