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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
3aad1ec5
Commit
3aad1ec5
authored
Aug 13, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed buffer [] syntax yet another time
parent
5a472980
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+7
-6
tests/compile/arrayargs.pyx
tests/compile/arrayargs.pyx
+6
-0
No files found.
Cython/Compiler/Parsing.py
View file @
3aad1ec5
...
...
@@ -1627,8 +1627,13 @@ def p_c_simple_base_type(s, self_flag, nonempty):
longness
=
longness
,
is_self_arg
=
self_flag
)
# Treat trailing [] on type as buffer access
if
s
.
sy
==
'['
:
# Treat trailing [] on type as buffer access if it appears in a context
# where declarator names are required (so that it cannot mean int[] or
# sizeof(int[SIZE]))...
#
# (This means that buffers cannot occur where there can be empty declarators,
# which is an ok restriction to make.)
if
nonempty
and
s
.
sy
==
'['
:
return
p_buffer_access
(
s
,
type_node
)
else
:
return
type_node
...
...
@@ -1637,10 +1642,6 @@ def p_buffer_access(s, base_type_node):
# s.sy == '['
pos
=
s
.
position
()
s
.
next
()
if
s
.
sy
==
']'
or
s
.
sy
==
'INT'
:
# not buffer, could be [] on C type nameless array arguments
s
.
put_back
(
'['
,
'['
)
return
base_type_node
positional_args
,
keyword_args
=
(
p_positional_and_keyword_args
(
s
,
(
']'
,),
(
0
,),
(
'dtype'
,))
)
...
...
tests/compile/arrayargs.pyx
View file @
3aad1ec5
cdef
extern
from
*
:
cdef
void
foo
(
int
[])
...
...
@@ -17,3 +18,8 @@ cdef struct OtherStruct:
a
=
sizeof
(
int
[
23
][
34
])
b
=
sizeof
(
OtherStruct
[
43
])
DEF
COUNT
=
4
c
=
sizeof
(
int
[
COUNT
])
d
=
sizeof
(
OtherStruct
[
COUNT
])
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