Commit 0d04f2bb authored by Lisandro Dalcin's avatar Lisandro Dalcin

move legacy pxd files to Cython/Includes/Deprecated

--HG--
rename : Cython/Includes/python.pxd => Cython/Includes/Deprecated/python.pxd
rename : Cython/Includes/python2.5.pxd => Cython/Includes/Deprecated/python2.5.pxd
rename : Cython/Includes/python_bool.pxd => Cython/Includes/Deprecated/python_bool.pxd
rename : Cython/Includes/python_buffer.pxd => Cython/Includes/Deprecated/python_buffer.pxd
rename : Cython/Includes/python_bytes.pxd => Cython/Includes/Deprecated/python_bytes.pxd
rename : Cython/Includes/python_cobject.pxd => Cython/Includes/Deprecated/python_cobject.pxd
rename : Cython/Includes/python_complex.pxd => Cython/Includes/Deprecated/python_complex.pxd
rename : Cython/Includes/python_dict.pxd => Cython/Includes/Deprecated/python_dict.pxd
rename : Cython/Includes/python_exc.pxd => Cython/Includes/Deprecated/python_exc.pxd
rename : Cython/Includes/python_float.pxd => Cython/Includes/Deprecated/python_float.pxd
rename : Cython/Includes/python_function.pxd => Cython/Includes/Deprecated/python_function.pxd
rename : Cython/Includes/python_getargs.pxd => Cython/Includes/Deprecated/python_getargs.pxd
rename : Cython/Includes/python_instance.pxd => Cython/Includes/Deprecated/python_instance.pxd
rename : Cython/Includes/python_int.pxd => Cython/Includes/Deprecated/python_int.pxd
rename : Cython/Includes/python_iterator.pxd => Cython/Includes/Deprecated/python_iterator.pxd
rename : Cython/Includes/python_list.pxd => Cython/Includes/Deprecated/python_list.pxd
rename : Cython/Includes/python_long.pxd => Cython/Includes/Deprecated/python_long.pxd
rename : Cython/Includes/python_mapping.pxd => Cython/Includes/Deprecated/python_mapping.pxd
rename : Cython/Includes/python_mem.pxd => Cython/Includes/Deprecated/python_mem.pxd
rename : Cython/Includes/python_method.pxd => Cython/Includes/Deprecated/python_method.pxd
rename : Cython/Includes/python_module.pxd => Cython/Includes/Deprecated/python_module.pxd
rename : Cython/Includes/python_number.pxd => Cython/Includes/Deprecated/python_number.pxd
rename : Cython/Includes/python_object.pxd => Cython/Includes/Deprecated/python_object.pxd
rename : Cython/Includes/python_oldbuffer.pxd => Cython/Includes/Deprecated/python_oldbuffer.pxd
rename : Cython/Includes/python_pycapsule.pxd => Cython/Includes/Deprecated/python_pycapsule.pxd
rename : Cython/Includes/python_ref.pxd => Cython/Includes/Deprecated/python_ref.pxd
rename : Cython/Includes/python_sequence.pxd => Cython/Includes/Deprecated/python_sequence.pxd
rename : Cython/Includes/python_set.pxd => Cython/Includes/Deprecated/python_set.pxd
rename : Cython/Includes/python_string.pxd => Cython/Includes/Deprecated/python_string.pxd
rename : Cython/Includes/python_tuple.pxd => Cython/Includes/Deprecated/python_tuple.pxd
rename : Cython/Includes/python_type.pxd => Cython/Includes/Deprecated/python_type.pxd
rename : Cython/Includes/python_unicode.pxd => Cython/Includes/Deprecated/python_unicode.pxd
rename : Cython/Includes/python_version.pxd => Cython/Includes/Deprecated/python_version.pxd
rename : Cython/Includes/python_weakref.pxd => Cython/Includes/Deprecated/python_weakref.pxd
rename : Cython/Includes/stdio.pxd => Cython/Includes/Deprecated/stdio.pxd
rename : Cython/Includes/stdlib.pxd => Cython/Includes/Deprecated/stdlib.pxd
rename : Cython/Includes/stl.pxd => Cython/Includes/Deprecated/stl.pxd
parent 3e116a8a
......@@ -19,7 +19,7 @@ import Errors
import Parsing
import Version
from Scanning import PyrexScanner, FileSourceDescriptor
from Errors import PyrexError, CompileError, InternalError, error
from Errors import PyrexError, CompileError, InternalError, error, warning
from Symtab import BuiltinScope, ModuleScope
from Cython import Utils
from Cython.Utils import open_new_file, replace_suffix
......@@ -321,7 +321,27 @@ class Context(object):
# the directory containing the source file is searched first
# for a dotted filename, and its containing package root
# directory is searched first for a non-dotted filename.
return self.search_include_directories(qualified_name, ".pxd", pos)
pxd = self.search_include_directories(qualified_name, ".pxd", pos)
if pxd is None: # XXX Keep this until Includes/Deprecated is removed
if (qualified_name.startswith('python') or
qualified_name in ('stdlib', 'stdio', 'stl')):
standard_include_path = os.path.abspath(os.path.normpath(
os.path.join(os.path.dirname(__file__), os.path.pardir, 'Includes')))
deprecated_include_path = os.path.join(standard_include_path, 'Deprecated')
self.include_directories.append(deprecated_include_path)
try:
pxd = self.search_include_directories(qualified_name, ".pxd", pos)
finally:
self.include_directories.pop()
if pxd:
name = qualified_name
if name.startswith('python'):
warning(pos, "'%s' is deprecated, use 'cpython'" % name, 1)
elif name in ('stdlib', 'stdio'):
warning(pos, "'%s' is deprecated, use 'libc.%s'" % (name, name), 1)
elif name in ('stl'):
warning(pos, "'%s' is deprecated, use 'libcpp.*.*'" % name, 1)
return pxd
def find_pyx_file(self, qualified_name, pos):
# Search include path for the .pyx file corresponding to the
......
from cpython.ref cimport PyObject, PyTypeObject
from stdio cimport FILE
from libc.stdio cimport FILE
cdef extern from "Python.h":
......
......@@ -16,10 +16,10 @@
DEF _buffer_format_string_len = 255
cimport python_buffer as pybuf
from python_ref cimport PyObject, Py_INCREF, Py_XDECREF
cimport stdlib
cimport stdio
cimport cpython.buffer as pybuf
from cpython cimport PyObject, Py_INCREF, Py_XDECREF
from libc cimport stdlib
from libc cimport stdio
cdef extern from "Python.h":
ctypedef int Py_intptr_t
......
......@@ -6,7 +6,7 @@
print 3
cimport python_dict as asadf, python_exc, cython as cy
cimport cython as cy
def e(object[int, ndim=2] buf):
print buf[3, 2] # no bc
......
cimport python_bool
cimport python_buffer
cimport python_bytes
cimport python_cobject
cimport python_complex
cimport python_dict
cimport python_exc
cimport python_float
cimport python_function
cimport python_getargs
cimport python_instance
cimport python_int
cimport python_iterator
cimport python_list
cimport python_long
cimport python_mapping
cimport python_mem
cimport python_method
cimport python_module
cimport python_number
cimport python_object
cimport python
cimport python_pycapsule
cimport python_ref
cimport python_sequence
cimport python_set
cimport python_string
cimport python_tuple
cimport python_type
cimport python_unicode
cimport python_version
cimport python_weakref
cimport stdio
cimport stdlib
......@@ -9,12 +9,12 @@
from __future__ import unicode_literals
cimport stdlib
cimport python_buffer
cimport stdio
from libc cimport stdlib
from libc cimport stdio
cimport cpython.buffer
cimport cython
from python_ref cimport PyObject
from cpython cimport PyObject, Py_INCREF, Py_DECREF
__test__ = {}
......@@ -871,7 +871,6 @@ def printbuf_td_h_double(object[td_h_double] buf, shape):
#
# Object access
#
from python_ref cimport Py_INCREF, Py_DECREF
def addref(*args):
for item in args: Py_INCREF(item)
def decref(*args):
......@@ -983,13 +982,13 @@ def buffer_cast_fails(object[char, cast=True] buf):
available_flags = (
('FORMAT', python_buffer.PyBUF_FORMAT),
('INDIRECT', python_buffer.PyBUF_INDIRECT),
('ND', python_buffer.PyBUF_ND),
('STRIDES', python_buffer.PyBUF_STRIDES),
('C_CONTIGUOUS', python_buffer.PyBUF_C_CONTIGUOUS),
('F_CONTIGUOUS', python_buffer.PyBUF_F_CONTIGUOUS),
('WRITABLE', python_buffer.PyBUF_WRITABLE)
('FORMAT', cpython.buffer.PyBUF_FORMAT),
('INDIRECT', cpython.buffer.PyBUF_INDIRECT),
('ND', cpython.buffer.PyBUF_ND),
('STRIDES', cpython.buffer.PyBUF_STRIDES),
('C_CONTIGUOUS', cpython.buffer.PyBUF_C_CONTIGUOUS),
('F_CONTIGUOUS', cpython.buffer.PyBUF_F_CONTIGUOUS),
('WRITABLE', cpython.buffer.PyBUF_WRITABLE)
)
cdef class MockBuffer:
......
......@@ -7,7 +7,7 @@ def testcase(func):
__test__[func.__name__] = func.__doc__
return func
cimport stdlib
from libc cimport stdlib
def little_endian():
cdef unsigned int n = 1
......
from libc.stdio cimport sprintf
from python cimport PyType_Check
from python_type cimport PyType_Check as PyType_Check2
from cpython cimport PyType_Check
from cpython cimport PyType_Check as PyType_Check2
from cpython.type cimport PyType_Check as PyType_Check3
def libc_cimports():
......
......@@ -30,7 +30,7 @@ def h(double a, double b):
a *= b
return a
cimport stdlib
from libc cimport stdlib
def arrays():
"""
......
......@@ -11,7 +11,7 @@ if sys.version_info[0] >= 3:
cdef extern from "string.h":
void memcpy(char *d, char *s, int n)
from python_unicode cimport PyUnicode_DecodeUTF8
from cpython cimport PyUnicode_DecodeUTF8
def spam():
cdef char buf[12]
......
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