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
17ab177e
Commit
17ab177e
authored
Nov 12, 2016
by
Kevin Modzelewski
Committed by
GitHub
Nov 12, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1396 from kmod/metaserver_merge
More misc compatibility fixes
parents
93df6ef7
b3c96f01
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
83 additions
and
33 deletions
+83
-33
.travis.yml
.travis.yml
+4
-1
CMakeLists.txt
CMakeLists.txt
+2
-1
src/runtime/capi.cpp
src/runtime/capi.cpp
+4
-2
src/runtime/code.cpp
src/runtime/code.cpp
+8
-4
src/runtime/descr.cpp
src/runtime/descr.cpp
+6
-3
src/runtime/list.cpp
src/runtime/list.cpp
+1
-1
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+4
-0
src/runtime/str.cpp
src/runtime/str.cpp
+11
-11
src/runtime/types.cpp
src/runtime/types.cpp
+9
-6
test/extra/cheetah_test.py
test/extra/cheetah_test.py
+3
-3
test/integration/sqlalchemy_smalltest.py
test/integration/sqlalchemy_smalltest.py
+3
-0
test/tests/compare_order.py
test/tests/compare_order.py
+22
-0
test/tests/dunder_descriptors.py
test/tests/dunder_descriptors.py
+5
-0
test/tests/str_manipulation.py
test/tests/str_manipulation.py
+1
-1
No files found.
.travis.yml
View file @
17ab177e
...
...
@@ -76,10 +76,13 @@ before_script:
-
mysql -e 'create database mysqldb_test charset utf8;'
script
:
-
df
-
ccache -z
-
time ninja -j4 pyston check-deps && PYSTON_RUN_ARGS=G travis_wait 60 ctest --output-on-failure
-
ccache -s
-
if [ -n "$(git status --porcelain --untracked=no)" ]; then echo "test suite left the source directory dirty"; git status;
false
; fi
-
df
-
free -m
# - if [ -n "$(git status --porcelain --untracked=no)" ]; then echo "test suite left the source directory dirty"; git status; false; fi
os
:
-
linux
...
...
CMakeLists.txt
View file @
17ab177e
...
...
@@ -311,8 +311,9 @@ add_subdirectory(tools)
add_custom_command
(
OUTPUT
${
CMAKE_BINARY_DIR
}
/linkdeps_dummy.c COMMAND
${
CMAKE_COMMAND
}
-E touch
${
CMAKE_BINARY_DIR
}
/linkdeps_dummy.c DEPENDS
${
CMAKE_SOURCE_DIR
}
/section_ordering.txt
)
add_executable
(
pyston $<TARGET_OBJECTS:PYSTON_MAIN_OBJECT> $<TARGET_OBJECTS:PYSTON_OBJECTS> $<TARGET_OBJECTS:FROM_CPYTHON> linkdeps_dummy.c
)
# Wrap the stdlib in --whole-archive to force all the symbols to be included and eventually exported
add_custom_command
(
TARGET pyston POST_BUILD COMMAND
${
CMAKE_COMMAND
}
-E create_symlink
${
CMAKE_BINARY_DIR
}
/pyston
${
CMAKE_BINARY_DIR
}
/python DEPENDS pyston
)
# Wrap the stdlib in --whole-archive to force all the symbols to be included and eventually exported
target_link_libraries
(
pyston -Wl,--whole-archive stdlib -Wl,--no-whole-archive pthread m z readline sqlite3 gmp mpfr ssl crypto unwind liblz4 util
${
LLVM_LIBS
}
${
LIBLZMA_LIBRARIES
}
${
OPTIONAL_LIBRARIES
}
${
CMAKE_BINARY_DIR
}
/jemalloc/lib/libjemalloc.a
)
add_dependencies
(
pyston libjemalloc
)
...
...
src/runtime/capi.cpp
View file @
17ab177e
...
...
@@ -1662,8 +1662,10 @@ void setupCAPI() {
capifunc_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
BoxedCApiFunction
::
__repr__
<
CXX
>
,
UNKNOWN
,
1
,
"capifunc.__repr__"
)));
auto
capi_call
=
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
BoxedCApiFunction
::
__call__
,
UNKNOWN
,
1
,
true
,
true
,
"capifunc.__call__"
));
auto
capi_call
=
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
BoxedCApiFunction
::
__call__
,
UNKNOWN
,
1
,
true
,
true
,
"capifunc.__call__"
,
""
,
ParamNames
({
"self"
},
"args"
,
"kw"
)));
capifunc_cls
->
giveAttr
(
"__call__"
,
capi_call
);
capifunc_cls
->
tpp_call
.
capi_val
=
BoxedCApiFunction
::
tppCall
<
CAPI
>
;
capifunc_cls
->
tpp_call
.
cxx_val
=
BoxedCApiFunction
::
tppCall
<
CXX
>
;
...
...
src/runtime/code.cpp
View file @
17ab177e
...
...
@@ -74,8 +74,9 @@ Box* BoxedCode::varnames(Box* b, void*) noexcept {
BoxedCode
*
code
=
static_cast
<
BoxedCode
*>
(
b
);
auto
&
param_names
=
code
->
param_names
;
if
(
!
param_names
.
takes_param_names
)
return
incref
(
EmptyTuple
);
RELEASE_ASSERT
(
param_names
.
takes_param_names
,
"shouldn't have created '%s' as a BoxedFunction"
,
code
->
name
->
c_str
());
std
::
vector
<
Box
*>
elts
;
for
(
auto
sr
:
param_names
.
allArgsAsStr
())
...
...
@@ -91,9 +92,9 @@ Box* BoxedCode::flags(Box* b, void*) noexcept {
BoxedCode
*
code
=
static_cast
<
BoxedCode
*>
(
b
);
int
flags
=
0
;
if
(
code
->
param_names
.
has_vararg_name
)
if
(
code
->
takes_varargs
)
flags
|=
CO_VARARGS
;
if
(
code
->
param_names
.
has_kwarg_name
)
if
(
code
->
takes_kwargs
)
flags
|=
CO_VARKEYWORDS
;
if
(
code
->
isGenerator
())
flags
|=
CO_GENERATOR
;
...
...
@@ -129,6 +130,9 @@ BoxedCode::BoxedCode(int num_args, bool takes_varargs, bool takes_kwargs, int fi
num_args
(
num_args
),
times_interpreted
(
0
),
internal_callable
(
NULL
,
NULL
)
{
// If any param names are specified, make sure all of them are (to avoid common mistakes):
ASSERT
(
this
->
param_names
.
numNormalArgs
()
==
0
||
this
->
param_names
.
numNormalArgs
()
==
num_args
,
"%d %d"
,
this
->
param_names
.
numNormalArgs
(),
num_args
);
}
BoxedCode
::
BoxedCode
(
int
num_args
,
bool
takes_varargs
,
bool
takes_kwargs
,
const
char
*
name
,
const
char
*
doc
,
...
...
src/runtime/descr.cpp
View file @
17ab177e
...
...
@@ -598,11 +598,14 @@ void setupDescr() {
ParamNames
({
""
,
"fget"
,
"fset"
,
"fdel"
,
"doc"
},
""
,
""
)),
{
Py_None
,
Py_None
,
Py_None
,
NULL
}));
property_cls
->
giveAttr
(
"__get__"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
propertyGet
,
UNKNOWN
,
3
,
"property.__get__"
)));
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
propertyGet
,
UNKNOWN
,
3
,
"property.__get__"
,
""
,
ParamNames
({
"self"
,
"obj"
,
"type"
},
""
,
""
))));
property_cls
->
giveAttr
(
"__set__"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
propertySet
,
UNKNOWN
,
3
,
"property.__set__"
)));
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
propertySet
,
UNKNOWN
,
3
,
"property.__set__"
,
""
,
ParamNames
({
"self"
,
"obj"
,
"value"
},
""
,
""
))));
property_cls
->
giveAttr
(
"__delete__"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
propertyDel
,
UNKNOWN
,
2
,
"property.__delete__"
)));
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
propertyDel
,
UNKNOWN
,
2
,
"property.__delete__"
,
""
,
ParamNames
({
"self"
,
"obj"
},
""
,
""
))));
property_cls
->
giveAttr
(
"getter"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
propertyGetter
,
UNKNOWN
,
2
,
"property.getter"
)));
property_cls
->
giveAttr
(
"setter"
,
...
...
src/runtime/list.cpp
View file @
17ab177e
...
...
@@ -1013,7 +1013,7 @@ static inline int listContainsShared(BoxedList* self, Box* elt) {
if
(
identity_eq
)
return
true
;
int
r
=
PyObject_RichCompareBool
(
e
,
elt
,
Py_EQ
);
int
r
=
PyObject_RichCompareBool
(
e
lt
,
e
,
Py_EQ
);
if
(
r
==
-
1
)
throwCAPIException
();
...
...
src/runtime/objmodel.cpp
View file @
17ab177e
...
...
@@ -1483,6 +1483,10 @@ void Box::appendNewHCAttr(BORROWED(Box*) new_attr, SetattrRewriteArgs* rewrite_a
}
void
Box
::
giveAttr
(
STOLEN
(
BoxedString
*
)
attr
,
STOLEN
(
Box
*
)
val
)
{
// While it's certainly possible to put builtin_function_or_method objects on a type, this is in practice never
// what you want to do, because those objects don't have bind-on-get behavior.
assert
(
cls
==
module_cls
||
val
->
cls
!=
builtin_function_or_method_cls
);
assert
(
!
this
->
hasattr
(
attr
));
// Would be nice to have a stealing version of setattr:
this
->
setattr
(
attr
,
val
,
NULL
);
...
...
src/runtime/str.cpp
View file @
17ab177e
...
...
@@ -1763,11 +1763,9 @@ Box* strIsLower(BoxedString* self) {
Py_RETURN_FALSE
;
for
(
const
auto
&
c
:
str
)
{
if
(
std
::
isspace
(
c
)
||
std
::
isdigit
(
c
))
{
continue
;
}
else
if
(
!
std
::
islower
(
c
))
{
if
(
isupper
(
c
))
{
Py_RETURN_FALSE
;
}
else
{
}
else
if
(
!
lowered
&&
islower
(
c
))
{
lowered
=
true
;
}
}
...
...
@@ -1785,7 +1783,7 @@ Box* strIsUpper(BoxedString* self) {
bool
cased
=
false
;
for
(
const
auto
&
c
:
str
)
{
if
(
std
::
islower
(
c
))
if
(
islower
(
c
))
Py_RETURN_FALSE
;
else
if
(
!
cased
&&
isupper
(
c
))
cased
=
true
;
...
...
@@ -2741,12 +2739,14 @@ void setupStr() {
str_cls
->
giveAttr
(
"istitle"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
strIsTitle
,
BOXED_BOOL
,
1
,
"str.istitle"
)));
str_cls
->
giveAttr
(
"isupper"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
strIsUpper
,
BOXED_BOOL
,
1
,
"str.isupper"
)));
str_cls
->
giveAttr
(
"decode"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
strDecode
,
UNKNOWN
,
3
,
false
,
false
,
"str.decode"
),
{
0
,
0
}));
str_cls
->
giveAttr
(
"encode"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
strEncode
,
UNKNOWN
,
3
,
false
,
false
,
"str.encode"
),
{
0
,
0
}));
str_cls
->
giveAttr
(
"decode"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
strDecode
,
UNKNOWN
,
3
,
false
,
false
,
"str.decode"
,
""
,
ParamNames
({
""
,
"encoding"
,
"errors"
},
NULL
,
NULL
)),
{
0
,
0
}));
str_cls
->
giveAttr
(
"encode"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
strEncode
,
UNKNOWN
,
3
,
false
,
false
,
"str.encode"
,
""
,
ParamNames
({
""
,
"encoding"
,
"errors"
},
NULL
,
NULL
)),
{
0
,
0
}));
str_cls
->
giveAttr
(
"lower"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
strLower
,
STR
,
1
,
"str.lower"
)));
str_cls
->
giveAttr
(
"swapcase"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
strSwapcase
,
STR
,
1
,
"str.swapcase"
)));
...
...
src/runtime/types.cpp
View file @
17ab177e
...
...
@@ -4386,7 +4386,8 @@ void setupRuntime() {
// but unfortunately that will set tp_setattro to slot_tp_setattro on object_cls and all already-made subclasses!
// Punting on that until needed; hopefully by then we will have better Pyston slots support.
auto
typeCallObj
=
BoxedCode
::
create
((
void
*
)
typeCall
,
UNKNOWN
,
1
,
true
,
true
,
"type.__call__"
);
auto
typeCallObj
=
BoxedCode
::
create
((
void
*
)
typeCall
,
UNKNOWN
,
1
,
true
,
true
,
"type.__call__"
,
""
,
ParamNames
({
"self"
},
"args"
,
"kw"
));
typeCallObj
->
internal_callable
.
capi_val
=
&
typeCallInternal
<
CAPI
>
;
typeCallObj
->
internal_callable
.
cxx_val
=
&
typeCallInternal
<
CXX
>
;
...
...
@@ -4498,7 +4499,8 @@ void setupRuntime() {
"__get__"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
functionGet
,
UNKNOWN
,
3
,
"function.__get__"
),
{
Py_None
}));
function_cls
->
giveAttr
(
"__call__"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
functionCall
,
UNKNOWN
,
1
,
true
,
true
,
"function.__call__"
)));
"function.__call__"
,
""
,
ParamNames
({
"self"
},
"args"
,
"kw"
))));
function_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
functionNonzero
,
BOXED_BOOL
,
1
,
"function.__nonzero__"
)));
function_cls
->
giveAttrDescriptor
(
"func_code"
,
function_code
,
function_set_code
);
...
...
@@ -4517,7 +4519,8 @@ void setupRuntime() {
offsetof
(
BoxedBuiltinFunctionOrMethod
,
modname
));
builtin_function_or_method_cls
->
giveAttr
(
"__call__"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
builtinFunctionOrMethodCall
,
UNKNOWN
,
1
,
true
,
true
,
"builtin_function_or_method.__call__"
)));
"builtin_function_or_method.__call__"
,
""
,
ParamNames
({
"self"
},
"args"
,
"kw"
))));
builtin_function_or_method_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
builtinFunctionOrMethodRepr
,
STR
,
1
,
...
...
@@ -4537,9 +4540,9 @@ void setupRuntime() {
instancemethod_cls
->
giveAttr
(
"__get__"
,
new
BoxedFunction
(
BoxedCode
::
create
((
void
*
)
instancemethodGet
,
UNKNOWN
,
3
,
false
,
false
,
"instancemethod.__get__"
)));
instancemethod_cls
->
giveAttr
(
"__call__"
,
new
BoxedFunction
(
BoxedCode
::
create
(
(
void
*
)
instancemethodCall
,
UNKNOWN
,
1
,
true
,
true
,
"instancemethod.__call__"
)));
instancemethod_cls
->
giveAttr
(
"__call__"
,
new
BoxedFunction
(
BoxedCode
::
create
(
(
void
*
)
instancemethodCall
,
UNKNOWN
,
1
,
true
,
true
,
"instancemethod.__call__"
,
""
,
ParamNames
({
"self"
},
"args"
,
"kw"
)
)));
instancemethod_cls
->
giveAttrMember
(
"im_func"
,
T_OBJECT
,
offsetof
(
BoxedInstanceMethod
,
func
));
instancemethod_cls
->
giveAttrBorrowed
(
"__func__"
,
instancemethod_cls
->
getattr
(
getStaticString
(
"im_func"
)));
instancemethod_cls
->
giveAttrMember
(
"im_self"
,
T_OBJECT
,
offsetof
(
BoxedInstanceMethod
,
obj
));
...
...
test/extra/cheetah_test.py
View file @
17ab177e
...
...
@@ -9,10 +9,10 @@ create_virtenv(ENV_NAME, ["cheetah==2.4.4", "Markdown==2.0.1"], force_create = T
cheetah_exe
=
os
.
path
.
join
(
ENV_NAME
,
"bin"
,
"cheetah"
)
env
=
os
.
environ
env
[
"PATH"
]
=
os
.
path
.
join
(
ENV_NAME
,
"bin"
)
expected
=
[{
'ran'
:
2138
,
'errors'
:
4
},
{
'ran'
:
2138
,
'errors'
:
232
,
'failures'
:
2
}]
expected
=
[{
'ran'
:
2138
},
{
'ran'
:
2138
,
'errors'
:
228
,
'failures'
:
2
}]
expected_log_hash
=
'''
jco
DAKUIQTpEDIDiMwAuQFEAKABjEbNAAAACgqABAAGgGsGQaQQLg/l0gIQXbEA4IKQis
BIAAlOQ
I
G4lA5AAASAqqGdMCPAAALKbAEQAYAcCEgRHAQCAAhAVJIghShwAUpAAKaEwgk0GaEUkgQI
IADgb
jco
CAIUIQTJEDoDiMwAuQFEAKABjEbMAAAACgqAAAAGgGsGAaQQKg3l0AIQWbEAwIKQmk
BIAAlOQ
I
E4kA5AAASAqiGdMCPAAALKLAEwAYAcCEgRHAQCAAhAVJIghShwAUoAAKaEwgk0EaEUkgQA
IADgb
pKTQYrIACAshhJ6Bwh0=
'''
run_test
([
cheetah_exe
,
"test"
],
cwd
=
ENV_NAME
,
expected
=
expected
,
env
=
env
,
expected_log_hash
=
expected_log_hash
)
test/integration/sqlalchemy_smalltest.py
View file @
17ab177e
...
...
@@ -247,6 +247,9 @@ for run_idx in xrange(1):
if
(
clsname
==
"SubclassGrowthTest"
and
t
==
"test_subclass"
):
continue
if
(
clsname
==
"ArgInspectionTest"
and
t
==
'test_callable_argspec_py_builtin'
):
continue
print
"Running"
,
t
n
.
setup
()
try
:
...
...
test/tests/compare_order.py
0 → 100644
View file @
17ab177e
class
A
(
object
):
def
__eq__
(
self
,
rhs
):
return
True
class
B
(
object
):
def
__eq__
(
self
,
lhs
):
return
False
print
A
()
==
B
()
print
B
()
==
A
()
print
A
()
in
[
B
()]
print
B
()
in
[
A
()]
print
A
()
in
(
B
(),)
print
B
()
in
(
A
(),)
print
A
()
in
{
B
():
1
}
print
B
()
in
{
A
():
1
}
print
A
()
in
{
B
()}
print
B
()
in
{
A
()}
test/tests/dunder_descriptors.py
View file @
17ab177e
...
...
@@ -73,3 +73,8 @@ def f3():
D
.
__get__
=
get
print
type
(
C
())
f3
()
# misc tests:
import
sys
sys
.
getrecursionlimit
.
__call__
.
__call__
.
__call__
()
TypeError
.
__call__
.
__call__
.
__call__
()
test/tests/str_manipulation.py
View file @
17ab177e
...
...
@@ -93,7 +93,7 @@ for i in xrange(256):
test
(
c
)
test_is
(
c
)
for
j
in
xrange
(
i
,
64
):
for
j
in
xrange
(
i
,
128
):
test_is
(
c
+
chr
(
j
))
try
:
...
...
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