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
88c308f5
Commit
88c308f5
authored
Aug 20, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some more stubs
parent
e2b4302a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
src/runtime/capi.cpp
src/runtime/capi.cpp
+52
-0
No files found.
src/runtime/capi.cpp
View file @
88c308f5
...
...
@@ -324,6 +324,14 @@ extern "C" PyObject* PyObject_CallObject(PyObject* obj, PyObject* args) {
}
}
extern
"C"
PyObject
*
PyObject_CallMethod
(
PyObject
*
o
,
char
*
name
,
char
*
format
,
...)
{
abort
();
}
extern
"C"
PyObject
*
_PyObject_CallMethod_SizeT
(
PyObject
*
o
,
char
*
name
,
char
*
format
,
...)
{
abort
();
}
extern
"C"
PyObject
*
PyObject_GetAttrString
(
PyObject
*
o
,
const
char
*
attr
)
{
// TODO do something like this? not sure if this is safe; will people expect that calling into a known function
// won't end up doing a GIL check?
...
...
@@ -336,6 +344,35 @@ extern "C" PyObject* PyObject_GetAttrString(PyObject* o, const char* attr) {
}
}
extern
"C"
Py_ssize_t
PyObject_Size
(
PyObject
*
o
)
{
try
{
return
len
(
o
)
->
n
;
}
catch
(
Box
*
b
)
{
abort
();
}
}
extern
"C"
PyObject
*
PyObject_GetItem
(
PyObject
*
o
,
PyObject
*
key
)
{
try
{
return
getitem
(
o
,
key
);
}
catch
(
Box
*
b
)
{
abort
();
}
}
extern
"C"
void
PyObject_ClearWeakRefs
(
PyObject
*
object
)
{
abort
();
}
extern
"C"
int
PyCallable_Check
(
PyObject
*
x
)
{
if
(
x
==
NULL
)
return
0
;
static
const
std
::
string
call_attr
(
"__call__"
);
return
typeLookup
(
x
->
cls
,
call_attr
,
NULL
)
!=
NULL
;
}
extern
"C"
void
PyErr_Restore
(
PyObject
*
type
,
PyObject
*
value
,
PyObject
*
traceback
)
{
abort
();
...
...
@@ -378,6 +415,21 @@ extern "C" PyObject* PyErr_Occurred() {
*/
}
extern
"C"
int
PyErr_WarnEx
(
PyObject
*
category
,
const
char
*
text
,
Py_ssize_t
stacklevel
)
{
abort
();
}
extern
"C"
PyObject
*
PyImport_Import
(
PyObject
*
module_name
)
{
RELEASE_ASSERT
(
module_name
,
""
);
RELEASE_ASSERT
(
module_name
->
cls
==
str_cls
,
""
);
try
{
return
import
(
&
static_cast
<
BoxedString
*>
(
module_name
)
->
s
);
}
catch
(
Box
*
e
)
{
abort
();
}
}
BoxedModule
*
importTestExtension
()
{
const
char
*
pathname
=
"../test/test_extension/test.so"
;
void
*
handle
=
dlopen
(
pathname
,
RTLD_NOW
);
...
...
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