summaryrefslogtreecommitdiff
path: root/testing/embedding/withunicode.py
diff options
context:
space:
mode:
authorLucia Li <luciali@google.com>2021-11-12 05:34:17 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-11-12 05:34:17 +0000
commit2eac055653de4ed6b019e0eb3d5ef997ded8663e (patch)
tree64f8c90740adbe25c30379d6567fd2acafcbd2dd /testing/embedding/withunicode.py
parent3e013ad5e4325c9a301ddde47e997bfd797167cd (diff)
parent65215427f54b809c783a5cd9753612436de072a8 (diff)
downloadcffi-2eac055653de4ed6b019e0eb3d5ef997ded8663e.tar.gz
Upgrade cffi from 1.12.2 to 1.15.0 am: 6aa63b0826 am: 1944553588 am: 65215427f5
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/python/cffi/+/16211499 Change-Id: I3dabc0bbc4d680fc21a52c66688509a7f376a857
Diffstat (limited to 'testing/embedding/withunicode.py')
-rw-r--r--testing/embedding/withunicode.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/testing/embedding/withunicode.py b/testing/embedding/withunicode.py
new file mode 100644
index 0000000..839c6cd
--- /dev/null
+++ b/testing/embedding/withunicode.py
@@ -0,0 +1,26 @@
+import sys, cffi
+if sys.version_info < (3,):
+ u_prefix = "u"
+else:
+ u_prefix = ""
+ unichr = chr
+
+
+ffi = cffi.FFI()
+
+ffi.embedding_api(u"""
+ int add1(int, int);
+""")
+
+ffi.embedding_init_code(("""
+ import sys, time
+ for c in %s'""" + unichr(0x00ff) + unichr(0x1234) + unichr(0xfedc) + """':
+ sys.stdout.write(str(ord(c)) + '\\n')
+ sys.stdout.flush()
+""") % u_prefix)
+
+ffi.set_source("_withunicode_cffi", """
+""")
+
+fn = ffi.compile(verbose=True)
+print('FILENAME: %s' % (fn,))