Merge branch 'bugs'
authorRobert Bradshaw <robertwb@math.washington.edu>
Fri, 9 Nov 2012 21:22:55 +0000 (13:22 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Fri, 9 Nov 2012 21:22:55 +0000 (13:22 -0800)
Conflicts:
Cython/Compiler/Optimize.py
Cython/Compiler/TypeInference.py

1  2 
CHANGES.rst
Cython/Compiler/FusedNode.py
Cython/Compiler/ModuleNode.py
Cython/Compiler/Nodes.py
Cython/Compiler/PyrexTypes.py
Cython/Compiler/Symtab.py
Cython/Compiler/TypeInference.py
Cython/Shadow.py

diff --cc CHANGES.rst
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -442,16 -442,16 +442,20 @@@ def aggressive_spanning_type(types, mig
      result_type = reduce(find_spanning_type, types)
      if result_type.is_reference:
          result_type = result_type.ref_base_type
 +    if result_type.is_const:
 +        result_type = result_type.const_base_type
+     if result_type.is_cpp_class:
+         result_type.check_nullary_constructor(pos)
      return result_type
  
- def safe_spanning_type(types, might_overflow):
+ def safe_spanning_type(types, might_overflow, pos):
      result_type = reduce(find_spanning_type, types)
 +    if result_type.is_const:
 +        result_type = result_type.const_base_type
      if result_type.is_reference:
          result_type = result_type.ref_base_type
+     if result_type.is_cpp_class:
+         result_type.check_nullary_constructor(pos)
      if result_type.is_pyobject:
          # In theory, any specific Python type is always safe to
          # infer. However, inferring str can cause some existing code
@@@ -1,6 -1,65 +1,66 @@@
  # cython.* namespace for pure mode.
 +__version__ = "0.18-pre"
  
+ # Shamelessly copied from Cython/minivect/minitypes.py
+ class _ArrayType(object):
+     is_array = True
+     subtypes = ['dtype']
+     def __init__(self, dtype, ndim, is_c_contig=False, is_f_contig=False,
+                  inner_contig=False, broadcasting=None):
+         self.dtype = dtype
+         self.ndim = ndim
+         self.is_c_contig = is_c_contig
+         self.is_f_contig = is_f_contig
+         self.inner_contig = inner_contig or is_c_contig or is_f_contig
+         self.broadcasting = broadcasting
+     def __repr__(self):
+         axes = [":"] * self.ndim
+         if self.is_c_contig:
+             axes[-1] = "::1"
+         elif self.is_f_contig:
+             axes[0] = "::1"
+         return "%s[%s]" % (self.dtype, ", ".join(axes))
+ def index_type(base_type, item):
+     """
+     Support array type creation by slicing, e.g. double[:, :] specifies
+     a 2D strided array of doubles. The syntax is the same as for
+     Cython memoryviews.
+     """
+     assert isinstance(item, (tuple, slice))
+     def verify_slice(s):
+         if s.start or s.stop or s.step not in (None, 1):
+             raise minierror.InvalidTypeSpecification(
+                 "Only a step of 1 may be provided to indicate C or "
+                 "Fortran contiguity")
+     if isinstance(item, tuple):
+         step_idx = None
+         for idx, s in enumerate(item):
+             verify_slice(s)
+             if s.step and (step_idx or idx not in (0, len(item) - 1)):
+                 raise minierror.InvalidTypeSpecification(
+                     "Step may only be provided once, and only in the "
+                     "first or last dimension.")
+             if s.step == 1:
+                 step_idx = idx
+         return _ArrayType(base_type, len(item),
+                           is_c_contig=step_idx == len(item) - 1,
+                           is_f_contig=step_idx == 0)
+     else:
+         verify_slice(item)
+         return _ArrayType(base_type, 1, is_c_contig=bool(item.step))
+ # END shameless copy
  compiled = False
  
  _Unspecified = object()