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
b0cf2322
Commit
b0cf2322
authored
Oct 23, 2015
by
Kevin Modzelewski
Committed by
Kevin Modzelewski
Oct 26, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get the imported files to compile (but not link)
parent
3fa45d83
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
123 additions
and
90 deletions
+123
-90
from_cpython/CMakeLists.txt
from_cpython/CMakeLists.txt
+8
-0
from_cpython/Include/Python-ast.h
from_cpython/Include/Python-ast.h
+70
-61
from_cpython/Include/Python.h
from_cpython/Include/Python.h
+3
-6
from_cpython/Include/abstract.h
from_cpython/Include/abstract.h
+2
-2
from_cpython/Include/ast.h
from_cpython/Include/ast.h
+1
-1
from_cpython/Include/fileobject.h
from_cpython/Include/fileobject.h
+3
-0
from_cpython/Include/object.h
from_cpython/Include/object.h
+1
-1
from_cpython/Include/parsetok.h
from_cpython/Include/parsetok.h
+8
-8
from_cpython/Modules/_ctypes/cfield.c
from_cpython/Modules/_ctypes/cfield.c
+1
-1
from_cpython/Objects/weakrefobject.c
from_cpython/Objects/weakrefobject.c
+2
-2
from_cpython/Parser/acceler.c
from_cpython/Parser/acceler.c
+2
-1
from_cpython/Parser/tokenizer.c
from_cpython/Parser/tokenizer.c
+2
-2
from_cpython/Python/Python-ast.c
from_cpython/Python/Python-ast.c
+4
-1
src/codegen/cpython_ast.h
src/codegen/cpython_ast.h
+4
-2
src/codegen/irgen/hooks.cpp
src/codegen/irgen/hooks.cpp
+10
-0
src/runtime/capi.cpp
src/runtime/capi.cpp
+2
-2
No files found.
from_cpython/CMakeLists.txt
View file @
b0cf2322
...
...
@@ -100,8 +100,10 @@ file(GLOB_RECURSE STDPYTHON_SRCS Python
formatter_string.c
formatter_unicode.c
getargs.c
graminit.c
marshal.c
mystrtoul.c
pyarena.c
pyctype.c
pystrtod.c
Python-ast.c
...
...
@@ -111,7 +113,13 @@ file(GLOB_RECURSE STDPYTHON_SRCS Python
# compile specified files in from_cpython/Python
file
(
GLOB_RECURSE STDPARSER_SRCS Parser
acceler.c
grammar1.c
myreadline.c
node.c
parser.c
parsetok.c
tokenizer.c
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wno-missing-field-initializers -Wno-tautological-compare -Wno-type-limits -Wno-unused-result -Wno-strict-aliasing -DPy_BUILD_CORE"
)
...
...
from_cpython/Include/Python-ast.h
View file @
b0cf2322
...
...
@@ -2,6 +2,11 @@
#include "asdl.h"
// Pyston addition:
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
_mod
*
mod_ty
;
typedef
struct
_stmt
*
stmt_ty
;
...
...
@@ -373,163 +378,167 @@ struct _alias {
#define Module(a0, a1) _Py_Module(a0, a1)
mod_ty
_Py_Module
(
asdl_seq
*
body
,
PyArena
*
arena
);
mod_ty
_Py_Module
(
asdl_seq
*
body
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Interactive(a0, a1) _Py_Interactive(a0, a1)
mod_ty
_Py_Interactive
(
asdl_seq
*
body
,
PyArena
*
arena
);
mod_ty
_Py_Interactive
(
asdl_seq
*
body
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Expression(a0, a1) _Py_Expression(a0, a1)
mod_ty
_Py_Expression
(
expr_ty
body
,
PyArena
*
arena
);
mod_ty
_Py_Expression
(
expr_ty
body
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Suite(a0, a1) _Py_Suite(a0, a1)
mod_ty
_Py_Suite
(
asdl_seq
*
body
,
PyArena
*
arena
);
mod_ty
_Py_Suite
(
asdl_seq
*
body
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define FunctionDef(a0, a1, a2, a3, a4, a5, a6) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6)
stmt_ty
_Py_FunctionDef
(
identifier
name
,
arguments_ty
args
,
asdl_seq
*
body
,
asdl_seq
*
decorator_list
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define ClassDef(a0, a1, a2, a3, a4, a5, a6) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6)
stmt_ty
_Py_ClassDef
(
identifier
name
,
asdl_seq
*
bases
,
asdl_seq
*
body
,
asdl_seq
*
decorator_list
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3)
stmt_ty
_Py_Return
(
expr_ty
value
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
stmt_ty
_Py_Return
(
expr_ty
value
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3)
stmt_ty
_Py_Delete
(
asdl_seq
*
targets
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
*
arena
)
PYSTON_NOEXCEPT
;
#define Assign(a0, a1, a2, a3, a4) _Py_Assign(a0, a1, a2, a3, a4)
stmt_ty
_Py_Assign
(
asdl_seq
*
targets
,
expr_ty
value
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5)
stmt_ty
_Py_AugAssign
(
expr_ty
target
,
operator_ty
op
,
expr_ty
value
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Print(a0, a1, a2, a3, a4, a5) _Py_Print(a0, a1, a2, a3, a4, a5)
stmt_ty
_Py_Print
(
expr_ty
dest
,
asdl_seq
*
values
,
bool
nl
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6)
stmt_ty
_Py_For
(
expr_ty
target
,
expr_ty
iter
,
asdl_seq
*
body
,
asdl_seq
*
orelse
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
orelse
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5)
stmt_ty
_Py_While
(
expr_ty
test
,
asdl_seq
*
body
,
asdl_seq
*
orelse
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define If(a0, a1, a2, a3, a4, a5) _Py_If(a0, a1, a2, a3, a4, a5)
stmt_ty
_Py_If
(
expr_ty
test
,
asdl_seq
*
body
,
asdl_seq
*
orelse
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define With(a0, a1, a2, a3, a4, a5) _Py_With(a0, a1, a2, a3, a4, a5)
stmt_ty
_Py_With
(
expr_ty
context_expr
,
expr_ty
optional_vars
,
asdl_seq
*
body
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Raise(a0, a1, a2, a3, a4, a5) _Py_Raise(a0, a1, a2, a3, a4, a5)
stmt_ty
_Py_Raise
(
expr_ty
type
,
expr_ty
inst
,
expr_ty
tback
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define TryExcept(a0, a1, a2, a3, a4, a5) _Py_TryExcept(a0, a1, a2, a3, a4, a5)
stmt_ty
_Py_TryExcept
(
asdl_seq
*
body
,
asdl_seq
*
handlers
,
asdl_seq
*
orelse
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define TryFinally(a0, a1, a2, a3, a4) _Py_TryFinally(a0, a1, a2, a3, a4)
stmt_ty
_Py_TryFinally
(
asdl_seq
*
body
,
asdl_seq
*
finalbody
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4)
stmt_ty
_Py_Assert
(
expr_ty
test
,
expr_ty
msg
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Import(a0, a1, a2, a3) _Py_Import(a0, a1, a2, a3)
stmt_ty
_Py_Import
(
asdl_seq
*
names
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
*
arena
)
PYSTON_NOEXCEPT
;
#define ImportFrom(a0, a1, a2, a3, a4, a5) _Py_ImportFrom(a0, a1, a2, a3, a4, a5)
stmt_ty
_Py_ImportFrom
(
identifier
module
,
asdl_seq
*
names
,
int
level
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Exec(a0, a1, a2, a3, a4, a5) _Py_Exec(a0, a1, a2, a3, a4, a5)
stmt_ty
_Py_Exec
(
expr_ty
body
,
expr_ty
globals
,
expr_ty
locals
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3)
stmt_ty
_Py_Global
(
asdl_seq
*
names
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
*
arena
)
PYSTON_NOEXCEPT
;
#define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3)
stmt_ty
_Py_Expr
(
expr_ty
value
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
stmt_ty
_Py_Expr
(
expr_ty
value
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2)
stmt_ty
_Py_Pass
(
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
stmt_ty
_Py_Pass
(
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Break(a0, a1, a2) _Py_Break(a0, a1, a2)
stmt_ty
_Py_Break
(
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
stmt_ty
_Py_Break
(
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Continue(a0, a1, a2) _Py_Continue(a0, a1, a2)
stmt_ty
_Py_Continue
(
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
stmt_ty
_Py_Continue
(
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define BoolOp(a0, a1, a2, a3, a4) _Py_BoolOp(a0, a1, a2, a3, a4)
expr_ty
_Py_BoolOp
(
boolop_ty
op
,
asdl_seq
*
values
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define BinOp(a0, a1, a2, a3, a4, a5) _Py_BinOp(a0, a1, a2, a3, a4, a5)
expr_ty
_Py_BinOp
(
expr_ty
left
,
operator_ty
op
,
expr_ty
right
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define UnaryOp(a0, a1, a2, a3, a4) _Py_UnaryOp(a0, a1, a2, a3, a4)
expr_ty
_Py_UnaryOp
(
unaryop_ty
op
,
expr_ty
operand
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Lambda(a0, a1, a2, a3, a4) _Py_Lambda(a0, a1, a2, a3, a4)
expr_ty
_Py_Lambda
(
arguments_ty
args
,
expr_ty
body
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define IfExp(a0, a1, a2, a3, a4, a5) _Py_IfExp(a0, a1, a2, a3, a4, a5)
expr_ty
_Py_IfExp
(
expr_ty
test
,
expr_ty
body
,
expr_ty
orelse
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4)
expr_ty
_Py_Dict
(
asdl_seq
*
keys
,
asdl_seq
*
values
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3)
expr_ty
_Py_Set
(
asdl_seq
*
elts
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
expr_ty
_Py_Set
(
asdl_seq
*
elts
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4)
expr_ty
_Py_ListComp
(
expr_ty
elt
,
asdl_seq
*
generators
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4)
expr_ty
_Py_SetComp
(
expr_ty
elt
,
asdl_seq
*
generators
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5)
expr_ty
_Py_DictComp
(
expr_ty
key
,
expr_ty
value
,
asdl_seq
*
generators
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4)
expr_ty
_Py_GeneratorExp
(
expr_ty
elt
,
asdl_seq
*
generators
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3)
expr_ty
_Py_Yield
(
expr_ty
value
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
expr_ty
_Py_Yield
(
expr_ty
value
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5)
expr_ty
_Py_Compare
(
expr_ty
left
,
asdl_int_seq
*
ops
,
asdl_seq
*
comparators
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7)
expr_ty
_Py_Call
(
expr_ty
func
,
asdl_seq
*
args
,
asdl_seq
*
keywords
,
expr_ty
starargs
,
expr_ty
kwargs
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
*
arena
)
PYSTON_NOEXCEPT
;
#define Repr(a0, a1, a2, a3) _Py_Repr(a0, a1, a2, a3)
expr_ty
_Py_Repr
(
expr_ty
value
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
expr_ty
_Py_Repr
(
expr_ty
value
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3)
expr_ty
_Py_Num
(
object
n
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
expr_ty
_Py_Num
(
object
n
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3)
expr_ty
_Py_Str
(
string
s
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
expr_ty
_Py_Str
(
string
s
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5)
expr_ty
_Py_Attribute
(
expr_ty
value
,
identifier
attr
,
expr_context_ty
ctx
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5)
expr_ty
_Py_Subscript
(
expr_ty
value
,
slice_ty
slice
,
expr_context_ty
ctx
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4)
expr_ty
_Py_Name
(
identifier
id
,
expr_context_ty
ctx
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define List(a0, a1, a2, a3, a4) _Py_List(a0, a1, a2, a3, a4)
expr_ty
_Py_List
(
asdl_seq
*
elts
,
expr_context_ty
ctx
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Tuple(a0, a1, a2, a3, a4) _Py_Tuple(a0, a1, a2, a3, a4)
expr_ty
_Py_Tuple
(
asdl_seq
*
elts
,
expr_context_ty
ctx
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Ellipsis(a0) _Py_Ellipsis(a0)
slice_ty
_Py_Ellipsis
(
PyArena
*
arena
);
slice_ty
_Py_Ellipsis
(
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3)
slice_ty
_Py_Slice
(
expr_ty
lower
,
expr_ty
upper
,
expr_ty
step
,
PyArena
*
arena
);
slice_ty
_Py_Slice
(
expr_ty
lower
,
expr_ty
upper
,
expr_ty
step
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1)
slice_ty
_Py_ExtSlice
(
asdl_seq
*
dims
,
PyArena
*
arena
);
slice_ty
_Py_ExtSlice
(
asdl_seq
*
dims
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define Index(a0, a1) _Py_Index(a0, a1)
slice_ty
_Py_Index
(
expr_ty
value
,
PyArena
*
arena
);
slice_ty
_Py_Index
(
expr_ty
value
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define comprehension(a0, a1, a2, a3) _Py_comprehension(a0, a1, a2, a3)
comprehension_ty
_Py_comprehension
(
expr_ty
target
,
expr_ty
iter
,
asdl_seq
*
ifs
,
PyArena
*
arena
);
ifs
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define ExceptHandler(a0, a1, a2, a3, a4, a5) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5)
excepthandler_ty
_Py_ExceptHandler
(
expr_ty
type
,
expr_ty
name
,
asdl_seq
*
body
,
int
lineno
,
int
col_offset
,
PyArena
*
arena
);
int
lineno
,
int
col_offset
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define arguments(a0, a1, a2, a3, a4) _Py_arguments(a0, a1, a2, a3, a4)
arguments_ty
_Py_arguments
(
asdl_seq
*
args
,
identifier
vararg
,
identifier
kwarg
,
asdl_seq
*
defaults
,
PyArena
*
arena
);
kwarg
,
asdl_seq
*
defaults
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2)
keyword_ty
_Py_keyword
(
identifier
arg
,
expr_ty
value
,
PyArena
*
arena
);
keyword_ty
_Py_keyword
(
identifier
arg
,
expr_ty
value
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
#define alias(a0, a1, a2) _Py_alias(a0, a1, a2)
alias_ty
_Py_alias
(
identifier
name
,
identifier
asname
,
PyArena
*
arena
);
alias_ty
_Py_alias
(
identifier
name
,
identifier
asname
,
PyArena
*
arena
)
PYSTON_NOEXCEPT
;
PyObject
*
PyAST_mod2obj
(
mod_ty
t
)
PYSTON_NOEXCEPT
;
mod_ty
PyAST_obj2mod
(
PyObject
*
ast
,
PyArena
*
arena
,
int
mode
)
PYSTON_NOEXCEPT
;
int
PyAST_Check
(
PyObject
*
obj
)
PYSTON_NOEXCEPT
;
PyObject
*
PyAST_mod2obj
(
mod_ty
t
);
mod_ty
PyAST_obj2mod
(
PyObject
*
ast
,
PyArena
*
arena
,
int
mode
);
int
PyAST_Check
(
PyObject
*
obj
);
#ifdef __cplusplus
}
#endif
from_cpython/Include/Python.h
View file @
b0cf2322
...
...
@@ -41,9 +41,6 @@
#include <assert.h>
// CPython doesn't seem to include this but I'm not sure how they get the definition of 'bool':
#include <stdbool.h>
#include "pyport.h"
#include "pymath.h"
...
...
@@ -133,8 +130,11 @@ PyAPI_FUNC(void) PyType_SetDict(PyTypeObject*, PyObject*) PYSTON_NOEXCEPT;
#include "abstract.h"
#include "compile.h"
#include "pyctype.h"
#include "pystrtod.h"
#include "pystrcmp.h"
#include "dtoa.h"
// directly from CPython:
...
...
@@ -185,9 +185,6 @@ extern PyTypeObject* Itertool_SafeDealloc_Types[];
#define PyDoc_STRVAR(name, str) PyDoc_VAR(name) = PyDoc_STR(str)
#define PyDoc_STR(str) str
// This is in Python-ast.h in CPython, which we don't yet have:
int
PyAST_Check
(
PyObject
*
obj
)
PYSTON_NOEXCEPT
;
#ifdef __cplusplus
#define PyMODINIT_FUNC extern "C" void
#else
...
...
from_cpython/Include/abstract.h
View file @
b0cf2322
...
...
@@ -534,7 +534,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* new buffer API */
// Pyston change: made this a function
bool
_PyObject_CheckBuffer
(
PyObject
*
obj
)
PYSTON_NOEXCEPT
;
int
_PyObject_CheckBuffer
(
PyObject
*
obj
)
PYSTON_NOEXCEPT
;
#define PyObject_CheckBuffer(obj) _PyObject_CheckBuffer((PyObject*)(obj))
/* Return 1 if the getbuffer function is available, otherwise
...
...
@@ -847,7 +847,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
// Pyston change: made this a function:
PyAPI_FUNC
(
bool
)
_PyIndex_Check
(
PyObject
*
o
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
int
)
_PyIndex_Check
(
PyObject
*
o
)
PYSTON_NOEXCEPT
;
#define PyIndex_Check(obj) _PyIndex_Check((PyObject*)(obj))
#if 0
#define PyIndex_Check(obj) \
...
...
from_cpython/Include/ast.h
View file @
b0cf2322
...
...
@@ -5,7 +5,7 @@ extern "C" {
#endif
PyAPI_FUNC
(
mod_ty
)
PyAST_FromNode
(
const
node
*
,
PyCompilerFlags
*
flags
,
const
char
*
,
PyArena
*
);
const
char
*
,
PyArena
*
)
PYSTON_NOEXCEPT
;
#ifdef __cplusplus
}
...
...
from_cpython/Include/fileobject.h
View file @
b0cf2322
...
...
@@ -63,6 +63,9 @@ PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int) PYSTON_NOEXCEPT;
PyAPI_FUNC
(
int
)
PyFile_WriteString
(
const
char
*
,
PyObject
*
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
int
)
PyObject_AsFileDescriptor
(
PyObject
*
)
PYSTON_NOEXCEPT
;
// Pyston temporary addition:
PyAPI_FUNC
(
PyObject
*
)
PyFile_GetEncoding
(
PyObject
*
)
PYSTON_NOEXCEPT
;
/* The default encoding used by the platform file system APIs
If non-NULL, this is different than the default encoding for strings
*/
...
...
from_cpython/Include/object.h
View file @
b0cf2322
...
...
@@ -459,7 +459,7 @@ struct _typeobject {
char
_ics
[
32
];
void
*
_gcvisit_func
;
int
_attrs_offset
;
bool
_flags
[
7
];
char
_flags
[
7
];
// These are bools in C++
void
*
_tpp_descr_get
;
void
*
_tpp_hasnext
;
void
*
_tpp_call_capi
;
...
...
from_cpython/Include/parsetok.h
View file @
b0cf2322
...
...
@@ -33,30 +33,30 @@ typedef struct {
PyAPI_FUNC
(
node
*
)
PyParser_ParseString
(
const
char
*
,
grammar
*
,
int
,
perrdetail
*
);
perrdetail
*
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
node
*
)
PyParser_ParseFile
(
FILE
*
,
const
char
*
,
grammar
*
,
int
,
char
*
,
char
*
,
perrdetail
*
);
char
*
,
char
*
,
perrdetail
*
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
node
*
)
PyParser_ParseStringFlags
(
const
char
*
,
grammar
*
,
int
,
perrdetail
*
,
int
);
perrdetail
*
,
int
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
node
*
)
PyParser_ParseFileFlags
(
FILE
*
,
const
char
*
,
grammar
*
,
int
,
char
*
,
char
*
,
perrdetail
*
,
int
);
perrdetail
*
,
int
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
node
*
)
PyParser_ParseFileFlagsEx
(
FILE
*
,
const
char
*
,
grammar
*
,
int
,
char
*
,
char
*
,
perrdetail
*
,
int
*
);
perrdetail
*
,
int
*
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
node
*
)
PyParser_ParseStringFlagsFilename
(
const
char
*
,
const
char
*
,
grammar
*
,
int
,
perrdetail
*
,
int
);
perrdetail
*
,
int
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
node
*
)
PyParser_ParseStringFlagsFilenameEx
(
const
char
*
,
const
char
*
,
grammar
*
,
int
,
perrdetail
*
,
int
*
);
perrdetail
*
,
int
*
)
PYSTON_NOEXCEPT
;
/* Note that he following function is defined in pythonrun.c not parsetok.c. */
PyAPI_FUNC
(
void
)
PyParser_SetError
(
perrdetail
*
);
PyAPI_FUNC
(
void
)
PyParser_SetError
(
perrdetail
*
)
PYSTON_NOEXCEPT
;
#ifdef __cplusplus
}
...
...
from_cpython/Modules/_ctypes/cfield.c
View file @
b0cf2322
...
...
@@ -1293,7 +1293,7 @@ s_get(void *ptr, Py_ssize_t size)
size
=
min
(
size
,
(
Py_ssize_t
)
slen
);
// Pyston change: no ob_refcnt
if
(
false
/*result->ob_refcnt == 1*/
)
{
if
(
0
/*result->ob_refcnt == 1*/
)
{
/* shorten the result */
_PyString_Resize
(
&
result
,
size
);
return
result
;
...
...
from_cpython/Objects/weakrefobject.c
View file @
b0cf2322
...
...
@@ -951,7 +951,7 @@ PyObject_ClearWeakRefs(PyObject *object)
// Pyston change:
// current is a stack reference to a GC allocated object. If it wasn't null when we fetched it from *list, it won't
// be collected, and we can trust that it's still valid here.
if
(
true
/*current->ob_refcnt > 0*/
)
if
(
1
/*current->ob_refcnt > 0*/
)
handle_callback
(
current
,
callback
);
Py_DECREF
(
callback
);
}
...
...
@@ -973,7 +973,7 @@ PyObject_ClearWeakRefs(PyObject *object)
// Pyston change:
// current is a stack reference to a GC allocated object. If it wasn't null when we fetched it from *list, it won't
// be collected, and we can trust that it's still valid here.
if
(
true
/*current->ob_refcnt > 0*/
)
if
(
1
/*current->ob_refcnt > 0*/
)
{
Py_INCREF
(
current
);
PyTuple_SET_ITEM
(
tuple
,
i
*
2
,
(
PyObject
*
)
current
);
...
...
from_cpython/Parser/acceler.c
View file @
b0cf2322
...
...
@@ -111,7 +111,8 @@ fixstate(grammar *g, state *s)
k
++
;
if
(
k
<
nl
)
{
int
i
;
s
->
s_accel
=
(
int
*
)
PyObject_MALLOC
((
nl
-
k
)
*
sizeof
(
int
));
// Pyston change:
s
->
s_accel
=
(
int
*
)
PyGC_AddRoot
(
PyObject_MALLOC
((
nl
-
k
)
*
sizeof
(
int
)));
if
(
s
->
s_accel
==
NULL
)
{
fprintf
(
stderr
,
"no mem to add parser accelerators
\n
"
);
exit
(
1
);
...
...
from_cpython/Parser/tokenizer.c
View file @
b0cf2322
...
...
@@ -19,7 +19,7 @@
#include "pydebug.h"
#endif
/* PGEN */
extern
char
*
PyOS_Readline
(
FILE
*
,
FILE
*
,
char
*
);
extern
char
*
PyOS_Readline
(
FILE
*
,
FILE
*
,
c
onst
c
har
*
);
/* Return malloc'ed string including trailing \n;
empty malloc'ed string for EOF;
NULL if interrupted */
...
...
@@ -783,7 +783,7 @@ tok_stdin_decode(struct tok_state *tok, char **inp)
if
(
sysstdin
==
NULL
||
!
PyFile_Check
(
sysstdin
))
return
0
;
enc
=
((
PyFileObject
*
)
sysstdin
)
->
f_encoding
;
enc
=
PyFile_GetEncoding
(
sysstdin
)
;
if
(
enc
==
NULL
||
!
PyString_Check
(
enc
))
return
0
;
Py_INCREF
(
enc
);
...
...
from_cpython/Python/Python-ast.c
View file @
b0cf2322
...
...
@@ -461,7 +461,7 @@ static PyMethodDef ast_type_methods[] = {
};
static
PyTypeObject
AST_type
=
{
PyVarObject_HEAD_INIT
(
&
PyType_Type
,
0
)
PyVarObject_HEAD_INIT
(
/* Pyston change: &PyType_Type */
NULL
,
0
)
"_ast.AST"
,
sizeof
(
PyObject
),
0
,
...
...
@@ -6779,10 +6779,13 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
return
res
;
}
// Pyston temporary change: we're not using this file for the python module, at least not yet.
#if 0
int PyAST_Check(PyObject* obj)
{
init_types();
return PyObject_IsInstance(obj, (PyObject*)&AST_type);
}
#endif
src/codegen/cpython_ast.h
View file @
b0cf2322
...
...
@@ -22,8 +22,10 @@
namespace
pyston
{
AST_Module
*
cpythonToPystonAst
(
mod_ty
mod
);
// Convert a CPython ast object to a Pyston ast object.
// This will also check for certain kinds of "syntax errors" (ex continue not in loop) and will
// throw them as C++ exceptions.
AST_Module
*
cpythonToPystonAST
(
mod_ty
mod
,
llvm
::
StringRef
fn
);
}
#endif
src/codegen/irgen/hooks.cpp
View file @
b0cf2322
...
...
@@ -14,6 +14,16 @@
#include "codegen/irgen/hooks.h"
#include "codegen/cpython_ast.h"
// These #defines in Python-ast.h conflict with llvm:
#undef Pass
#undef Module
#undef alias
#undef Option
#undef Name
#undef Attribute
#undef Set
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/Support/raw_ostream.h"
...
...
src/runtime/capi.cpp
View file @
b0cf2322
...
...
@@ -39,12 +39,12 @@ namespace pyston {
BoxedClass
*
method_cls
;
extern
"C"
bool
_PyIndex_Check
(
PyObject
*
obj
)
noexcept
{
extern
"C"
int
_PyIndex_Check
(
PyObject
*
obj
)
noexcept
{
return
(
Py_TYPE
(
obj
)
->
tp_as_number
!=
NULL
&&
PyType_HasFeature
(
Py_TYPE
(
obj
),
Py_TPFLAGS_HAVE_INDEX
)
&&
Py_TYPE
(
obj
)
->
tp_as_number
->
nb_index
!=
NULL
);
}
extern
"C"
bool
_PyObject_CheckBuffer
(
PyObject
*
obj
)
noexcept
{
extern
"C"
int
_PyObject_CheckBuffer
(
PyObject
*
obj
)
noexcept
{
return
((
Py_TYPE
(
obj
)
->
tp_as_buffer
!=
NULL
)
&&
(
PyType_HasFeature
(
Py_TYPE
(
obj
),
Py_TPFLAGS_HAVE_NEWBUFFER
))
&&
(
Py_TYPE
(
obj
)
->
tp_as_buffer
->
bf_getbuffer
!=
NULL
));
}
...
...
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