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
bcf5b71e
Commit
bcf5b71e
authored
Mar 25, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
ffa0747f
e1881e05
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
2 deletions
+42
-2
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+8
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+11
-1
tests/errors/builtin_type_conflict_T170.pyx
tests/errors/builtin_type_conflict_T170.pyx
+15
-0
tests/errors/missing_self_in_cpdef_method_T165.pyx
tests/errors/missing_self_in_cpdef_method_T165.pyx
+8
-0
No files found.
Cython/Compiler/Builtin.py
View file @
bcf5b71e
...
...
@@ -91,7 +91,10 @@ builtin_types_table = [
(
"int"
,
"PyInt_Type"
,
[]),
(
"long"
,
"PyLong_Type"
,
[]),
(
"float"
,
"PyFloat_Type"
,
[]),
(
"complex"
,
"PyComplex_Type"
,
[]),
# Until we have a way to access attributes of a type,
# we don't want to make this one builtin.
# ("complex", "PyComplex_Type", []),
(
"bytes"
,
"PyBytes_Type"
,
[]),
(
"str"
,
"PyString_Type"
,
[]),
...
...
@@ -340,10 +343,14 @@ def init_builtin_funcs():
for
desc
in
builtin_function_table
:
declare_builtin_func
(
*
desc
)
builtin_types
=
{}
def
init_builtin_types
():
global
builtin_types
for
name
,
cname
,
funcs
in
builtin_types_table
:
utility
=
builtin_utility_code
.
get
(
name
)
the_type
=
builtin_scope
.
declare_builtin_type
(
name
,
cname
,
utility
)
builtin_types
[
name
]
=
the_type
for
name
,
args
,
ret
,
cname
in
funcs
:
sig
=
Signature
(
args
,
ret
)
the_type
.
scope
.
declare_cfunction
(
name
,
sig
.
function_type
(),
None
,
cname
)
...
...
Cython/Compiler/Nodes.py
View file @
bcf5b71e
...
...
@@ -1335,7 +1335,12 @@ class CFuncDefNode(FuncDefNode):
self
.
entry
.
inline_func_in_pxd
=
self
.
inline_in_pxd
self
.
return_type
=
type
.
return_type
if
self
.
overridable
and
len
(
self
.
args
)
>
0
:
if
self
.
overridable
and
not
env
.
is_module_scope
:
if
len
(
self
.
args
)
<
1
or
not
self
.
args
[
0
].
type
.
is_pyobject
:
# An error will be produced in the cdef function
self
.
overridable
=
False
if
self
.
overridable
:
import
ExprNodes
py_func_body
=
self
.
call_self_node
(
is_module_scope
=
env
.
is_module_scope
)
self
.
py_func
=
DefNode
(
pos
=
self
.
pos
,
...
...
@@ -2669,6 +2674,11 @@ class CClassDefNode(ClassDefNode):
return
else
:
home_scope
=
env
if
self
.
visibility
==
'extern'
:
if
self
.
module_name
==
'__builtin__'
and
self
.
class_name
in
Builtin
.
builtin_types
:
warning
(
self
.
pos
,
"%s already a builtin Cython type"
%
self
.
class_name
,
1
)
self
.
entry
=
home_scope
.
declare_c_class
(
name
=
self
.
class_name
,
pos
=
self
.
pos
,
...
...
tests/errors/builtin_type_conflict_T170.pyx
0 → 100644
View file @
bcf5b71e
cdef
extern
from
*
:
ctypedef
class
__builtin__
.
list
[
object
PyListObject
]:
pass
cdef
list
foo
=
[]
# This is too invasive for Python 0.11.x, re-enable in 0.12
NEW_ERRORS
=
u"""
:2:4: list already a builtin Cython type
"""
_ERRORS
=
u"""
:5:16: Cannot coerce list to type 'list'
"""
tests/
bug
s/missing_self_in_cpdef_method_T165.pyx
→
tests/
error
s/missing_self_in_cpdef_method_T165.pyx
View file @
bcf5b71e
...
...
@@ -3,3 +3,6 @@ cdef class A:
cpdef
a
(
int
not_self
):
pass
_ERRORS
=
u"""
3:10: Self argument (int) of C method 'a' does not match parent type (A)
"""
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