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
24d82a06
Commit
24d82a06
authored
Nov 13, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More stuff working
parent
9024f9f1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
46 deletions
+49
-46
src/runtime/classobj.cpp
src/runtime/classobj.cpp
+1
-1
src/runtime/dict.cpp
src/runtime/dict.cpp
+2
-1
src/runtime/file.cpp
src/runtime/file.cpp
+4
-4
src/runtime/float.cpp
src/runtime/float.cpp
+3
-3
src/runtime/list.cpp
src/runtime/list.cpp
+1
-1
src/runtime/long.cpp
src/runtime/long.cpp
+6
-6
src/runtime/set.cpp
src/runtime/set.cpp
+22
-23
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+4
-3
src/runtime/types.cpp
src/runtime/types.cpp
+6
-4
No files found.
src/runtime/classobj.cpp
View file @
24d82a06
...
...
@@ -1658,7 +1658,7 @@ void setupClassobj() {
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
classobjSetattr
,
UNKNOWN
,
3
)));
classobj_cls
->
giveAttr
(
"__str__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
classobjStr
,
STR
,
1
)));
classobj_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
classobjRepr
,
STR
,
1
)));
classobj_cls
->
giveAttr
(
"__dict__"
,
dict_descr
);
classobj_cls
->
giveAttr
Borrowed
(
"__dict__"
,
dict_descr
);
classobj_cls
->
freeze
();
classobj_cls
->
tp_getattro
=
classobj_getattro
;
...
...
src/runtime/dict.cpp
View file @
24d82a06
...
...
@@ -836,7 +836,7 @@ void setupDict() {
typeFromClass
(
dict_iterator_cls
),
1
)));
dict_cls
->
giveAttr
(
"keys"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
dictKeys
,
LIST
,
1
)));
dict_cls
->
giveAttr
(
"iterkeys"
,
dict_cls
->
getattr
(
internStringMortal
(
"__iter__"
)));
dict_cls
->
giveAttr
Borrowed
(
"iterkeys"
,
dict_cls
->
getattr
(
autoDecref
(
internStringMortal
(
"__iter__"
)
)));
dict_cls
->
giveAttr
(
"pop"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
dictPop
,
UNKNOWN
,
3
,
false
,
false
),
{
NULL
}));
...
...
@@ -845,6 +845,7 @@ void setupDict() {
auto
*
fromkeys_func
=
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
dictFromkeys
,
DICT
,
3
,
false
,
false
),
{
None
});
dict_cls
->
giveAttr
(
"fromkeys"
,
boxInstanceMethod
(
dict_cls
,
fromkeys_func
,
dict_cls
));
Py_DECREF
(
fromkeys_func
);
dict_cls
->
giveAttr
(
"viewkeys"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
dictViewKeys
,
UNKNOWN
,
1
)));
dict_cls
->
giveAttr
(
"viewvalues"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
dictViewValues
,
UNKNOWN
,
1
)));
...
...
src/runtime/file.cpp
View file @
24d82a06
...
...
@@ -1858,8 +1858,8 @@ void file_dealloc(Box* b) noexcept {
void
setupFile
()
{
file_cls
->
has_safe_tp_dealloc
=
true
;
file_cls
->
giveAttr
(
"read"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
fileRead
,
STR
,
2
,
false
,
false
),
{
boxInt
(
-
1
)
}));
file_cls
->
giveAttr
(
"read"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
fileRead
,
STR
,
2
,
false
,
false
),
{
autoDecref
(
boxInt
(
-
1
)
)
}));
FunctionMetadata
*
readline
=
FunctionMetadata
::
create
((
void
*
)
fileReadline1
,
STR
,
1
);
file_cls
->
giveAttr
(
"readline"
,
new
BoxedFunction
(
readline
));
...
...
@@ -1875,7 +1875,7 @@ void setupFile() {
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
fileEnter
,
typeFromClass
(
file_cls
),
1
)));
file_cls
->
giveAttr
(
"__exit__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
fileExit
,
UNKNOWN
,
4
)));
file_cls
->
giveAttr
(
"__iter__"
,
file_cls
->
getattr
(
getStaticString
(
"__enter__"
)));
file_cls
->
giveAttr
Borrowed
(
"__iter__"
,
file_cls
->
getattr
(
getStaticString
(
"__enter__"
)));
file_cls
->
giveAttr
(
"__hasnext__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
fileIterHasNext
,
BOXED_BOOL
,
1
)));
file_cls
->
giveAttr
(
"next"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
fileIterNext
,
STR
,
1
)));
...
...
@@ -1889,7 +1889,7 @@ void setupFile() {
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedFile
,
f_mode
),
true
));
file_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
fileNew
,
UNKNOWN
,
4
,
false
,
false
),
{
boxString
(
"r"
),
boxInt
(
-
1
)
}));
{
autoDecref
(
boxString
(
"r"
)),
autoDecref
(
boxInt
(
-
1
)
)
}));
for
(
auto
&
md
:
file_methods
)
{
file_cls
->
giveAttr
(
md
.
ml_name
,
new
BoxedMethodDescriptor
(
&
md
,
file_cls
));
...
...
src/runtime/float.cpp
View file @
24d82a06
...
...
@@ -1647,7 +1647,7 @@ void setupFloat() {
1
,
ParamNames
::
empty
(),
CAPI
)));
_addFunc
(
"__add__"
,
BOXED_FLOAT
,
(
void
*
)
floatAddFloat
,
(
void
*
)
floatAddInt
,
(
void
*
)
floatAdd
);
float_cls
->
giveAttr
(
"__radd__"
,
float_cls
->
getattr
(
internStringMortal
(
"__add__"
)));
float_cls
->
giveAttr
Borrowed
(
"__radd__"
,
float_cls
->
getattr
(
autoDecref
(
internStringMortal
(
"__add__"
)
)));
_addFunc
(
"__div__"
,
BOXED_FLOAT
,
(
void
*
)
floatDivFloat
,
(
void
*
)
floatDivInt
,
(
void
*
)
floatDiv
);
_addFunc
(
"__rdiv__"
,
BOXED_FLOAT
,
(
void
*
)
floatRDivFloat
,
(
void
*
)
floatRDivInt
,
(
void
*
)
floatRDiv
);
...
...
@@ -1657,7 +1657,7 @@ void setupFloat() {
_addFunc
(
"__mod__"
,
BOXED_FLOAT
,
(
void
*
)
floatModFloat
,
(
void
*
)
floatModInt
,
(
void
*
)
floatMod
);
_addFunc
(
"__rmod__"
,
BOXED_FLOAT
,
(
void
*
)
floatRModFloat
,
(
void
*
)
floatRModInt
,
(
void
*
)
floatRMod
);
_addFunc
(
"__mul__"
,
BOXED_FLOAT
,
(
void
*
)
floatMulFloat
,
(
void
*
)
floatMulInt
,
(
void
*
)
floatMul
);
float_cls
->
giveAttr
(
"__rmul__"
,
float_cls
->
getattr
(
internStringMortal
(
"__mul__"
)));
float_cls
->
giveAttr
Borrowed
(
"__rmul__"
,
float_cls
->
getattr
(
autoDecref
(
internStringMortal
(
"__mul__"
)
)));
_addFuncPow
(
"__pow__"
,
BOXED_FLOAT
,
(
void
*
)
floatPowFloat
,
(
void
*
)
floatPowInt
,
(
void
*
)
floatPow
);
_addFunc
(
"__sub__"
,
BOXED_FLOAT
,
(
void
*
)
floatSubFloat
,
(
void
*
)
floatSubInt
,
(
void
*
)
floatSub
);
...
...
@@ -1665,7 +1665,7 @@ void setupFloat() {
auto
float_new
=
FunctionMetadata
::
create
((
void
*
)
floatNew
<
CXX
>
,
UNKNOWN
,
2
,
false
,
false
,
ParamNames
::
empty
(),
CXX
);
float_new
->
addVersion
((
void
*
)
floatNew
<
CAPI
>
,
UNKNOWN
,
CAPI
);
float_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
float_new
,
{
boxFloat
(
0.0
)
}));
float_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
float_new
,
{
autoDecref
(
boxFloat
(
0.0
)
)
}));
float_cls
->
giveAttr
(
"__eq__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
floatEq
,
UNKNOWN
,
2
)));
float_cls
->
giveAttr
(
"__ne__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
floatNe
,
UNKNOWN
,
2
)));
...
...
src/runtime/list.cpp
View file @
24d82a06
...
...
@@ -1345,7 +1345,7 @@ void setupList() {
list_cls
->
giveAttr
(
"remove"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
listRemove
,
NONE
,
2
)));
list_cls
->
giveAttr
(
"reverse"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
listReverse
,
NONE
,
1
)));
list_cls
->
giveAttr
(
"__hash__"
,
None
);
list_cls
->
giveAttr
Borrowed
(
"__hash__"
,
None
);
list_cls
->
freeze
();
list_cls
->
tp_iter
=
listIter
;
...
...
src/runtime/long.cpp
View file @
24d82a06
...
...
@@ -1494,10 +1494,10 @@ void setupLong() {
auto
long_new
=
FunctionMetadata
::
create
((
void
*
)
longNew
<
CXX
>
,
UNKNOWN
,
3
,
false
,
false
,
ParamNames
({
""
,
"x"
,
"base"
},
""
,
""
),
CXX
);
long_new
->
addVersion
((
void
*
)
longNew
<
CAPI
>
,
UNKNOWN
,
CAPI
);
long_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
long_new
,
{
boxInt
(
0
),
NULL
}));
long_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
long_new
,
{
autoDecref
(
boxInt
(
0
)
),
NULL
}));
long_cls
->
giveAttr
(
"__mul__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
longMul
,
UNKNOWN
,
2
)));
long_cls
->
giveAttr
(
"__rmul__"
,
long_cls
->
getattr
(
internStringMortal
(
"__mul__"
)));
long_cls
->
giveAttr
(
"__rmul__"
,
incref
(
long_cls
->
getattr
(
autoDecref
(
internStringMortal
(
"__mul__"
))
)));
long_cls
->
giveAttr
(
"__div__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
longDiv
,
UNKNOWN
,
2
)));
long_cls
->
giveAttr
(
"__rdiv__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
longRdiv
,
UNKNOWN
,
2
)));
...
...
@@ -1514,13 +1514,13 @@ void setupLong() {
long_cls
->
giveAttr
(
"__rsub__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
longRsub
,
UNKNOWN
,
2
)));
long_cls
->
giveAttr
(
"__add__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
longAdd
,
UNKNOWN
,
2
)));
long_cls
->
giveAttr
(
"__radd__"
,
long_cls
->
getattr
(
internStringMortal
(
"__add__"
)));
long_cls
->
giveAttr
(
"__radd__"
,
incref
(
long_cls
->
getattr
(
autoDecref
(
internStringMortal
(
"__add__"
))
)));
long_cls
->
giveAttr
(
"__and__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
longAnd
,
UNKNOWN
,
2
)));
long_cls
->
giveAttr
(
"__rand__"
,
long_cls
->
getattr
(
internStringMortal
(
"__and__"
)));
long_cls
->
giveAttr
(
"__rand__"
,
incref
(
long_cls
->
getattr
(
autoDecref
(
internStringMortal
(
"__and__"
))
)));
long_cls
->
giveAttr
(
"__or__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
longOr
,
UNKNOWN
,
2
)));
long_cls
->
giveAttr
(
"__ror__"
,
long_cls
->
getattr
(
internStringMortal
(
"__or__"
)));
long_cls
->
giveAttr
(
"__ror__"
,
incref
(
long_cls
->
getattr
(
autoDecref
(
internStringMortal
(
"__or__"
))
)));
long_cls
->
giveAttr
(
"__xor__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
longXor
,
UNKNOWN
,
2
)));
long_cls
->
giveAttr
(
"__rxor__"
,
long_cls
->
getattr
(
internStringMortal
(
"__xor__"
)));
long_cls
->
giveAttr
(
"__rxor__"
,
incref
(
long_cls
->
getattr
(
autoDecref
(
internStringMortal
(
"__xor__"
))
)));
// Note: CPython implements long comparisons using tp_compare
long_cls
->
tp_richcompare
=
long_richcompare
;
...
...
src/runtime/set.cpp
View file @
24d82a06
...
...
@@ -834,9 +834,9 @@ void setupSet() {
"__new__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
frozensetNew
,
UNKNOWN
,
2
,
false
,
true
),
{
NULL
}));
Box
*
set_repr
=
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setRepr
,
STR
,
1
));
set_cls
->
giveAttr
(
"__repr__"
,
set_repr
);
set_cls
->
giveAttr
(
"__str__"
,
set_repr
);
frozenset_cls
->
giveAttr
(
"__repr__"
,
set_repr
);
set_cls
->
giveAttr
Borrowed
(
"__repr__"
,
set_repr
);
set_cls
->
giveAttr
Borrowed
(
"__str__"
,
set_repr
);
frozenset_cls
->
giveAttr
Borrowed
(
"__repr__"
,
set_repr
);
frozenset_cls
->
giveAttr
(
"__str__"
,
set_repr
);
std
::
vector
<
ConcreteCompilerType
*>
v_ss
,
v_sf
,
v_su
,
v_ff
,
v_fs
,
v_fu
;
...
...
@@ -856,7 +856,7 @@ void setupSet() {
auto
add
=
[
&
](
const
char
*
name
,
void
*
func
)
{
auto
func_obj
=
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
func
,
UNKNOWN
,
2
,
false
,
false
));
set_cls
->
giveAttr
(
name
,
func_obj
);
set_cls
->
giveAttr
Borrowed
(
name
,
func_obj
);
frozenset_cls
->
giveAttr
(
name
,
func_obj
);
/*
FunctionMetadata* func_obj = FunctionMetadata::create(2, false, false);
...
...
@@ -878,37 +878,36 @@ void setupSet() {
add
(
"__ixor__"
,
(
void
*
)
setIXor
);
add
(
"__iand__"
,
(
void
*
)
setIAnd
);
set_cls
->
giveAttr
(
"__iter__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setIter
,
typeFromClass
(
set_iterator_cls
),
1
)));
frozenset_cls
->
giveAttr
(
"__iter__"
,
set_cls
->
getattr
(
internStringMortal
(
"__iter__"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"__iter__"
,
set_cls
->
getattr
(
getStaticString
(
"__iter__"
)));
set_cls
->
giveAttr
(
"__len__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setLen
,
BOXED_INT
,
1
)));
frozenset_cls
->
giveAttr
(
"__len__"
,
set_cls
->
getattr
(
internStringMortal
(
"__len__"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"__len__"
,
set_cls
->
getattr
(
getStaticString
(
"__len__"
)));
set_cls
->
giveAttr
(
"__contains__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setContains
,
BOXED_BOOL
,
2
)));
frozenset_cls
->
giveAttr
(
"__contains__"
,
set_cls
->
getattr
(
internStringMortal
(
"__contains__"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"__contains__"
,
set_cls
->
getattr
(
getStaticString
(
"__contains__"
)));
set_cls
->
giveAttr
(
"__cmp__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setNocmp
,
NONE
,
2
)));
frozenset_cls
->
giveAttr
(
"__cmp__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setNocmp
,
NONE
,
2
)));
set_cls
->
giveAttr
(
"__eq__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setEq
,
BOXED_BOOL
,
2
)));
frozenset_cls
->
giveAttr
(
"__eq__"
,
set_cls
->
getattr
(
internStringMortal
(
"__eq__"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"__eq__"
,
set_cls
->
getattr
(
getStaticString
(
"__eq__"
)));
set_cls
->
giveAttr
(
"__ne__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setNe
,
BOXED_BOOL
,
2
)));
frozenset_cls
->
giveAttr
(
"__ne__"
,
set_cls
->
getattr
(
internStringMortal
(
"__ne__"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"__ne__"
,
set_cls
->
getattr
(
getStaticString
(
"__ne__"
)));
set_cls
->
giveAttr
(
"__le__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setLe
,
BOXED_BOOL
,
2
)));
frozenset_cls
->
giveAttr
(
"__le__"
,
set_cls
->
getattr
(
internStringMortal
(
"__le__"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"__le__"
,
set_cls
->
getattr
(
getStaticString
(
"__le__"
)));
set_cls
->
giveAttr
(
"__lt__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setLt
,
BOXED_BOOL
,
2
)));
frozenset_cls
->
giveAttr
(
"__lt__"
,
set_cls
->
getattr
(
internStringMortal
(
"__lt__"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"__lt__"
,
set_cls
->
getattr
(
getStaticString
(
"__lt__"
)));
set_cls
->
giveAttr
(
"__ge__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setGe
,
BOXED_BOOL
,
2
)));
frozenset_cls
->
giveAttr
(
"__ge__"
,
set_cls
->
getattr
(
internStringMortal
(
"__ge__"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"__ge__"
,
set_cls
->
getattr
(
getStaticString
(
"__ge__"
)));
set_cls
->
giveAttr
(
"__gt__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setGt
,
BOXED_BOOL
,
2
)));
frozenset_cls
->
giveAttr
(
"__gt__"
,
set_cls
->
getattr
(
internStringMortal
(
"__gt__"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"__gt__"
,
set_cls
->
getattr
(
getStaticString
(
"__gt__"
)));
set_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setNonzero
,
BOXED_BOOL
,
1
)));
frozenset_cls
->
giveAttr
(
"__nonzero__"
,
set_cls
->
getattr
(
internStringMortal
(
"__nonzero__"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"__nonzero__"
,
set_cls
->
getattr
(
getStaticString
(
"__nonzero__"
)));
frozenset_cls
->
giveAttr
(
"__hash__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setHash
,
BOXED_INT
,
1
)));
set_cls
->
giveAttr
(
"__hash__"
,
None
);
set_cls
->
giveAttr
Borrowed
(
"__hash__"
,
None
);
set_cls
->
giveAttr
(
"add"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setAdd
,
NONE
,
2
)));
set_cls
->
giveAttr
(
"remove"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setRemove
,
NONE
,
2
)));
...
...
@@ -917,29 +916,29 @@ void setupSet() {
set_cls
->
giveAttr
(
"clear"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setClear
,
NONE
,
1
)));
set_cls
->
giveAttr
(
"update"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setUpdate
,
NONE
,
1
,
true
,
false
)));
set_cls
->
giveAttr
(
"union"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setUnion
,
UNKNOWN
,
1
,
true
,
false
)));
frozenset_cls
->
giveAttr
(
"union"
,
set_cls
->
getattr
(
internStringMortal
(
"union"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"union"
,
set_cls
->
getattr
(
getStaticString
(
"union"
)));
set_cls
->
giveAttr
(
"intersection"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setIntersection
,
UNKNOWN
,
1
,
true
,
false
)));
frozenset_cls
->
giveAttr
(
"intersection"
,
set_cls
->
getattr
(
internStringMortal
(
"intersection"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"intersection"
,
set_cls
->
getattr
(
getStaticString
(
"intersection"
)));
set_cls
->
giveAttr
(
"intersection_update"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setIntersectionUpdate
,
UNKNOWN
,
1
,
true
,
false
)));
set_cls
->
giveAttr
(
"difference"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setDifference
,
UNKNOWN
,
1
,
true
,
false
)));
frozenset_cls
->
giveAttr
(
"difference"
,
set_cls
->
getattr
(
internStringMortal
(
"difference"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"difference"
,
set_cls
->
getattr
(
getStaticString
(
"difference"
)));
set_cls
->
giveAttr
(
"difference_update"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setDifferenceUpdate
,
UNKNOWN
,
1
,
true
,
false
)));
set_cls
->
giveAttr
(
"symmetric_difference"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setSymmetricDifference
,
UNKNOWN
,
2
,
false
,
false
)));
frozenset_cls
->
giveAttr
(
"symmetric_difference"
,
set_cls
->
getattr
(
internStringMortal
(
"symmetric_difference"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"symmetric_difference"
,
set_cls
->
getattr
(
getStaticString
(
"symmetric_difference"
)));
set_cls
->
giveAttr
(
"symmetric_difference_update"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setSymmetricDifferenceUpdate
,
UNKNOWN
,
2
,
false
,
false
)));
set_cls
->
giveAttr
(
"issubset"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setIssubset
,
UNKNOWN
,
2
)));
frozenset_cls
->
giveAttr
(
"issubset"
,
set_cls
->
getattr
(
internStringMortal
(
"issubset"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"issubset"
,
set_cls
->
getattr
(
getStaticString
(
"issubset"
)));
set_cls
->
giveAttr
(
"issuperset"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setIssuperset
,
UNKNOWN
,
2
)));
frozenset_cls
->
giveAttr
(
"issuperset"
,
set_cls
->
getattr
(
internStringMortal
(
"issuperset"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"issuperset"
,
set_cls
->
getattr
(
getStaticString
(
"issuperset"
)));
set_cls
->
giveAttr
(
"isdisjoint"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setIsdisjoint
,
UNKNOWN
,
2
)));
frozenset_cls
->
giveAttr
(
"isdisjoint"
,
set_cls
->
getattr
(
internStringMortal
(
"isdisjoint"
)));
frozenset_cls
->
giveAttr
Borrowed
(
"isdisjoint"
,
set_cls
->
getattr
(
getStaticString
(
"isdisjoint"
)));
set_cls
->
giveAttr
(
"copy"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
setCopy
,
UNKNOWN
,
1
)));
frozenset_cls
->
giveAttr
(
"copy"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
frozensetCopy
,
UNKNOWN
,
1
)));
...
...
src/runtime/tuple.cpp
View file @
24d82a06
...
...
@@ -686,9 +686,10 @@ void setupTuple() {
tuple_cls
->
giveAttr
(
"__contains__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
tupleContains
,
BOXED_BOOL
,
2
)));
tuple_cls
->
giveAttr
(
"index"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
tupleIndex
,
BOXED_INT
,
4
,
false
,
false
),
{
boxInt
(
0
),
boxInt
(
std
::
numeric_limits
<
Py_ssize_t
>::
max
())
}));
tuple_cls
->
giveAttr
(
"index"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
tupleIndex
,
BOXED_INT
,
4
,
false
,
false
),
{
autoDecref
(
boxInt
(
0
)),
autoDecref
(
boxInt
(
std
::
numeric_limits
<
Py_ssize_t
>::
max
()))
}));
tuple_cls
->
giveAttr
(
"count"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
tupleCount
,
BOXED_INT
,
2
)));
tuple_cls
->
giveAttr
(
"__iter__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
tupleIter
,
...
...
src/runtime/types.cpp
View file @
24d82a06
...
...
@@ -3206,6 +3206,7 @@ extern "C" PyUnicodeObject* _PyUnicode_New(Py_ssize_t length) noexcept {
// Do a bunch of inlining + constant folding of this line of CPython's:
// unicode = PyObject_New(PyUnicodeObject, &PyUnicode_Type);
assert
(
PyUnicode_Type
.
tp_basicsize
==
sizeof
(
PyUnicodeObject
));
// use the compile-time constant
RELEASE_ASSERT
(
0
,
" track the ref, but keep the inlining?"
);
unicode
=
(
PyUnicodeObject
*
)
PyObject_MALLOC
(
sizeof
(
PyUnicodeObject
));
if
(
unicode
==
NULL
)
return
(
PyUnicodeObject
*
)
PyErr_NoMemory
();
...
...
@@ -3789,10 +3790,6 @@ void setupRuntime() {
setupClassobj
();
setupSuper
();
_PyUnicode_Init
();
setupDescr
();
setupTraceback
();
setupCode
();
setupFrame
();
// XXX
PyType_ClearCache
();
...
...
@@ -3813,6 +3810,11 @@ void setupRuntime() {
exit
(
0
);
// XXX
setupDescr
();
setupTraceback
();
setupCode
();
setupFrame
();
function_cls
->
giveAttr
(
"__dict__"
,
dict_descr
);
function_cls
->
giveAttr
(
"__name__"
,
new
(
pyston_getset_cls
)
BoxedGetsetDescriptor
(
funcName
,
funcSetName
,
NULL
));
function_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
functionRepr
,
STR
,
1
)));
...
...
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