Debian Codegraph @

extra_tests/cffi_tests/embedding/tlocal.py

raw symbols SCIP
1 # Generated by pypy/tool/import_cffi.py
2 import cffi
3
4 ffi = cffi.FFI()
5
6 ffi.embedding_api("""
7 int add1(int, int);
8 """)
9
10 ffi.embedding_init_code(r"""
11 from _tlocal_cffi import ffi
12 import itertools
13 try:
14 import thread
15 g_seen = itertools.count().next
16 except ImportError:
17 import _thread as thread # py3
18 g_seen = itertools.count().__next__
19 tloc = thread._local()
20
21 @ffi.def_extern()
22 def add1(x, y):
23 try:
24 num = tloc.num
25 except AttributeError:
26 num = tloc.num = g_seen() * 1000
27 return x + y + num
28 """)
29
30 ffi.set_source("_tlocal_cffi", """
31 """)
32
33 fn = ffi.compile(verbose=True)
34 print('FILENAME: %s' % (fn,))