summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2018-09-25 23:15:29 +0300
committermattip <matti.picus@gmail.com>2018-09-25 23:15:29 +0300
commit9e7fdef1de7b185f3c6925cecefea746e6e83853 (patch)
tree5236a0a927bd3119609a3ac880a8af924863062f
parent920aee8428edecc367865cc806ca026c61fd6827 (diff)
downloadcython-9e7fdef1de7b185f3c6925cecefea746e6e83853.tar.gz
MAINT: fixes from review
-rw-r--r--Cython/Compiler/ModuleNode.py4
-rw-r--r--Cython/Compiler/Parsing.py8
-rw-r--r--tests/run/check_size.srctree7
3 files changed, 14 insertions, 5 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 2152f4847..6764e6db9 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -3067,9 +3067,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
cs = 0
elif type.check_size == 'min':
cs = 1
- elif type.check_size == 'True':
+ elif type.check_size == True:
cs = 0
- elif type.check_size == 'False':
+ elif type.check_size == False:
cs = 2
else:
raise AttributeError("invalid value for check_size '%s' when compiling "
diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py
index 300615a43..c71d7cc38 100644
--- a/Cython/Compiler/Parsing.py
+++ b/Cython/Compiler/Parsing.py
@@ -3544,6 +3544,14 @@ def p_c_class_options(s):
elif s.systring == 'check_size':
s.next()
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 != ',':
break
s.next()
diff --git a/tests/run/check_size.srctree b/tests/run/check_size.srctree
index 0c4116184..8391534e4 100644
--- a/tests/run/check_size.srctree
+++ b/tests/run/check_size.srctree
@@ -4,6 +4,7 @@ PYTHON -c "import runner"
######## setup.py ########
from Cython.Build.Dependencies import cythonize
+from Cython.Compiler.Errors import CompileError
from distutils.core import setup
# force the build order
@@ -14,8 +15,8 @@ setup(ext_modules = cythonize("_check_size*.pyx"))
try:
setup(ext_modules= cythonize("check_size6.pyx"))
assert False
-except AttributeError as e:
- assert 'max' in str(e)
+except CompileError as e:
+ pass
######## check_size_nominal.h ########
@@ -168,7 +169,7 @@ cpdef public int testme(Foo f) except -1:
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]:
cdef:
int f9