Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Unified Diff: third_party/cython/src/Cython/Utility/TestCythonScope.pyx

Issue 385073004: Adding cython v0.20.2 in third-party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reference cython dev list thread. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/cython/src/Cython/Utility/TestCythonScope.pyx
diff --git a/third_party/cython/src/Cython/Utility/TestCythonScope.pyx b/third_party/cython/src/Cython/Utility/TestCythonScope.pyx
new file mode 100644
index 0000000000000000000000000000000000000000..f585be2983250e41c51be2f9ad8c811ee2c66dec
--- /dev/null
+++ b/third_party/cython/src/Cython/Utility/TestCythonScope.pyx
@@ -0,0 +1,64 @@
+########## TestClass ##########
+# These utilities are for testing purposes
+
+cdef extern from *:
+ cdef object __pyx_test_dep(object)
+
+@cname('__pyx_TestClass')
+cdef class TestClass(object):
+ cdef public int value
+
+ def __init__(self, int value):
+ self.value = value
+
+ def __str__(self):
+ return 'TestClass(%d)' % self.value
+
+ cdef cdef_method(self, int value):
+ print 'Hello from cdef_method', value
+
+ cpdef cpdef_method(self, int value):
+ print 'Hello from cpdef_method', value
+
+ def def_method(self, int value):
+ print 'Hello from def_method', value
+
+ @cname('cdef_cname')
+ cdef cdef_cname_method(self, int 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
+
+ @cname('def_cname')
+ def def_cname_method(self, int value):
+ print "Hello from def_cname_method", value
+
+@cname('__pyx_test_call_other_cy_util')
+cdef test_call(obj):
+ print 'test_call'
+ __pyx_test_dep(obj)
+
+@cname('__pyx_TestClass_New')
+cdef _testclass_new(int value):
+ return TestClass(value)
+
+########### TestDep ##########
+
+@cname('__pyx_test_dep')
+cdef test_dep(obj):
+ print 'test_dep', obj
+
+########## TestScope ##########
+
+@cname('__pyx_testscope')
+cdef object _testscope(int value):
+ return "hello from cython scope, value=%d" % value
+
+########## View.TestScope ##########
+
+@cname('__pyx_view_testscope')
+cdef object _testscope(int value):
+ return "hello from cython.view scope, value=%d" % value
+

Powered by Google App Engine
This is Rietveld 408576698