Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
cd9f3a0f
Commit
cd9f3a0f
authored
Apr 06, 2015
by
Michael Arntzenius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add switch to turn some fatal errors into python exceptions
parent
dd25db82
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
168 additions
and
78 deletions
+168
-78
src/capi/abstract.cpp
src/capi/abstract.cpp
+94
-48
src/capi/object.cpp
src/capi/object.cpp
+6
-2
src/core/options.cpp
src/core/options.cpp
+1
-0
src/core/options.h
src/core/options.h
+1
-1
src/jit.cpp
src/jit.cpp
+3
-1
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+6
-3
src/runtime/capi.cpp
src/runtime/capi.cpp
+53
-23
src/runtime/capi.h
src/runtime/capi.h
+4
-0
No files found.
src/capi/abstract.cpp
View file @
cd9f3a0f
This diff is collapsed.
Click to expand it.
src/capi/object.cpp
View file @
cd9f3a0f
...
@@ -499,7 +499,8 @@ extern "C" int PyObject_RichCompareBool(PyObject* v, PyObject* w, int op) noexce
...
@@ -499,7 +499,8 @@ extern "C" int PyObject_RichCompareBool(PyObject* v, PyObject* w, int op) noexce
// I'm not sure how we can support this one:
// I'm not sure how we can support this one:
extern
"C"
PyObject
**
_PyObject_GetDictPtr
(
PyObject
*
obj
)
noexcept
{
extern
"C"
PyObject
**
_PyObject_GetDictPtr
(
PyObject
*
obj
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
/* These methods are used to control infinite recursion in repr, str, print,
/* These methods are used to control infinite recursion in repr, str, print,
...
@@ -564,6 +565,9 @@ extern "C" void Py_ReprLeave(PyObject* obj) noexcept {
...
@@ -564,6 +565,9 @@ extern "C" void Py_ReprLeave(PyObject* obj) noexcept {
}
}
extern
"C"
int
PyObject_Compare
(
PyObject
*
o1
,
PyObject
*
o2
)
noexcept
{
extern
"C"
int
PyObject_Compare
(
PyObject
*
o1
,
PyObject
*
o2
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
// 'On error, the value returned is undefined; use PyErr_Occurred() to detect an error.'
// - https://docs.python.org/2/c-api/object.html
return
0xdeadbeef
;
}
}
}
}
src/core/options.cpp
View file @
cd9f3a0f
...
@@ -29,6 +29,7 @@ int PYTHON_VERSION_HEX = version_hex(PYTHON_VERSION_MAJOR, PYTHON_VERSION_MINOR,
...
@@ -29,6 +29,7 @@ int PYTHON_VERSION_HEX = version_hex(PYTHON_VERSION_MAJOR, PYTHON_VERSION_MINOR,
int
MAX_OPT_ITERATIONS
=
1
;
int
MAX_OPT_ITERATIONS
=
1
;
bool
CONTINUE_AFTER_FATAL
=
false
;
bool
FORCE_INTERPRETER
=
false
;
bool
FORCE_INTERPRETER
=
false
;
bool
FORCE_OPTIMIZE
=
false
;
bool
FORCE_OPTIMIZE
=
false
;
bool
SHOW_DISASM
=
false
;
bool
SHOW_DISASM
=
false
;
...
...
src/core/options.h
View file @
cd9f3a0f
...
@@ -37,7 +37,7 @@ extern int OSR_THRESHOLD_T2, REOPT_THRESHOLD_T2;
...
@@ -37,7 +37,7 @@ extern int OSR_THRESHOLD_T2, REOPT_THRESHOLD_T2;
extern
int
SPECULATION_THRESHOLD
;
extern
int
SPECULATION_THRESHOLD
;
extern
bool
SHOW_DISASM
,
FORCE_INTERPRETER
,
FORCE_OPTIMIZE
,
PROFILE
,
DUMPJIT
,
TRAP
,
USE_STRIPPED_STDLIB
,
extern
bool
SHOW_DISASM
,
FORCE_INTERPRETER
,
FORCE_OPTIMIZE
,
PROFILE
,
DUMPJIT
,
TRAP
,
USE_STRIPPED_STDLIB
,
ENABLE_INTERPRETER
,
ENABLE_PYPA_PARSER
,
USE_REGALLOC_BASIC
;
CONTINUE_AFTER_FATAL
,
ENABLE_INTERPRETER
,
ENABLE_PYPA_PARSER
,
USE_REGALLOC_BASIC
;
extern
bool
ENABLE_ICS
,
ENABLE_ICGENERICS
,
ENABLE_ICGETITEMS
,
ENABLE_ICSETITEMS
,
ENABLE_ICDELITEMS
,
ENABLE_ICBINEXPS
,
extern
bool
ENABLE_ICS
,
ENABLE_ICGENERICS
,
ENABLE_ICGETITEMS
,
ENABLE_ICSETITEMS
,
ENABLE_ICDELITEMS
,
ENABLE_ICBINEXPS
,
ENABLE_ICNONZEROS
,
ENABLE_ICCALLSITES
,
ENABLE_ICSETATTRS
,
ENABLE_ICGETATTRS
,
ENALBE_ICDELATTRS
,
ENABLE_ICGETGLOBALS
,
ENABLE_ICNONZEROS
,
ENABLE_ICCALLSITES
,
ENABLE_ICSETATTRS
,
ENABLE_ICGETATTRS
,
ENALBE_ICDELATTRS
,
ENABLE_ICGETGLOBALS
,
...
...
src/jit.cpp
View file @
cd9f3a0f
...
@@ -79,7 +79,7 @@ static int main(int argc, char** argv) {
...
@@ -79,7 +79,7 @@ static int main(int argc, char** argv) {
bool
force_repl
=
false
;
bool
force_repl
=
false
;
bool
stats
=
false
;
bool
stats
=
false
;
const
char
*
command
=
NULL
;
const
char
*
command
=
NULL
;
while
((
code
=
getopt
(
argc
,
argv
,
"+OqdIibpjtrsSvnxc:"
))
!=
-
1
)
{
while
((
code
=
getopt
(
argc
,
argv
,
"+OqdIibpjtrsSvnxc:
F
"
))
!=
-
1
)
{
if
(
code
==
'O'
)
if
(
code
==
'O'
)
FORCE_OPTIMIZE
=
true
;
FORCE_OPTIMIZE
=
true
;
else
if
(
code
==
't'
)
else
if
(
code
==
't'
)
...
@@ -110,6 +110,8 @@ static int main(int argc, char** argv) {
...
@@ -110,6 +110,8 @@ static int main(int argc, char** argv) {
USE_REGALLOC_BASIC
=
false
;
USE_REGALLOC_BASIC
=
false
;
}
else
if
(
code
==
'x'
)
{
}
else
if
(
code
==
'x'
)
{
ENABLE_PYPA_PARSER
=
false
;
ENABLE_PYPA_PARSER
=
false
;
}
else
if
(
code
==
'F'
)
{
CONTINUE_AFTER_FATAL
=
true
;
}
else
if
(
code
==
'c'
)
{
}
else
if
(
code
==
'c'
)
{
command
=
optarg
;
command
=
optarg
;
// no more option parsing; the rest of our arguments go into sys.argv.
// no more option parsing; the rest of our arguments go into sys.argv.
...
...
src/runtime/builtin_modules/builtins.cpp
View file @
cd9f3a0f
...
@@ -945,7 +945,8 @@ Box* rawInput(Box* prompt) {
...
@@ -945,7 +945,8 @@ Box* rawInput(Box* prompt) {
}
}
Box
*
input
(
Box
*
prompt
)
{
Box
*
input
(
Box
*
prompt
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
Box
*
builtinRound
(
Box
*
_number
,
Box
*
_ndigits
)
{
Box
*
builtinRound
(
Box
*
_number
,
Box
*
_ndigits
)
{
...
@@ -961,11 +962,13 @@ Box* builtinRound(Box* _number, Box* _ndigits) {
...
@@ -961,11 +962,13 @@ Box* builtinRound(Box* _number, Box* _ndigits) {
return
boxFloat
(
round
(
number
->
d
));
return
boxFloat
(
round
(
number
->
d
));
}
}
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
Box
*
builtinCmp
(
Box
*
lhs
,
Box
*
rhs
)
{
Box
*
builtinCmp
(
Box
*
lhs
,
Box
*
rhs
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
void
setupBuiltins
()
{
void
setupBuiltins
()
{
...
...
src/runtime/capi.cpp
View file @
cd9f3a0f
...
@@ -266,12 +266,14 @@ extern "C" PyObject* PyObject_GenericGetAttr(PyObject* o, PyObject* name) noexce
...
@@ -266,12 +266,14 @@ extern "C" PyObject* PyObject_GenericGetAttr(PyObject* o, PyObject* name) noexce
}
}
extern
"C"
PyObject
*
_PyObject_GenericGetAttrWithDict
(
PyObject
*
obj
,
PyObject
*
name
,
PyObject
*
dict
)
noexcept
{
extern
"C"
PyObject
*
_PyObject_GenericGetAttrWithDict
(
PyObject
*
obj
,
PyObject
*
name
,
PyObject
*
dict
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
int
_PyObject_GenericSetAttrWithDict
(
PyObject
*
obj
,
PyObject
*
name
,
PyObject
*
value
,
extern
"C"
int
_PyObject_GenericSetAttrWithDict
(
PyObject
*
obj
,
PyObject
*
name
,
PyObject
*
value
,
PyObject
*
dict
)
noexcept
{
PyObject
*
dict
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
...
@@ -295,7 +297,8 @@ extern "C" int PyObject_SetItem(PyObject* o, PyObject* key, PyObject* v) noexcep
...
@@ -295,7 +297,8 @@ extern "C" int PyObject_SetItem(PyObject* o, PyObject* key, PyObject* v) noexcep
}
}
extern
"C"
int
PyObject_DelItem
(
PyObject
*
o
,
PyObject
*
key
)
noexcept
{
extern
"C"
int
PyObject_DelItem
(
PyObject
*
o
,
PyObject
*
key
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
PyObject
*
PyObject_RichCompare
(
PyObject
*
o1
,
PyObject
*
o2
,
int
opid
)
noexcept
{
extern
"C"
PyObject
*
PyObject_RichCompare
(
PyObject
*
o1
,
PyObject
*
o2
,
int
opid
)
noexcept
{
...
@@ -320,7 +323,8 @@ extern "C" PyObject* PyObject_RichCompare(PyObject* o1, PyObject* o2, int opid)
...
@@ -320,7 +323,8 @@ extern "C" PyObject* PyObject_RichCompare(PyObject* o1, PyObject* o2, int opid)
translated_op
=
AST_TYPE
::
GtE
;
translated_op
=
AST_TYPE
::
GtE
;
break
;
break
;
default:
default:
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
};
};
try
{
try
{
...
@@ -339,7 +343,8 @@ extern "C" long PyObject_Hash(PyObject* o) noexcept {
...
@@ -339,7 +343,8 @@ extern "C" long PyObject_Hash(PyObject* o) noexcept {
try
{
try
{
return
hash
(
o
)
->
n
;
return
hash
(
o
)
->
n
;
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
}
}
...
@@ -369,13 +374,15 @@ extern "C" int PyObject_IsTrue(PyObject* o) noexcept {
...
@@ -369,13 +374,15 @@ extern "C" int PyObject_IsTrue(PyObject* o) noexcept {
try
{
try
{
return
nonzero
(
o
);
return
nonzero
(
o
);
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
}
}
extern
"C"
int
PyObject_Not
(
PyObject
*
o
)
noexcept
{
extern
"C"
int
PyObject_Not
(
PyObject
*
o
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
PyObject
*
PyObject_Call
(
PyObject
*
callable_object
,
PyObject
*
args
,
PyObject
*
kw
)
noexcept
{
extern
"C"
PyObject
*
PyObject_Call
(
PyObject
*
callable_object
,
PyObject
*
args
,
PyObject
*
kw
)
noexcept
{
...
@@ -449,15 +456,18 @@ extern "C" int PyObject_Print(PyObject* obj, FILE* fp, int flags) noexcept {
...
@@ -449,15 +456,18 @@ extern "C" int PyObject_Print(PyObject* obj, FILE* fp, int flags) noexcept {
};
};
extern
"C"
PyObject
*
PySequence_Repeat
(
PyObject
*
o
,
Py_ssize_t
count
)
noexcept
{
extern
"C"
PyObject
*
PySequence_Repeat
(
PyObject
*
o
,
Py_ssize_t
count
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PySequence_InPlaceConcat
(
PyObject
*
o1
,
PyObject
*
o2
)
noexcept
{
extern
"C"
PyObject
*
PySequence_InPlaceConcat
(
PyObject
*
o1
,
PyObject
*
o2
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PySequence_InPlaceRepeat
(
PyObject
*
o
,
Py_ssize_t
count
)
noexcept
{
extern
"C"
PyObject
*
PySequence_InPlaceRepeat
(
PyObject
*
o
,
Py_ssize_t
count
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PySequence_GetItem
(
PyObject
*
o
,
Py_ssize_t
i
)
noexcept
{
extern
"C"
PyObject
*
PySequence_GetItem
(
PyObject
*
o
,
Py_ssize_t
i
)
noexcept
{
...
@@ -475,32 +485,39 @@ extern "C" PyObject* PySequence_GetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t
...
@@ -475,32 +485,39 @@ extern "C" PyObject* PySequence_GetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t
// Not sure if this is really the same:
// Not sure if this is really the same:
return
getitem
(
o
,
createSlice
(
boxInt
(
i1
),
boxInt
(
i2
),
None
));
return
getitem
(
o
,
createSlice
(
boxInt
(
i1
),
boxInt
(
i2
),
None
));
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
}
}
extern
"C"
int
PySequence_SetItem
(
PyObject
*
o
,
Py_ssize_t
i
,
PyObject
*
v
)
noexcept
{
extern
"C"
int
PySequence_SetItem
(
PyObject
*
o
,
Py_ssize_t
i
,
PyObject
*
v
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
int
PySequence_DelItem
(
PyObject
*
o
,
Py_ssize_t
i
)
noexcept
{
extern
"C"
int
PySequence_DelItem
(
PyObject
*
o
,
Py_ssize_t
i
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
int
PySequence_SetSlice
(
PyObject
*
o
,
Py_ssize_t
i1
,
Py_ssize_t
i2
,
PyObject
*
v
)
noexcept
{
extern
"C"
int
PySequence_SetSlice
(
PyObject
*
o
,
Py_ssize_t
i1
,
Py_ssize_t
i2
,
PyObject
*
v
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
int
PySequence_DelSlice
(
PyObject
*
o
,
Py_ssize_t
i1
,
Py_ssize_t
i2
)
noexcept
{
extern
"C"
int
PySequence_DelSlice
(
PyObject
*
o
,
Py_ssize_t
i1
,
Py_ssize_t
i2
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
Py_ssize_t
PySequence_Count
(
PyObject
*
o
,
PyObject
*
value
)
noexcept
{
extern
"C"
Py_ssize_t
PySequence_Count
(
PyObject
*
o
,
PyObject
*
value
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
Py_ssize_t
PySequence_Index
(
PyObject
*
o
,
PyObject
*
value
)
noexcept
{
extern
"C"
Py_ssize_t
PySequence_Index
(
PyObject
*
o
,
PyObject
*
value
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
PyObject
*
PySequence_Tuple
(
PyObject
*
o
)
noexcept
{
extern
"C"
PyObject
*
PySequence_Tuple
(
PyObject
*
o
)
noexcept
{
...
@@ -509,7 +526,8 @@ extern "C" PyObject* PySequence_Tuple(PyObject* o) noexcept {
...
@@ -509,7 +526,8 @@ extern "C" PyObject* PySequence_Tuple(PyObject* o) noexcept {
if
(
PyList_Check
(
o
))
if
(
PyList_Check
(
o
))
return
PyList_AsTuple
(
o
);
return
PyList_AsTuple
(
o
);
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyIter_Next
(
PyObject
*
iter
)
noexcept
{
extern
"C"
PyObject
*
PyIter_Next
(
PyObject
*
iter
)
noexcept
{
...
@@ -746,7 +764,8 @@ extern "C" int PyErr_BadArgument() noexcept {
...
@@ -746,7 +764,8 @@ extern "C" int PyErr_BadArgument() noexcept {
}
}
extern
"C"
PyObject
*
PyErr_NoMemory
()
noexcept
{
extern
"C"
PyObject
*
PyErr_NoMemory
()
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
int
PyExceptionClass_Check
(
PyObject
*
o
)
noexcept
{
extern
"C"
int
PyExceptionClass_Check
(
PyObject
*
o
)
noexcept
{
...
@@ -871,7 +890,8 @@ extern "C" int PyErr_WarnEx(PyObject* category, const char* text, Py_ssize_t sta
...
@@ -871,7 +890,8 @@ extern "C" int PyErr_WarnEx(PyObject* category, const char* text, Py_ssize_t sta
if
(
category
==
PyExc_DeprecationWarning
)
if
(
category
==
PyExc_DeprecationWarning
)
return
0
;
return
0
;
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
PyObject
*
PyImport_Import
(
PyObject
*
module_name
)
noexcept
{
extern
"C"
PyObject
*
PyImport_Import
(
PyObject
*
module_name
)
noexcept
{
...
@@ -882,7 +902,8 @@ extern "C" PyObject* PyImport_Import(PyObject* module_name) noexcept {
...
@@ -882,7 +902,8 @@ extern "C" PyObject* PyImport_Import(PyObject* module_name) noexcept {
std
::
string
_module_name
=
static_cast
<
BoxedString
*>
(
module_name
)
->
s
;
std
::
string
_module_name
=
static_cast
<
BoxedString
*>
(
module_name
)
->
s
;
return
importModuleLevel
(
_module_name
,
None
,
None
,
-
1
);
return
importModuleLevel
(
_module_name
,
None
,
None
,
-
1
);
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
}
}
...
@@ -1125,7 +1146,8 @@ extern "C" PyOS_sighandler_t PyOS_setsig(int sig, PyOS_sighandler_t handler) noe
...
@@ -1125,7 +1146,8 @@ extern "C" PyOS_sighandler_t PyOS_setsig(int sig, PyOS_sighandler_t handler) noe
}
}
extern
"C"
int
Py_AddPendingCall
(
int
(
*
func
)(
void
*
),
void
*
arg
)
noexcept
{
extern
"C"
int
Py_AddPendingCall
(
int
(
*
func
)(
void
*
),
void
*
arg
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
PyObject
*
_PyImport_FixupExtension
(
char
*
name
,
char
*
filename
)
noexcept
{
extern
"C"
PyObject
*
_PyImport_FixupExtension
(
char
*
name
,
char
*
filename
)
noexcept
{
...
@@ -1135,7 +1157,8 @@ extern "C" PyObject* _PyImport_FixupExtension(char* name, char* filename) noexce
...
@@ -1135,7 +1157,8 @@ extern "C" PyObject* _PyImport_FixupExtension(char* name, char* filename) noexce
}
}
extern
"C"
PyObject
*
_PyImport_FindExtension
(
char
*
name
,
char
*
filename
)
noexcept
{
extern
"C"
PyObject
*
_PyImport_FindExtension
(
char
*
name
,
char
*
filename
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
static
PyObject
*
listmethodchain
(
PyMethodChain
*
chain
)
noexcept
{
static
PyObject
*
listmethodchain
(
PyMethodChain
*
chain
)
noexcept
{
...
@@ -1352,4 +1375,11 @@ void setupCAPI() {
...
@@ -1352,4 +1375,11 @@ void setupCAPI() {
void
teardownCAPI
()
{
void
teardownCAPI
()
{
}
}
void
fatalOrError
(
PyObject
*
exception
,
const
char
*
message
)
noexcept
{
if
(
CONTINUE_AFTER_FATAL
)
PyErr_SetString
(
exception
,
message
);
else
Py_FatalError
(
message
);
}
}
}
src/runtime/capi.h
View file @
cd9f3a0f
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
namespace
pyston
{
namespace
pyston
{
class
Box
;
class
BoxedModule
;
class
BoxedModule
;
BoxedModule
*
importTestExtension
(
const
std
::
string
&
);
BoxedModule
*
importTestExtension
(
const
std
::
string
&
);
...
@@ -26,6 +27,9 @@ void checkAndThrowCAPIException();
...
@@ -26,6 +27,9 @@ void checkAndThrowCAPIException();
void
throwCAPIException
()
__attribute__
((
noreturn
));
void
throwCAPIException
()
__attribute__
((
noreturn
));
struct
ExcInfo
;
struct
ExcInfo
;
void
setCAPIException
(
const
ExcInfo
&
e
);
void
setCAPIException
(
const
ExcInfo
&
e
);
// TODO: not sure whether this belongs here
void
fatalOrError
(
Box
*
object
,
const
char
*
message
)
noexcept
;
}
}
#endif
#endif
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