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
# 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":
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
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
+++ /dev/null
-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
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__ = {}
#
# Object access
#
-from python_ref cimport Py_INCREF, Py_DECREF
def addref(*args):
for item in args: Py_INCREF(item)
def decref(*args):
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:
__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():
a *= b
return a
-cimport stdlib
+from libc cimport stdlib
def arrays():
"""
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]