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
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
...
@@ -28,7 +28,8 @@
...
@@ -28,7 +28,8 @@
namespace
pyston
{
namespace
pyston
{
extern
"C"
Py_ssize_t
_PyObject_LengthHint
(
PyObject
*
o
,
Py_ssize_t
defaultvalue
)
noexcept
{
extern
"C"
Py_ssize_t
_PyObject_LengthHint
(
PyObject
*
o
,
Py_ssize_t
defaultvalue
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
static
int
_IsFortranContiguous
(
Py_buffer
*
view
)
{
static
int
_IsFortranContiguous
(
Py_buffer
*
view
)
{
...
@@ -147,10 +148,11 @@ extern "C" int PyBuffer_FillInfo(Py_buffer* view, PyObject* obj, void* buf, Py_s
...
@@ -147,10 +148,11 @@ extern "C" int PyBuffer_FillInfo(Py_buffer* view, PyObject* obj, void* buf, Py_s
if
(
view
==
NULL
)
if
(
view
==
NULL
)
return
0
;
return
0
;
if
(((
flags
&
PyBUF_WRITABLE
)
==
PyBUF_WRITABLE
)
&&
(
readonly
==
1
))
{
if
(((
flags
&
PyBUF_WRITABLE
)
==
PyBUF_WRITABLE
)
&&
(
readonly
==
1
))
{
// Don't support PyErr_SetString yet:
// https://docs.python.org/3/c-api/buffer.html#c.PyBuffer_FillInfo
assert
(
0
);
// '[On failure], raise PyExc_BufferError, set view->obj to NULL and return -1'
// PyErr_SetString(PyExc_BufferError, "Object is not writable.");
view
->
obj
=
NULL
;
// return -1;
PyErr_SetString
(
PyExc_BufferError
,
"Object is not writable."
);
return
-
1
;
}
}
view
->
obj
=
obj
;
view
->
obj
=
obj
;
...
@@ -467,7 +469,8 @@ extern "C" PyObject* PyObject_CallObject(PyObject* obj, PyObject* args) noexcept
...
@@ -467,7 +469,8 @@ extern "C" PyObject* PyObject_CallObject(PyObject* obj, PyObject* args) noexcept
r
=
runtimeCall
(
obj
,
ArgPassSpec
(
0
,
0
,
false
,
false
),
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
r
=
runtimeCall
(
obj
,
ArgPassSpec
(
0
,
0
,
false
,
false
),
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
return
r
;
return
r
;
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
}
}
...
@@ -498,7 +501,8 @@ extern "C" int PyObject_AsCharBuffer(PyObject* obj, const char** buffer, Py_ssiz
...
@@ -498,7 +501,8 @@ extern "C" int PyObject_AsCharBuffer(PyObject* obj, const char** buffer, Py_ssiz
}
}
extern
"C"
int
PyObject_AsReadBuffer
(
PyObject
*
obj
,
const
void
**
buffer
,
Py_ssize_t
*
buffer_len
)
noexcept
{
extern
"C"
int
PyObject_AsReadBuffer
(
PyObject
*
obj
,
const
void
**
buffer
,
Py_ssize_t
*
buffer_len
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
static
PyObject
*
call_function_tail
(
PyObject
*
callable
,
PyObject
*
args
)
{
static
PyObject
*
call_function_tail
(
PyObject
*
callable
,
PyObject
*
args
)
{
...
@@ -1155,19 +1159,23 @@ extern "C" Py_ssize_t PyMapping_Size(PyObject* o) noexcept {
...
@@ -1155,19 +1159,23 @@ extern "C" Py_ssize_t PyMapping_Size(PyObject* o) noexcept {
}
}
extern
"C"
int
PyMapping_HasKeyString
(
PyObject
*
o
,
char
*
key
)
noexcept
{
extern
"C"
int
PyMapping_HasKeyString
(
PyObject
*
o
,
char
*
key
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
int
PyMapping_HasKey
(
PyObject
*
o
,
PyObject
*
key
)
noexcept
{
extern
"C"
int
PyMapping_HasKey
(
PyObject
*
o
,
PyObject
*
key
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
PyObject
*
PyMapping_GetItemString
(
PyObject
*
o
,
char
*
key
)
noexcept
{
extern
"C"
PyObject
*
PyMapping_GetItemString
(
PyObject
*
o
,
char
*
key
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
int
PyMapping_SetItemString
(
PyObject
*
o
,
char
*
key
,
PyObject
*
v
)
noexcept
{
extern
"C"
int
PyMapping_SetItemString
(
PyObject
*
o
,
char
*
key
,
PyObject
*
v
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
int
PyNumber_Check
(
PyObject
*
obj
)
noexcept
{
extern
"C"
int
PyNumber_Check
(
PyObject
*
obj
)
noexcept
{
...
@@ -1194,7 +1202,8 @@ extern "C" PyObject* PyNumber_Subtract(PyObject* lhs, PyObject* rhs) noexcept {
...
@@ -1194,7 +1202,8 @@ extern "C" PyObject* PyNumber_Subtract(PyObject* lhs, PyObject* rhs) noexcept {
try
{
try
{
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
Sub
);
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
Sub
);
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
}
}
...
@@ -1202,7 +1211,8 @@ extern "C" PyObject* PyNumber_Multiply(PyObject* lhs, PyObject* rhs) noexcept {
...
@@ -1202,7 +1211,8 @@ extern "C" PyObject* PyNumber_Multiply(PyObject* lhs, PyObject* rhs) noexcept {
try
{
try
{
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
Mult
);
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
Mult
);
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
}
}
...
@@ -1210,12 +1220,14 @@ extern "C" PyObject* PyNumber_Divide(PyObject* lhs, PyObject* rhs) noexcept {
...
@@ -1210,12 +1220,14 @@ extern "C" PyObject* PyNumber_Divide(PyObject* lhs, PyObject* rhs) noexcept {
try
{
try
{
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
Div
);
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
Div
);
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
}
}
extern
"C"
PyObject
*
PyNumber_FloorDivide
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_FloorDivide
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_TrueDivide
(
PyObject
*
lhs
,
PyObject
*
rhs
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_TrueDivide
(
PyObject
*
lhs
,
PyObject
*
rhs
)
noexcept
{
...
@@ -1231,7 +1243,8 @@ extern "C" PyObject* PyNumber_Remainder(PyObject* lhs, PyObject* rhs) noexcept {
...
@@ -1231,7 +1243,8 @@ extern "C" PyObject* PyNumber_Remainder(PyObject* lhs, PyObject* rhs) noexcept {
try
{
try
{
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
Mod
);
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
Mod
);
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
}
}
...
@@ -1239,43 +1252,51 @@ extern "C" PyObject* PyNumber_Divmod(PyObject* lhs, PyObject* rhs) noexcept {
...
@@ -1239,43 +1252,51 @@ extern "C" PyObject* PyNumber_Divmod(PyObject* lhs, PyObject* rhs) noexcept {
try
{
try
{
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
DivMod
);
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
DivMod
);
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
}
}
extern
"C"
PyObject
*
PyNumber_Power
(
PyObject
*
,
PyObject
*
,
PyObject
*
o3
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_Power
(
PyObject
*
,
PyObject
*
,
PyObject
*
o3
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_Negative
(
PyObject
*
o
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_Negative
(
PyObject
*
o
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_Positive
(
PyObject
*
o
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_Positive
(
PyObject
*
o
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_Absolute
(
PyObject
*
o
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_Absolute
(
PyObject
*
o
)
noexcept
{
try
{
try
{
return
abs_
(
o
);
return
abs_
(
o
);
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
}
}
extern
"C"
PyObject
*
PyNumber_Invert
(
PyObject
*
o
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_Invert
(
PyObject
*
o
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_Lshift
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_Lshift
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_Rshift
(
PyObject
*
lhs
,
PyObject
*
rhs
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_Rshift
(
PyObject
*
lhs
,
PyObject
*
rhs
)
noexcept
{
try
{
try
{
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
RShift
);
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
RShift
);
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
}
}
...
@@ -1283,76 +1304,94 @@ extern "C" PyObject* PyNumber_And(PyObject* lhs, PyObject* rhs) noexcept {
...
@@ -1283,76 +1304,94 @@ extern "C" PyObject* PyNumber_And(PyObject* lhs, PyObject* rhs) noexcept {
try
{
try
{
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
BitAnd
);
return
binop
(
lhs
,
rhs
,
AST_TYPE
::
BitAnd
);
}
catch
(
ExcInfo
e
)
{
}
catch
(
ExcInfo
e
)
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
}
}
extern
"C"
PyObject
*
PyNumber_Xor
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_Xor
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_Or
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_Or
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceAdd
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceAdd
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceSubtract
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceSubtract
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceMultiply
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceMultiply
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceDivide
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceDivide
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceFloorDivide
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceFloorDivide
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceTrueDivide
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceTrueDivide
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceRemainder
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceRemainder
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlacePower
(
PyObject
*
,
PyObject
*
,
PyObject
*
o3
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlacePower
(
PyObject
*
,
PyObject
*
,
PyObject
*
o3
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceLshift
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceLshift
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceRshift
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceRshift
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceAnd
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceAnd
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceXor
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceXor
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_InPlaceOr
(
PyObject
*
,
PyObject
*
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_InPlaceOr
(
PyObject
*
,
PyObject
*
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
int
PyNumber_Coerce
(
PyObject
**
,
PyObject
**
)
noexcept
{
extern
"C"
int
PyNumber_Coerce
(
PyObject
**
,
PyObject
**
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
int
PyNumber_CoerceEx
(
PyObject
**
,
PyObject
**
)
noexcept
{
extern
"C"
int
PyNumber_CoerceEx
(
PyObject
**
,
PyObject
**
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
-
1
;
}
}
extern
"C"
PyObject
*
_PyNumber_ConvertIntegralToInt
(
PyObject
*
integral
,
const
char
*
error_format
)
noexcept
{
extern
"C"
PyObject
*
_PyNumber_ConvertIntegralToInt
(
PyObject
*
integral
,
const
char
*
error_format
)
noexcept
{
...
@@ -1383,7 +1422,8 @@ extern "C" PyObject* _PyNumber_ConvertIntegralToInt(PyObject* integral, const ch
...
@@ -1383,7 +1422,8 @@ extern "C" PyObject* _PyNumber_ConvertIntegralToInt(PyObject* integral, const ch
non_integral_error:
non_integral_error:
if
(
PyInstance_Check
(
integral
))
{
if
(
PyInstance_Check
(
integral
))
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
/* cpython has this:
/* cpython has this:
type_name = PyString_AS_STRING(((PyInstanceObject *)integral)
type_name = PyString_AS_STRING(((PyInstanceObject *)integral)
->in_class->cl_name);
->in_class->cl_name);
...
@@ -1437,7 +1477,9 @@ extern "C" PyObject* PyNumber_Int(PyObject* o) noexcept {
...
@@ -1437,7 +1477,9 @@ extern "C" PyObject* PyNumber_Int(PyObject* o) noexcept {
PyErr_Clear
();
/* It's not an error if o.__trunc__ doesn't exist. */
PyErr_Clear
();
/* It's not an error if o.__trunc__ doesn't exist. */
// the remainder of PyNumber_Int deals with converting from unicode/string to int
// the remainder of PyNumber_Int deals with converting from unicode/string to int
Py_FatalError
(
"unimplemented string -> int conversion"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented string -> int conversion"
);
return
nullptr
;
#if 0
#if 0
if (PyString_Check(o))
if (PyString_Check(o))
return int_from_string(PyString_AS_STRING(o),
return int_from_string(PyString_AS_STRING(o),
...
@@ -1465,11 +1507,13 @@ extern "C" PyObject* PyNumber_Long(PyObject* o) noexcept {
...
@@ -1465,11 +1507,13 @@ extern "C" PyObject* PyNumber_Long(PyObject* o) noexcept {
if
(
o
->
cls
==
float_cls
)
if
(
o
->
cls
==
float_cls
)
return
PyLong_FromDouble
(
PyFloat_AsDouble
(
o
));
return
PyLong_FromDouble
(
PyFloat_AsDouble
(
o
));
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_Float
(
PyObject
*
o
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_Float
(
PyObject
*
o
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_Index
(
PyObject
*
o
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_Index
(
PyObject
*
o
)
noexcept
{
...
@@ -1480,11 +1524,13 @@ extern "C" PyObject* PyNumber_Index(PyObject* o) noexcept {
...
@@ -1480,11 +1524,13 @@ extern "C" PyObject* PyNumber_Index(PyObject* o) noexcept {
return
o
;
return
o
;
}
}
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_ToBase
(
PyObject
*
n
,
int
base
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_ToBase
(
PyObject
*
n
,
int
base
)
noexcept
{
Py_FatalError
(
"unimplemented"
);
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
}
}
extern
"C"
Py_ssize_t
PyNumber_AsSsize_t
(
PyObject
*
o
,
PyObject
*
exc
)
noexcept
{
extern
"C"
Py_ssize_t
PyNumber_AsSsize_t
(
PyObject
*
o
,
PyObject
*
exc
)
noexcept
{
...
...
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