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
406c1885
Commit
406c1885
authored
Jun 19, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch super to tp_getattro
parent
a80e0725
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
Makefile
Makefile
+1
-1
src/capi/typeobject.cpp
src/capi/typeobject.cpp
+3
-0
src/runtime/super.cpp
src/runtime/super.cpp
+11
-1
No files found.
Makefile
View file @
406c1885
...
@@ -1022,7 +1022,7 @@ $(call make_target,_gcc)
...
@@ -1022,7 +1022,7 @@ $(call make_target,_gcc)
nosearch_runpy_% nosearch_pyrun_%
:
%.py ext_python
nosearch_runpy_% nosearch_pyrun_%
:
%.py ext_python
$(VERB)
PYTHONPATH
=
test
/test_extension/build/lib.linux-x86_64-2.7 zsh
-c
'time python $<'
$(VERB)
PYTHONPATH
=
test
/test_extension/build/lib.linux-x86_64-2.7 zsh
-c
'time python $<'
nosearch_pypyrun_%
:
%.py ext_python
nosearch_pypyrun_%
:
%.py ext_python
$(VERB)
PYTHONPATH
=
test
/test_extension/build/lib.linux-x86_64-2.7 zsh
-c
'time py
thon
$<'
$(VERB)
PYTHONPATH
=
test
/test_extension/build/lib.linux-x86_64-2.7 zsh
-c
'time py
py
$<'
$(call
make_search,runpy_%)
$(call
make_search,runpy_%)
$(call
make_search,pyrun_%)
$(call
make_search,pyrun_%)
$(call
make_search,pypyrun_%)
$(call
make_search,pypyrun_%)
...
...
src/capi/typeobject.cpp
View file @
406c1885
...
@@ -856,6 +856,9 @@ static PyObject* slot_tp_tpp_descr_get(PyObject* self, PyObject* obj, PyObject*
...
@@ -856,6 +856,9 @@ static PyObject* slot_tp_tpp_descr_get(PyObject* self, PyObject* obj, PyObject*
}
}
static
PyObject
*
slot_tp_getattro
(
PyObject
*
self
,
PyObject
*
name
)
noexcept
{
static
PyObject
*
slot_tp_getattro
(
PyObject
*
self
,
PyObject
*
name
)
noexcept
{
static
StatCounter
slowpath_tp_getattro
(
"slowpath_tp_getattro"
);
slowpath_tp_getattro
.
log
();
static
PyObject
*
getattribute_str
=
NULL
;
static
PyObject
*
getattribute_str
=
NULL
;
return
call_method
(
self
,
"__getattribute__"
,
&
getattribute_str
,
"(O)"
,
name
);
return
call_method
(
self
,
"__getattribute__"
,
&
getattribute_str
,
"(O)"
,
name
);
}
}
...
...
src/runtime/super.cpp
View file @
406c1885
...
@@ -134,6 +134,15 @@ Box* superGetattribute(Box* _s, Box* _attr) {
...
@@ -134,6 +134,15 @@ Box* superGetattribute(Box* _s, Box* _attr) {
return
processDescriptor
(
r
,
s
,
s
->
cls
);
return
processDescriptor
(
r
,
s
,
s
->
cls
);
}
}
Box
*
super_getattro
(
Box
*
_s
,
Box
*
_attr
)
noexcept
{
try
{
return
superGetattribute
(
_s
,
_attr
);
}
catch
(
ExcInfo
e
)
{
setCAPIException
(
e
);
return
NULL
;
}
}
Box
*
superRepr
(
Box
*
_s
)
{
Box
*
superRepr
(
Box
*
_s
)
{
RELEASE_ASSERT
(
_s
->
cls
==
super_cls
,
""
);
RELEASE_ASSERT
(
_s
->
cls
==
super_cls
,
""
);
BoxedSuper
*
s
=
static_cast
<
BoxedSuper
*>
(
_s
);
BoxedSuper
*
s
=
static_cast
<
BoxedSuper
*>
(
_s
);
...
@@ -191,7 +200,7 @@ void setupSuper() {
...
@@ -191,7 +200,7 @@ void setupSuper() {
super_cls
=
BoxedHeapClass
::
create
(
type_cls
,
object_cls
,
&
BoxedSuper
::
gcHandler
,
0
,
0
,
sizeof
(
BoxedSuper
),
false
,
super_cls
=
BoxedHeapClass
::
create
(
type_cls
,
object_cls
,
&
BoxedSuper
::
gcHandler
,
0
,
0
,
sizeof
(
BoxedSuper
),
false
,
"super"
);
"super"
);
super_cls
->
giveAttr
(
"__getattribute__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
superGetattribute
,
UNKNOWN
,
2
)));
//
super_cls->giveAttr("__getattribute__", new BoxedFunction(boxRTFunction((void*)superGetattribute, UNKNOWN, 2)));
super_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
superRepr
,
STR
,
1
)));
super_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
superRepr
,
STR
,
1
)));
super_cls
->
giveAttr
(
"__init__"
,
super_cls
->
giveAttr
(
"__init__"
,
...
@@ -205,5 +214,6 @@ void setupSuper() {
...
@@ -205,5 +214,6 @@ void setupSuper() {
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedSuper
,
obj_type
)));
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedSuper
,
obj_type
)));
super_cls
->
freeze
();
super_cls
->
freeze
();
super_cls
->
tp_getattro
=
super_getattro
;
}
}
}
}
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