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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
75c3536e
Commit
75c3536e
authored
Dec 09, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix fatal errors + nice exception traceback interaction.
parent
c6ecb09c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
16 deletions
+26
-16
Cython/Compiler/Errors.py
Cython/Compiler/Errors.py
+7
-2
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+17
-14
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+2
-0
No files found.
Cython/Compiler/Errors.py
View file @
75c3536e
...
@@ -61,7 +61,6 @@ class CompileWarning(PyrexWarning):
...
@@ -61,7 +61,6 @@ class CompileWarning(PyrexWarning):
# self.message = message
# self.message = message
Exception
.
__init__
(
self
,
format_position
(
position
)
+
message
)
Exception
.
__init__
(
self
,
format_position
(
position
)
+
message
)
class
InternalError
(
Exception
):
class
InternalError
(
Exception
):
# If this is ever raised, there is a bug in the compiler.
# If this is ever raised, there is a bug in the compiler.
...
@@ -70,6 +69,12 @@ class InternalError(Exception):
...
@@ -70,6 +69,12 @@ class InternalError(Exception):
Exception
.
__init__
(
self
,
u"Internal compiler error: %s"
Exception
.
__init__
(
self
,
u"Internal compiler error: %s"
%
message
)
%
message
)
class
AbortError
(
Exception
):
# Throw this to stop the compilation immediately.
def
__init__
(
self
,
message
):
self
.
message_only
=
message
Exception
.
__init__
(
self
,
u"Abort error: %s"
%
message
)
class
CompilerCrash
(
CompileError
):
class
CompilerCrash
(
CompileError
):
# raised when an unexpected exception occurs in a transform
# raised when an unexpected exception occurs in a transform
...
@@ -140,7 +145,7 @@ def report_error(err):
...
@@ -140,7 +145,7 @@ def report_error(err):
echo_file
.
write
(
line
.
encode
(
'ASCII'
,
'replace'
))
echo_file
.
write
(
line
.
encode
(
'ASCII'
,
'replace'
))
num_errors
=
num_errors
+
1
num_errors
=
num_errors
+
1
if
Options
.
fatal_errors
:
if
Options
.
fatal_errors
:
raise
InternalError
,
"abort
"
raise
AbortError
,
"fatal errors
"
def
error
(
position
,
message
):
def
error
(
position
,
message
):
#print "Errors.error:", repr(position), repr(message) ###
#print "Errors.error:", repr(position), repr(message) ###
...
...
Cython/Compiler/Main.py
View file @
75c3536e
...
@@ -19,7 +19,7 @@ import Errors
...
@@ -19,7 +19,7 @@ import Errors
import
Parsing
import
Parsing
import
Version
import
Version
from
Scanning
import
PyrexScanner
,
FileSourceDescriptor
from
Scanning
import
PyrexScanner
,
FileSourceDescriptor
from
Errors
import
PyrexError
,
CompileError
,
InternalError
,
error
,
warning
from
Errors
import
PyrexError
,
CompileError
,
InternalError
,
AbortError
,
error
,
warning
from
Symtab
import
BuiltinScope
,
ModuleScope
from
Symtab
import
BuiltinScope
,
ModuleScope
from
Cython
import
Utils
from
Cython
import
Utils
from
Cython.Utils
import
open_new_file
,
replace_suffix
from
Cython.Utils
import
open_new_file
,
replace_suffix
...
@@ -38,7 +38,7 @@ def dumptree(t):
...
@@ -38,7 +38,7 @@ def dumptree(t):
def
abort_on_errors
(
node
):
def
abort_on_errors
(
node
):
# Stop the pipeline if there are any errors.
# Stop the pipeline if there are any errors.
if
Errors
.
num_errors
!=
0
:
if
Errors
.
num_errors
!=
0
:
raise
InternalError
,
"abort
"
raise
AbortError
,
"pipeline break
"
return
node
return
node
class
CompilationData
(
object
):
class
CompilationData
(
object
):
...
@@ -217,6 +217,7 @@ class Context(object):
...
@@ -217,6 +217,7 @@ class Context(object):
def
run_pipeline
(
self
,
pipeline
,
source
):
def
run_pipeline
(
self
,
pipeline
,
source
):
error
=
None
error
=
None
data
=
source
data
=
source
try
:
try
:
try
:
for
phase
in
pipeline
:
for
phase
in
pipeline
:
if
phase
is
not
None
:
if
phase
is
not
None
:
...
@@ -235,6 +236,8 @@ class Context(object):
...
@@ -235,6 +236,8 @@ class Context(object):
if
Errors
.
num_errors
==
0
:
if
Errors
.
num_errors
==
0
:
raise
raise
error
=
err
error
=
err
except
AbortError
,
err
:
error
=
err
return
(
error
,
data
)
return
(
error
,
data
)
def
find_module
(
self
,
module_name
,
def
find_module
(
self
,
module_name
,
...
...
Cython/Compiler/Visitor.py
View file @
75c3536e
...
@@ -173,6 +173,8 @@ class TreeVisitor(object):
...
@@ -173,6 +173,8 @@ class TreeVisitor(object):
result
=
handler_method
(
child
)
result
=
handler_method
(
child
)
except
Errors
.
CompileError
:
except
Errors
.
CompileError
:
raise
raise
except
Errors
.
AbortError
:
raise
except
Exception
,
e
:
except
Exception
,
e
:
if
DebugFlags
.
debug_no_exception_intercept
:
if
DebugFlags
.
debug_no_exception_intercept
:
raise
raise
...
...
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