From 31b7fc8e3bf65b9351dafbfffe1160f07ab53474 Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Fri, 12 Mar 2010 12:48:09 +0100 Subject: [PATCH] Backwards-compatability pxd files for CPython API --- Cython/Includes/python_bool.pxd | 2 ++ Cython/Includes/python_buffer.pxd | 2 ++ Cython/Includes/python_bytes.pxd | 2 ++ Cython/Includes/python_cobject.pxd | 2 ++ Cython/Includes/python_complex.pxd | 2 ++ Cython/Includes/python_dict.pxd | 2 ++ Cython/Includes/python_exc.pxd | 2 ++ Cython/Includes/python_float.pxd | 2 ++ Cython/Includes/python_function.pxd | 2 ++ Cython/Includes/python_getargs.pxd | 2 ++ Cython/Includes/python_instance.pxd | 2 ++ Cython/Includes/python_int.pxd | 2 ++ Cython/Includes/python_iterator.pxd | 2 ++ Cython/Includes/python_list.pxd | 2 ++ Cython/Includes/python_long.pxd | 2 ++ Cython/Includes/python_mapping.pxd | 2 ++ Cython/Includes/python_mem.pxd | 2 ++ Cython/Includes/python_method.pxd | 2 ++ Cython/Includes/python_module.pxd | 2 ++ Cython/Includes/python_number.pxd | 2 ++ Cython/Includes/python_object.pxd | 2 ++ Cython/Includes/python_oldbuffer.pxd | 2 ++ Cython/Includes/python_pycapsule.pxd | 2 ++ Cython/Includes/python_ref.pxd | 2 ++ Cython/Includes/python_sequence.pxd | 2 ++ Cython/Includes/python_set.pxd | 2 ++ Cython/Includes/python_string.pxd | 2 ++ Cython/Includes/python_tuple.pxd | 2 ++ Cython/Includes/python_type.pxd | 2 ++ Cython/Includes/python_unicode.pxd | 2 ++ Cython/Includes/python_version.pxd | 2 ++ Cython/Includes/python_weakref.pxd | 2 ++ tests/run/cython_includes.pyx | 15 ++++++++++----- 33 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 Cython/Includes/python_bool.pxd create mode 100644 Cython/Includes/python_buffer.pxd create mode 100644 Cython/Includes/python_bytes.pxd create mode 100644 Cython/Includes/python_cobject.pxd create mode 100644 Cython/Includes/python_complex.pxd create mode 100644 Cython/Includes/python_dict.pxd create mode 100644 Cython/Includes/python_exc.pxd create mode 100644 Cython/Includes/python_float.pxd create mode 100644 Cython/Includes/python_function.pxd create mode 100644 Cython/Includes/python_getargs.pxd create mode 100644 Cython/Includes/python_instance.pxd create mode 100644 Cython/Includes/python_int.pxd create mode 100644 Cython/Includes/python_iterator.pxd create mode 100644 Cython/Includes/python_list.pxd create mode 100644 Cython/Includes/python_long.pxd create mode 100644 Cython/Includes/python_mapping.pxd create mode 100644 Cython/Includes/python_mem.pxd create mode 100644 Cython/Includes/python_method.pxd create mode 100644 Cython/Includes/python_module.pxd create mode 100644 Cython/Includes/python_number.pxd create mode 100644 Cython/Includes/python_object.pxd create mode 100644 Cython/Includes/python_oldbuffer.pxd create mode 100644 Cython/Includes/python_pycapsule.pxd create mode 100644 Cython/Includes/python_ref.pxd create mode 100644 Cython/Includes/python_sequence.pxd create mode 100644 Cython/Includes/python_set.pxd create mode 100644 Cython/Includes/python_string.pxd create mode 100644 Cython/Includes/python_tuple.pxd create mode 100644 Cython/Includes/python_type.pxd create mode 100644 Cython/Includes/python_unicode.pxd create mode 100644 Cython/Includes/python_version.pxd create mode 100644 Cython/Includes/python_weakref.pxd diff --git a/Cython/Includes/python_bool.pxd b/Cython/Includes/python_bool.pxd new file mode 100644 index 00000000..2bf64ce0 --- /dev/null +++ b/Cython/Includes/python_bool.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.bool cimport * diff --git a/Cython/Includes/python_buffer.pxd b/Cython/Includes/python_buffer.pxd new file mode 100644 index 00000000..6329e36a --- /dev/null +++ b/Cython/Includes/python_buffer.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.buffer cimport * diff --git a/Cython/Includes/python_bytes.pxd b/Cython/Includes/python_bytes.pxd new file mode 100644 index 00000000..7cfa1c23 --- /dev/null +++ b/Cython/Includes/python_bytes.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.bytes cimport * diff --git a/Cython/Includes/python_cobject.pxd b/Cython/Includes/python_cobject.pxd new file mode 100644 index 00000000..537e7ca2 --- /dev/null +++ b/Cython/Includes/python_cobject.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.cobject cimport * diff --git a/Cython/Includes/python_complex.pxd b/Cython/Includes/python_complex.pxd new file mode 100644 index 00000000..87f99d23 --- /dev/null +++ b/Cython/Includes/python_complex.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.complex cimport * diff --git a/Cython/Includes/python_dict.pxd b/Cython/Includes/python_dict.pxd new file mode 100644 index 00000000..5ad91178 --- /dev/null +++ b/Cython/Includes/python_dict.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.dict cimport * diff --git a/Cython/Includes/python_exc.pxd b/Cython/Includes/python_exc.pxd new file mode 100644 index 00000000..883c4cfc --- /dev/null +++ b/Cython/Includes/python_exc.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.exc cimport * diff --git a/Cython/Includes/python_float.pxd b/Cython/Includes/python_float.pxd new file mode 100644 index 00000000..494920f7 --- /dev/null +++ b/Cython/Includes/python_float.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.float cimport * diff --git a/Cython/Includes/python_function.pxd b/Cython/Includes/python_function.pxd new file mode 100644 index 00000000..bde3fa98 --- /dev/null +++ b/Cython/Includes/python_function.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.function cimport * diff --git a/Cython/Includes/python_getargs.pxd b/Cython/Includes/python_getargs.pxd new file mode 100644 index 00000000..dcf25b77 --- /dev/null +++ b/Cython/Includes/python_getargs.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.getargs cimport * diff --git a/Cython/Includes/python_instance.pxd b/Cython/Includes/python_instance.pxd new file mode 100644 index 00000000..7d574097 --- /dev/null +++ b/Cython/Includes/python_instance.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.instance cimport * diff --git a/Cython/Includes/python_int.pxd b/Cython/Includes/python_int.pxd new file mode 100644 index 00000000..11bc26bf --- /dev/null +++ b/Cython/Includes/python_int.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.int cimport * diff --git a/Cython/Includes/python_iterator.pxd b/Cython/Includes/python_iterator.pxd new file mode 100644 index 00000000..e7691f48 --- /dev/null +++ b/Cython/Includes/python_iterator.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.iterator cimport * diff --git a/Cython/Includes/python_list.pxd b/Cython/Includes/python_list.pxd new file mode 100644 index 00000000..53f594e0 --- /dev/null +++ b/Cython/Includes/python_list.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.list cimport * diff --git a/Cython/Includes/python_long.pxd b/Cython/Includes/python_long.pxd new file mode 100644 index 00000000..4bdf629e --- /dev/null +++ b/Cython/Includes/python_long.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.long cimport * diff --git a/Cython/Includes/python_mapping.pxd b/Cython/Includes/python_mapping.pxd new file mode 100644 index 00000000..6127601f --- /dev/null +++ b/Cython/Includes/python_mapping.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.mapping cimport * diff --git a/Cython/Includes/python_mem.pxd b/Cython/Includes/python_mem.pxd new file mode 100644 index 00000000..9729cd8c --- /dev/null +++ b/Cython/Includes/python_mem.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.mem cimport * diff --git a/Cython/Includes/python_method.pxd b/Cython/Includes/python_method.pxd new file mode 100644 index 00000000..36c67e12 --- /dev/null +++ b/Cython/Includes/python_method.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.method cimport * diff --git a/Cython/Includes/python_module.pxd b/Cython/Includes/python_module.pxd new file mode 100644 index 00000000..5a462592 --- /dev/null +++ b/Cython/Includes/python_module.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.module cimport * diff --git a/Cython/Includes/python_number.pxd b/Cython/Includes/python_number.pxd new file mode 100644 index 00000000..7b544ff2 --- /dev/null +++ b/Cython/Includes/python_number.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.number cimport * diff --git a/Cython/Includes/python_object.pxd b/Cython/Includes/python_object.pxd new file mode 100644 index 00000000..dd8bff1d --- /dev/null +++ b/Cython/Includes/python_object.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.object cimport * diff --git a/Cython/Includes/python_oldbuffer.pxd b/Cython/Includes/python_oldbuffer.pxd new file mode 100644 index 00000000..d4bb2dc3 --- /dev/null +++ b/Cython/Includes/python_oldbuffer.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.oldbuffer cimport * diff --git a/Cython/Includes/python_pycapsule.pxd b/Cython/Includes/python_pycapsule.pxd new file mode 100644 index 00000000..a6f65438 --- /dev/null +++ b/Cython/Includes/python_pycapsule.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.pycapsule cimport * diff --git a/Cython/Includes/python_ref.pxd b/Cython/Includes/python_ref.pxd new file mode 100644 index 00000000..fc1783da --- /dev/null +++ b/Cython/Includes/python_ref.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.ref cimport * diff --git a/Cython/Includes/python_sequence.pxd b/Cython/Includes/python_sequence.pxd new file mode 100644 index 00000000..b73fa478 --- /dev/null +++ b/Cython/Includes/python_sequence.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.sequence cimport * diff --git a/Cython/Includes/python_set.pxd b/Cython/Includes/python_set.pxd new file mode 100644 index 00000000..96a4780c --- /dev/null +++ b/Cython/Includes/python_set.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.set cimport * diff --git a/Cython/Includes/python_string.pxd b/Cython/Includes/python_string.pxd new file mode 100644 index 00000000..df4fd4f4 --- /dev/null +++ b/Cython/Includes/python_string.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.string cimport * diff --git a/Cython/Includes/python_tuple.pxd b/Cython/Includes/python_tuple.pxd new file mode 100644 index 00000000..2362c090 --- /dev/null +++ b/Cython/Includes/python_tuple.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.tuple cimport * diff --git a/Cython/Includes/python_type.pxd b/Cython/Includes/python_type.pxd new file mode 100644 index 00000000..b1c4d1ca --- /dev/null +++ b/Cython/Includes/python_type.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.type cimport * diff --git a/Cython/Includes/python_unicode.pxd b/Cython/Includes/python_unicode.pxd new file mode 100644 index 00000000..88fc5afb --- /dev/null +++ b/Cython/Includes/python_unicode.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.unicode cimport * diff --git a/Cython/Includes/python_version.pxd b/Cython/Includes/python_version.pxd new file mode 100644 index 00000000..93aa7f37 --- /dev/null +++ b/Cython/Includes/python_version.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.version cimport * diff --git a/Cython/Includes/python_weakref.pxd b/Cython/Includes/python_weakref.pxd new file mode 100644 index 00000000..2337d093 --- /dev/null +++ b/Cython/Includes/python_weakref.pxd @@ -0,0 +1,2 @@ +# Present for backwards compatability +from cpython.weakref cimport * diff --git a/tests/run/cython_includes.pyx b/tests/run/cython_includes.pyx index 526d5392..ddaec586 100644 --- a/tests/run/cython_includes.pyx +++ b/tests/run/cython_includes.pyx @@ -1,20 +1,23 @@ from libc.stdio cimport sprintf from python cimport PyType_Check -from cpython.type cimport PyType_Check as PyType_Check2 +from python_type cimport PyType_Check as PyType_Check2 +from cpython.type cimport PyType_Check as PyType_Check3 -def libc_imports(): +def libc_cimports(): """ - >>> libc_imports() + >>> libc_cimports() hello """ cdef char buf[10] sprintf(buf, b'hello') print (buf).decode('ASCII') -def python_imports(): +def cpython_cimports(): """ - >>> python_imports() + >>> cpython_cimports() + True + False True False True @@ -24,4 +27,6 @@ def python_imports(): print PyType_Check([]) print PyType_Check2(list) print PyType_Check2([]) + print PyType_Check3(list) + print PyType_Check3([]) -- 2.26.2