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
31d3224c
Commit
31d3224c
authored
Mar 12, 2010
by
Craig Citro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Cython report errors during load, and fix several bugs this uncovered
parent
89c37c3c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
11 deletions
+26
-11
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+2
-2
Cython/Compiler/Errors.py
Cython/Compiler/Errors.py
+9
-3
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+6
-5
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+8
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+1
-1
No files found.
Cython/Compiler/Builtin.py
View file @
31d3224c
...
@@ -404,8 +404,8 @@ def init_builtin_structs():
...
@@ -404,8 +404,8 @@ def init_builtin_structs():
for
name
,
cname
,
attribute_types
in
builtin_structs_table
:
for
name
,
cname
,
attribute_types
in
builtin_structs_table
:
scope
=
StructOrUnionScope
(
name
)
scope
=
StructOrUnionScope
(
name
)
for
attribute_name
,
attribute_type
in
attribute_types
:
for
attribute_name
,
attribute_type
in
attribute_types
:
scope
.
declare_var
(
scope
.
declare_var
(
attribute_name
,
attribute_type
,
None
,
attribute_name
,
attribute_type
,
None
,
attribute_nam
e
)
attribute_name
,
allow_pyobject
=
Tru
e
)
builtin_scope
.
declare_struct_or_union
(
builtin_scope
.
declare_struct_or_union
(
name
,
"struct"
,
scope
,
1
,
None
,
cname
=
cname
)
name
,
"struct"
,
scope
,
1
,
None
,
cname
=
cname
)
...
...
Cython/Compiler/Errors.py
View file @
31d3224c
...
@@ -43,8 +43,12 @@ class CompileError(PyrexError):
...
@@ -43,8 +43,12 @@ class CompileError(PyrexError):
else
:
else
:
pos_str
=
u""
pos_str
=
u""
cont
=
u''
cont
=
u''
Exception
.
__init__
(
self
,
u'
\
n
Error converting Pyrex file to C:
\
n
%s
\
n
%s%s'
%
(
if
position
is
None
:
cont
,
pos_str
,
message
))
Exception
.
__init__
(
self
,
message
)
else
:
Exception
.
__init__
(
self
,
u'
\
n
Error converting Pyrex file to C:
\
n
%s
\
n
%s%s'
%
(
cont
,
pos_str
,
message
))
class
CompileWarning
(
PyrexWarning
):
class
CompileWarning
(
PyrexWarning
):
...
@@ -133,7 +137,9 @@ def report_error(err):
...
@@ -133,7 +137,9 @@ def report_error(err):
def
error
(
position
,
message
):
def
error
(
position
,
message
):
#print "Errors.error:", repr(position), repr(message) ###
#print "Errors.error:", repr(position), repr(message) ###
err
=
CompileError
(
position
,
message
)
if
position
is
None
:
raise
InternalError
(
message
)
err
=
CompileError
(
position
,
message
)
#if position is not None: raise Exception(err) # debug
#if position is not None: raise Exception(err) # debug
report_error
(
err
)
report_error
(
err
)
return
err
return
err
...
...
Cython/Compiler/Main.py
View file @
31d3224c
...
@@ -493,13 +493,14 @@ class Context(object):
...
@@ -493,13 +493,14 @@ class Context(object):
names
.
reverse
()
names
.
reverse
()
return
"."
.
join
(
names
)
return
"."
.
join
(
names
)
def
setup_errors
(
self
,
options
):
def
setup_errors
(
self
,
options
,
result
):
if
options
.
use_listing_file
:
if
options
.
use_listing_file
:
result
.
listing_file
=
Utils
.
replace_suffix
(
source
,
".lis"
)
result
.
listing_file
=
Utils
.
replace_suffix
(
source
,
".lis"
)
Errors
.
open_listing_file
(
result
.
listing_file
,
path
=
result
.
listing_file
echo_to_stderr
=
options
.
errors_to_stderr
)
else
:
else
:
Errors
.
open_listing_file
(
None
)
path
=
None
Errors
.
open_listing_file
(
path
=
path
,
echo_to_stderr
=
options
.
errors_to_stderr
)
def
teardown_errors
(
self
,
err
,
options
,
result
):
def
teardown_errors
(
self
,
err
,
options
,
result
):
source_desc
=
result
.
compilation_source
.
source_desc
source_desc
=
result
.
compilation_source
.
source_desc
...
@@ -563,7 +564,7 @@ def run_pipeline(source, options, full_module_name = None):
...
@@ -563,7 +564,7 @@ def run_pipeline(source, options, full_module_name = None):
else
:
else
:
pipeline
=
context
.
create_pyx_pipeline
(
options
,
result
)
pipeline
=
context
.
create_pyx_pipeline
(
options
,
result
)
context
.
setup_errors
(
options
)
context
.
setup_errors
(
options
,
result
)
err
,
enddata
=
context
.
run_pipeline
(
pipeline
,
source
)
err
,
enddata
=
context
.
run_pipeline
(
pipeline
,
source
)
context
.
teardown_errors
(
err
,
options
,
result
)
context
.
teardown_errors
(
err
,
options
,
result
)
return
result
return
result
...
...
Cython/Compiler/PyrexTypes.py
View file @
31d3224c
...
@@ -518,6 +518,14 @@ class PyExtensionType(PyObjectType):
...
@@ -518,6 +518,14 @@ class PyExtensionType(PyObjectType):
# know which module it's defined in, it will be imported.
# know which module it's defined in, it will be imported.
return
self
.
typeobj_cname
is
None
and
self
.
module_name
is
not
None
return
self
.
typeobj_cname
is
None
and
self
.
module_name
is
not
None
def
assignable_from
(
self
,
src_type
):
if
self
==
src_type
:
return
True
if
isinstance
(
src_type
,
PyExtensionType
):
if
src_type
.
base_type
is
not
None
:
return
self
.
assignable_from
(
src_type
.
base_type
)
return
False
def
declaration_code
(
self
,
entity_code
,
def
declaration_code
(
self
,
entity_code
,
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
,
deref
=
0
):
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
,
deref
=
0
):
if
pyrex
or
for_display
:
if
pyrex
or
for_display
:
...
...
Cython/Compiler/Symtab.py
View file @
31d3224c
...
@@ -1440,7 +1440,7 @@ class CClassScope(ClassScope):
...
@@ -1440,7 +1440,7 @@ class CClassScope(ClassScope):
args
=
type
.
args
args
=
type
.
args
if
not
args
:
if
not
args
:
error
(
pos
,
"C method has no self argument"
)
error
(
pos
,
"C method has no self argument"
)
elif
not
args
[
0
].
type
.
same_as
(
self
.
parent_
type
):
elif
not
self
.
parent_type
.
assignable_from
(
args
[
0
].
type
):
error
(
pos
,
"Self argument (%s) of C method '%s' does not match parent type (%s)"
%
error
(
pos
,
"Self argument (%s) of C method '%s' does not match parent type (%s)"
%
(
args
[
0
].
type
,
name
,
self
.
parent_type
))
(
args
[
0
].
type
,
name
,
self
.
parent_type
))
entry
=
self
.
lookup_here
(
name
)
entry
=
self
.
lookup_here
(
name
)
...
...
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