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
b137e585
Commit
b137e585
authored
Mar 25, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better error when user-declared type conflicts with builtin type (#170)
parent
5dbb42b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+4
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-0
tests/errors/builtin_type_conflict_T170.pyx
tests/errors/builtin_type_conflict_T170.pyx
+8
-0
No files found.
Cython/Compiler/Builtin.py
View file @
b137e585
...
@@ -340,10 +340,14 @@ def init_builtin_funcs():
...
@@ -340,10 +340,14 @@ def init_builtin_funcs():
for
desc
in
builtin_function_table
:
for
desc
in
builtin_function_table
:
declare_builtin_func
(
*
desc
)
declare_builtin_func
(
*
desc
)
builtin_types
=
{}
def
init_builtin_types
():
def
init_builtin_types
():
global
builtin_types
for
name
,
cname
,
funcs
in
builtin_types_table
:
for
name
,
cname
,
funcs
in
builtin_types_table
:
utility
=
builtin_utility_code
.
get
(
name
)
utility
=
builtin_utility_code
.
get
(
name
)
the_type
=
builtin_scope
.
declare_builtin_type
(
name
,
cname
,
utility
)
the_type
=
builtin_scope
.
declare_builtin_type
(
name
,
cname
,
utility
)
builtin_types
[
name
]
=
the_type
for
name
,
args
,
ret
,
cname
in
funcs
:
for
name
,
args
,
ret
,
cname
in
funcs
:
sig
=
Signature
(
args
,
ret
)
sig
=
Signature
(
args
,
ret
)
the_type
.
scope
.
declare_cfunction
(
name
,
sig
.
function_type
(),
None
,
cname
)
the_type
.
scope
.
declare_cfunction
(
name
,
sig
.
function_type
(),
None
,
cname
)
...
...
Cython/Compiler/Nodes.py
View file @
b137e585
...
@@ -2676,6 +2676,12 @@ class CClassDefNode(ClassDefNode):
...
@@ -2676,6 +2676,12 @@ class CClassDefNode(ClassDefNode):
return
return
else
:
else
:
home_scope
=
env
home_scope
=
env
if
self
.
visibility
==
'extern'
:
if
self
.
module_name
==
'__builtin__'
and
self
.
class_name
in
Builtin
.
builtin_types
:
error
(
self
.
pos
,
"%s already a builtin Cython type"
%
self
.
class_name
)
return
self
.
entry
=
home_scope
.
declare_c_class
(
self
.
entry
=
home_scope
.
declare_c_class
(
name
=
self
.
class_name
,
name
=
self
.
class_name
,
pos
=
self
.
pos
,
pos
=
self
.
pos
,
...
...
tests/errors/builtin_type_conflict_T170.pyx
0 → 100644
View file @
b137e585
cdef
extern
from
*
:
ctypedef
class
__builtin__
.
list
[
object
PyListObject
]:
pass
cdef
list
foo
=
[]
_ERRORS
=
u"""
:2:4: list already a builtin Cython type
"""
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