Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
fbd2fd09
Commit
fbd2fd09
authored
Oct 02, 2018
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename check_size extend option to ignore.
parent
c9eda12b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
13 deletions
+13
-13
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+1
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+2
-2
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+1
-1
Cython/Includes/numpy/__init__.pxd
Cython/Includes/numpy/__init__.pxd
+2
-2
docs/src/userguide/extension_types.rst
docs/src/userguide/extension_types.rst
+2
-2
tests/run/check_size.srctree
tests/run/check_size.srctree
+4
-4
No files found.
Cython/Compiler/ModuleNode.py
View file @
fbd2fd09
...
@@ -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"
%
(
...
...
Cython/Compiler/Nodes.py
View file @
fbd2fd09
...
@@ -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
...
...
Cython/Compiler/Parsing.py
View file @
fbd2fd09
...
@@ -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
()
...
...
Cython/Compiler/PyrexTypes.py
View file @
fbd2fd09
...
@@ -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
...
...
Cython/Includes/numpy/__init__.pxd
View file @
fbd2fd09
...
@@ -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
:
...
...
docs/src/userguide/extension_types.rst
View file @
fbd2fd09
...
@@ -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).
...
...
tests/run/check_size.srctree
View file @
fbd2fd09
...
@@ -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:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment