Commit 22ddeca8 authored by Stefan Behnel's avatar Stefan Behnel

Use Py3 syntax in generated Cython code fragment.

parent cf0b7a51
########## TestClass ########## ########## TestClass ##########
# These utilities are for testing purposes # These utilities are for testing purposes
from __future__ import print_function
cdef extern from *: cdef extern from *:
cdef object __pyx_test_dep(object) cdef object __pyx_test_dep(object)
...@@ -15,29 +17,29 @@ cdef class TestClass(object): ...@@ -15,29 +17,29 @@ cdef class TestClass(object):
return 'TestClass(%d)' % self.value return 'TestClass(%d)' % self.value
cdef cdef_method(self, int value): cdef cdef_method(self, int value):
print 'Hello from cdef_method', value print('Hello from cdef_method', value)
cpdef cpdef_method(self, int value): cpdef cpdef_method(self, int value):
print 'Hello from cpdef_method', value print('Hello from cpdef_method', value)
def def_method(self, int value): def def_method(self, int value):
print 'Hello from def_method', value print('Hello from def_method', value)
@cname('cdef_cname') @cname('cdef_cname')
cdef cdef_cname_method(self, int value): cdef cdef_cname_method(self, int value):
print "Hello from cdef_cname_method", value print("Hello from cdef_cname_method", value)
@cname('cpdef_cname') @cname('cpdef_cname')
cpdef cpdef_cname_method(self, int value): cpdef cpdef_cname_method(self, int value):
print "Hello from cpdef_cname_method", value print("Hello from cpdef_cname_method", value)
@cname('def_cname') @cname('def_cname')
def def_cname_method(self, int value): def def_cname_method(self, int value):
print "Hello from def_cname_method", value print("Hello from def_cname_method", value)
@cname('__pyx_test_call_other_cy_util') @cname('__pyx_test_call_other_cy_util')
cdef test_call(obj): cdef test_call(obj):
print 'test_call' print('test_call')
__pyx_test_dep(obj) __pyx_test_dep(obj)
@cname('__pyx_TestClass_New') @cname('__pyx_TestClass_New')
...@@ -46,19 +48,20 @@ cdef _testclass_new(int value): ...@@ -46,19 +48,20 @@ cdef _testclass_new(int value):
########### TestDep ########## ########### TestDep ##########
from __future__ import print_function
@cname('__pyx_test_dep') @cname('__pyx_test_dep')
cdef test_dep(obj): cdef test_dep(obj):
print 'test_dep', obj print('test_dep', obj)
########## TestScope ########## ########## TestScope ##########
@cname('__pyx_testscope') @cname('__pyx_testscope')
cdef object _testscope(int value): cdef object _testscope(int value):
return "hello from cython scope, value=%d" % value return f"hello from cython scope, value={value}"
########## View.TestScope ########## ########## View.TestScope ##########
@cname('__pyx_view_testscope') @cname('__pyx_view_testscope')
cdef object _testscope(int value): cdef object _testscope(int value):
return "hello from cython.view scope, value=%d" % value return f"hello from cython.view scope, value={value}"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment