Commit 9e7fdef1 authored by mattip's avatar mattip

MAINT: fixes from review

parent 920aee84
...@@ -3067,9 +3067,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -3067,9 +3067,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
cs = 0 cs = 0
elif type.check_size == 'min': elif type.check_size == 'min':
cs = 1 cs = 1
elif type.check_size == 'True': elif type.check_size == True:
cs = 0 cs = 0
elif type.check_size == 'False': elif type.check_size == False:
cs = 2 cs = 2
else: else:
raise AttributeError("invalid value for check_size '%s' when compiling " raise AttributeError("invalid value for check_size '%s' when compiling "
......
...@@ -3544,6 +3544,14 @@ def p_c_class_options(s): ...@@ -3544,6 +3544,14 @@ 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 == 'False':
check_size = False
elif check_size == 'True':
check_size = True
elif check_size == 'min':
pass
else:
s.error('Expected False, True, or min, not %r' % check_size)
if s.sy != ',': if s.sy != ',':
break break
s.next() s.next()
......
...@@ -4,6 +4,7 @@ PYTHON -c "import runner" ...@@ -4,6 +4,7 @@ PYTHON -c "import runner"
######## setup.py ######## ######## setup.py ########
from Cython.Build.Dependencies import cythonize from Cython.Build.Dependencies import cythonize
from Cython.Compiler.Errors import CompileError
from distutils.core import setup from distutils.core import setup
# force the build order # force the build order
...@@ -14,8 +15,8 @@ setup(ext_modules = cythonize("_check_size*.pyx")) ...@@ -14,8 +15,8 @@ setup(ext_modules = cythonize("_check_size*.pyx"))
try: try:
setup(ext_modules= cythonize("check_size6.pyx")) setup(ext_modules= cythonize("check_size6.pyx"))
assert False assert False
except AttributeError as e: except CompileError as e:
assert 'max' in str(e) pass
######## check_size_nominal.h ######## ######## check_size_nominal.h ########
...@@ -168,7 +169,7 @@ cpdef public int testme(Foo f) except -1: ...@@ -168,7 +169,7 @@ cpdef public int testme(Foo f) except -1:
cdef extern from "check_size_smaller.h": cdef extern from "check_size_smaller.h":
# Raise AttributeError when using bad value # Raise Compilerror when using bad value
ctypedef class check_size.Foo [object FooStructSmall, check_size max]: ctypedef class check_size.Foo [object FooStructSmall, check_size max]:
cdef: cdef:
int f9 int f9
......
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