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
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
Hide 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):
# self.message = message
Exception
.
__init__
(
self
,
format_position
(
position
)
+
message
)
class
InternalError
(
Exception
):
# If this is ever raised, there is a bug in the compiler.
...
...
@@ -70,6 +69,12 @@ class InternalError(Exception):
Exception
.
__init__
(
self
,
u"Internal compiler error: %s"
%
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
):
# raised when an unexpected exception occurs in a transform
...
...
@@ -140,7 +145,7 @@ def report_error(err):
echo_file
.
write
(
line
.
encode
(
'ASCII'
,
'replace'
))
num_errors
=
num_errors
+
1
if
Options
.
fatal_errors
:
raise
InternalError
,
"abort
"
raise
AbortError
,
"fatal errors
"
def
error
(
position
,
message
):
#print "Errors.error:", repr(position), repr(message) ###
...
...
Cython/Compiler/Main.py
View file @
75c3536e
...
...
@@ -19,7 +19,7 @@ import Errors
import
Parsing
import
Version
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
Cython
import
Utils
from
Cython.Utils
import
open_new_file
,
replace_suffix
...
...
@@ -38,7 +38,7 @@ def dumptree(t):
def
abort_on_errors
(
node
):
# Stop the pipeline if there are any errors.
if
Errors
.
num_errors
!=
0
:
raise
InternalError
,
"abort
"
raise
AbortError
,
"pipeline break
"
return
node
class
CompilationData
(
object
):
...
...
@@ -218,23 +218,26 @@ class Context(object):
error
=
None
data
=
source
try
:
for
phase
in
pipeline
:
if
phase
is
not
None
:
if
DebugFlags
.
debug_verbose_pipeline
:
t
=
time
()
print
"Entering pipeline phase %r"
%
phase
data
=
phase
(
data
)
if
DebugFlags
.
debug_verbose_pipeline
:
print
" %.3f seconds"
%
(
time
()
-
t
)
except
CompileError
,
err
:
# err is set
Errors
.
report_error
(
err
)
error
=
err
try
:
for
phase
in
pipeline
:
if
phase
is
not
None
:
if
DebugFlags
.
debug_verbose_pipeline
:
t
=
time
()
print
"Entering pipeline phase %r"
%
phase
data
=
phase
(
data
)
if
DebugFlags
.
debug_verbose_pipeline
:
print
" %.3f seconds"
%
(
time
()
-
t
)
except
CompileError
,
err
:
# err is set
Errors
.
report_error
(
err
)
error
=
err
except
InternalError
,
err
:
# Only raise if there was not an earlier error
if
Errors
.
num_errors
==
0
:
raise
error
=
err
except
AbortError
,
err
:
error
=
err
return
(
error
,
data
)
def
find_module
(
self
,
module_name
,
...
...
Cython/Compiler/Visitor.py
View file @
75c3536e
...
...
@@ -173,6 +173,8 @@ class TreeVisitor(object):
result
=
handler_method
(
child
)
except
Errors
.
CompileError
:
raise
except
Errors
.
AbortError
:
raise
except
Exception
,
e
:
if
DebugFlags
.
debug_no_exception_intercept
:
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