summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2019-01-12 12:53:38 +0100
committerStefan Behnel <stefan_ml@behnel.de>2019-01-12 12:53:38 +0100
commit22ddeca8b0c6195d6748e2e667dcb9e8ce9dc33c (patch)
tree35218706402a8ece7f5c0f5a40cb735a28e19262
parentcf0b7a51c5630c24081aface8c33607ae9b31e95 (diff)
downloadcython-22ddeca8b0c6195d6748e2e667dcb9e8ce9dc33c.tar.gz
Use Py3 syntax in generated Cython code fragment.
-rw-r--r--Cython/Utility/TestCythonScope.pyx25
1 files changed, 14 insertions, 11 deletions
diff --git a/Cython/Utility/TestCythonScope.pyx b/Cython/Utility/TestCythonScope.pyx
index f585be298..26100227d 100644
--- a/Cython/Utility/TestCythonScope.pyx
+++ b/Cython/Utility/TestCythonScope.pyx
@@ -1,6 +1,8 @@
########## TestClass ##########
# These utilities are for testing purposes
+from __future__ import print_function
+
cdef extern from *:
cdef object __pyx_test_dep(object)
@@ -15,29 +17,29 @@ cdef class TestClass(object):
return 'TestClass(%d)' % self.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):
- print 'Hello from cpdef_method', value
+ print('Hello from cpdef_method', value)
def def_method(self, int value):
- print 'Hello from def_method', value
+ print('Hello from def_method', value)
@cname('cdef_cname')
cdef cdef_cname_method(self, int value):
- print "Hello from cdef_cname_method", value
+ print("Hello from cdef_cname_method", value)
@cname('cpdef_cname')
cpdef cpdef_cname_method(self, int value):
- print "Hello from cpdef_cname_method", value
+ print("Hello from cpdef_cname_method", value)
@cname('def_cname')
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')
cdef test_call(obj):
- print 'test_call'
+ print('test_call')
__pyx_test_dep(obj)
@cname('__pyx_TestClass_New')
@@ -46,19 +48,20 @@ cdef _testclass_new(int value):
########### TestDep ##########
+from __future__ import print_function
+
@cname('__pyx_test_dep')
cdef test_dep(obj):
- print 'test_dep', obj
+ print('test_dep', obj)
########## TestScope ##########
@cname('__pyx_testscope')
cdef object _testscope(int value):
- return "hello from cython scope, value=%d" % value
+ return f"hello from cython scope, value={value}"
########## View.TestScope ##########
@cname('__pyx_view_testscope')
cdef object _testscope(int value):
- return "hello from cython.view scope, value=%d" % value
-
+ return f"hello from cython.view scope, value={value}"