Commit fbd2fd09 authored by Robert Bradshaw's avatar Robert Bradshaw

Rename check_size extend option to ignore.

parent c9eda12b
...@@ -3066,7 +3066,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -3066,7 +3066,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
cs = 0 cs = 0
elif type.check_size == 'warn': elif type.check_size == 'warn':
cs = 1 cs = 1
elif type.check_size == 'extend': elif type.check_size == 'ignore':
cs = 2 cs = 2
else: else:
raise RuntimeError("invalid value for check_size '%s' when compiling %s.%s" % ( raise RuntimeError("invalid value for check_size '%s' when compiling %s.%s" % (
......
...@@ -4630,7 +4630,7 @@ class CClassDefNode(ClassDefNode): ...@@ -4630,7 +4630,7 @@ class CClassDefNode(ClassDefNode):
# bases TupleNode Base class(es) # bases TupleNode Base class(es)
# objstruct_name string or None Specified C name of object struct # objstruct_name string or None Specified C name of object struct
# typeobj_name string or None Specified C name of type object # typeobj_name string or None Specified C name of type object
# check_size 'warn', 'error', 'extend' What to do if tp_basicsize does not match # check_size 'warn', 'error', 'ignore' What to do if tp_basicsize does not match
# in_pxd boolean Is in a .pxd file # in_pxd boolean Is in a .pxd file
# decorators [DecoratorNode] list of decorators or None # decorators [DecoratorNode] list of decorators or None
# doc string or None # doc string or None
......
...@@ -3545,8 +3545,8 @@ def p_c_class_options(s): ...@@ -3545,8 +3545,8 @@ def p_c_class_options(s):
elif s.systring == 'check_size': elif s.systring == 'check_size':
s.next() s.next()
check_size = p_ident(s) check_size = p_ident(s)
if check_size not in ('extend', 'warn', 'error'): if check_size not in ('ignore', 'warn', 'error'):
s.error("Expected one of extend, warn or error, found %r" % check_size) s.error("Expected one of ignore, warn or error, found %r" % check_size)
if s.sy != ',': if s.sy != ',':
break break
s.next() s.next()
......
...@@ -1345,7 +1345,7 @@ class PyExtensionType(PyObjectType): ...@@ -1345,7 +1345,7 @@ class PyExtensionType(PyObjectType):
# vtable_cname string Name of C method table definition # vtable_cname string Name of C method table definition
# early_init boolean Whether to initialize early (as opposed to during module execution). # early_init boolean Whether to initialize early (as opposed to during module execution).
# defered_declarations [thunk] Used to declare class hierarchies in order # defered_declarations [thunk] Used to declare class hierarchies in order
# check_size 'warn', 'error', 'extend' What to do if tp_basicsize does not match # check_size 'warn', 'error', 'ignore' What to do if tp_basicsize does not match
is_extension_type = 1 is_extension_type = 1
has_attributes = 1 has_attributes = 1
......
...@@ -203,7 +203,7 @@ cdef extern from "numpy/arrayobject.h": ...@@ -203,7 +203,7 @@ cdef extern from "numpy/arrayobject.h":
ctypedef struct PyArray_Descr: ctypedef struct PyArray_Descr:
pass pass
ctypedef class numpy.dtype [object PyArray_Descr, check_size extend]: ctypedef class numpy.dtype [object PyArray_Descr, check_size ignore]:
# Use PyDataType_* macros when possible, however there are no macros # Use PyDataType_* macros when possible, however there are no macros
# for accessing some of the fields, so some are defined. # for accessing some of the fields, so some are defined.
cdef PyTypeObject* typeobj cdef PyTypeObject* typeobj
...@@ -239,7 +239,7 @@ cdef extern from "numpy/arrayobject.h": ...@@ -239,7 +239,7 @@ cdef extern from "numpy/arrayobject.h":
# like PyArrayObject**. # like PyArrayObject**.
pass pass
ctypedef class numpy.ndarray [object PyArrayObject, check_size extend]: ctypedef class numpy.ndarray [object PyArrayObject, check_size ignore]:
cdef __cythonbufferdefaults__ = {"mode": "strided"} cdef __cythonbufferdefaults__ = {"mode": "strided"}
cdef: cdef:
......
...@@ -771,11 +771,11 @@ Where: ...@@ -771,11 +771,11 @@ Where:
- ``object_struct_name`` is the name to assume for the type's C struct. - ``object_struct_name`` is the name to assume for the type's C struct.
- ``type_object_name`` is the name to assume for the type's statically - ``type_object_name`` is the name to assume for the type's statically
declared type object. declared type object.
- ``cs_option`` is ``warn`` (the default), ``error``, or ``extend`` and is only - ``cs_option`` is ``warn`` (the default), ``error``, or ``ignore`` and is only
used for external extension types. If ``error``, the ``sizeof(object_struct)`` used for external extension types. If ``error``, the ``sizeof(object_struct)``
that was found at compile time must match the type's runtime ``tp_basicsize`` that was found at compile time must match the type's runtime ``tp_basicsize``
exactly, otherwise the module import will fail with an error. If ``warn`` exactly, otherwise the module import will fail with an error. If ``warn``
or ``extend``, the ``object_struct`` is allowed to be smaller than the type's or ``ignore``, the ``object_struct`` is allowed to be smaller than the type's
``tp_basicsize``, which indicates the runtime type may be part of an updated ``tp_basicsize``, which indicates the runtime type may be part of an updated
module, and that the external module's developers extended the object in a module, and that the external module's developers extended the object in a
backward-compatible fashion (only adding new fields to the end of the object). backward-compatible fashion (only adding new fields to the end of the object).
......
...@@ -139,12 +139,12 @@ cdef extern from "check_size_smaller.h": ...@@ -139,12 +139,12 @@ cdef extern from "check_size_smaller.h":
cpdef public int testme(Foo f) except -1: cpdef public int testme(Foo f) except -1:
return f.f9 return f.f9
######## _check_size_extend.pyx ######## ######## _check_size_ignore.pyx ########
cdef extern from "check_size_smaller.h": cdef extern from "check_size_smaller.h":
# Allow size to be larger # Allow size to be larger
ctypedef class check_size.Foo [object FooStructSmall, check_size extend]: ctypedef class check_size.Foo [object FooStructSmall, check_size ignore]:
cdef: cdef:
int f9 int f9
...@@ -220,10 +220,10 @@ assert ret == 23 ...@@ -220,10 +220,10 @@ assert ret == 23
with warnings.catch_warnings(record=True) as w: with warnings.catch_warnings(record=True) as w:
# No warning, runtime vendor must provide backward compatibility # No warning, runtime vendor must provide backward compatibility
import _check_size_extend import _check_size_ignore
assert len(w) == 0 assert len(w) == 0
ret = _check_size_extend.testme(foo) ret = _check_size_ignore.testme(foo)
assert ret == 23 assert ret == 23
try: try:
......
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