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
32ccd8a8
Commit
32ccd8a8
authored
Aug 07, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor tweaks to the CAPI support
parent
c2877853
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
12 deletions
+48
-12
include/Python.h
include/Python.h
+11
-7
include/object.h
include/object.h
+31
-0
src/Makefile
src/Makefile
+1
-1
src/runtime/capi.cpp
src/runtime/capi.cpp
+4
-3
tools/lint.py
tools/lint.py
+1
-1
No files found.
include/Python.h
View file @
32ccd8a8
// Copyright (c) 2014 Dropbox, Inc.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
...
@@ -22,10 +22,11 @@
#include <stdint.h>
#include <stdbool.h>
//struct PyObject {
//};
//typedef struct PyObject PyObject;
typedef
void
PyObject
;
#include "object.h"
#ifdef __cplusplus
extern
"C"
{
#endif
bool
PyArg_ParseTuple
(
PyObject
*
,
const
char
*
,
...);
PyObject
*
Py_BuildValue
(
const
char
*
,
...);
...
...
@@ -76,4 +77,7 @@ PyObject* Py_InitModule4(const char *arg0, PyMethodDef *arg1, const char *arg2,
Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
PYTHON_API_VERSION)
#ifdef __cplusplus
}
#endif
#endif
include/object.h
0 → 100644
View file @
32ccd8a8
// Copyright (c) 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Portions of this file are based on CPython's Include/object.h file
#ifndef PYSTON_EXTINCLUDE_OBJECT_H
#define PYSTON_EXTINCLUDE_OBJECT_H
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
void
PyObject
;
#ifdef __cplusplus
}
#endif
#endif
src/Makefile
View file @
32ccd8a8
...
...
@@ -871,6 +871,6 @@ ext: ../test/test_extension/test.so
../test/test_extension/test.o
:
../test/test_extension/test.c $(wildcard ../include/*.h) $(BUILD_SYSTEM_DEPS)
$(CLANG_EXE)
-O2
-fPIC
-Wimplicit
-I
../include
-c
$<
-o
$@
-g
../lib_python/2.7_Modules/%.o
:
../lib_python/2.7_Modules/%.c $(
wildcard ../include/*.h) $(
BUILD_SYSTEM_DEPS)
../lib_python/2.7_Modules/%.o
:
../lib_python/2.7_Modules/%.c $(BUILD_SYSTEM_DEPS)
$(ECHO)
Compiling extension file
$@
$(VERB)
$(CLANG_EXE)
$(EXT_CFLAGS)
-c
$<
-o
$@
-g
-ferror-limit
=
$(ERROR_LIMIT)
-MMD
-MP
-MF
$<
.d
src/runtime/capi.cpp
View file @
32ccd8a8
...
...
@@ -120,7 +120,8 @@ public:
}
};
extern
"C"
void
*
Py_InitModule4
(
const
char
*
name
,
PyMethodDef
*
methods
,
const
char
*
doc
,
PyObject
*
self
,
int
apiver
)
{
extern
"C"
PyObject
*
Py_InitModule4
(
const
char
*
name
,
PyMethodDef
*
methods
,
const
char
*
doc
,
PyObject
*
self
,
int
apiver
)
{
BoxedModule
*
module
=
createModule
(
name
,
"__builtin__"
);
Box
*
passthrough
=
static_cast
<
Box
*>
(
self
);
...
...
@@ -144,12 +145,12 @@ extern "C" void* Py_InitModule4(const char* name, PyMethodDef* methods, const ch
return
module
;
}
extern
"C"
void
*
Py_BuildValue
(
const
char
*
arg0
)
{
extern
"C"
PyObject
*
Py_BuildValue
(
const
char
*
arg0
,
...
)
{
assert
(
*
arg0
==
'\0'
);
return
None
;
}
extern
"C"
bool
PyArg_ParseTuple
(
void
*
tuple
,
const
char
*
fmt
,
...)
{
extern
"C"
bool
PyArg_ParseTuple
(
PyObject
*
tuple
,
const
char
*
fmt
,
...)
{
if
(
strcmp
(
""
,
fmt
)
==
0
)
return
true
;
...
...
tools/lint.py
View file @
32ccd8a8
...
...
@@ -81,7 +81,7 @@ def verify_include_order(_, dir, files):
for
incl
in
section
:
if
incl
.
startswith
(
'#include "llvm/'
):
continue
if
'"opagent.h"'
in
incl
or
'"Python.h"'
in
incl
:
if
'"opagent.h"'
in
incl
or
'"Python.h"'
in
incl
or
'"object.h"'
in
incl
:
continue
return
False
return
True
...
...
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