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
64bc9769
Commit
64bc9769
authored
May 20, 2016
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add __name__ attr to method-wrapper
parent
eb3e468e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
src/runtime/types.cpp
src/runtime/types.cpp
+8
-0
test/tests/wrapperdesc.py
test/tests/wrapperdesc.py
+1
-0
No files found.
src/runtime/types.cpp
View file @
64bc9769
...
...
@@ -1595,6 +1595,12 @@ static Box* builtinFunctionOrMethodName(Box* b, void*) {
return
incref
(
func
->
name
);
}
static
Box
*
wrapperobjectName
(
Box
*
w
,
void
*
)
{
assert
(
w
->
cls
==
wrapperobject_cls
);
BoxedWrapperObject
*
wrapper_obj
=
static_cast
<
BoxedWrapperObject
*>
(
w
);
return
boxString
(
wrapper_obj
->
descr
->
wrapper
->
name
);
}
static
Box
*
functionCode
(
Box
*
self
,
void
*
)
{
assert
(
self
->
cls
==
function_cls
);
BoxedFunction
*
func
=
static_cast
<
BoxedFunction
*>
(
self
);
...
...
@@ -4531,6 +4537,8 @@ void setupRuntime() {
instancemethod_cls
->
giveAttr
(
"im_class"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedInstanceMethod
,
im_class
),
true
));
wrapperobject_cls
->
giveAttrDescriptor
(
"__name__"
,
wrapperobjectName
,
NULL
);
slice_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
sliceNew
,
UNKNOWN
,
4
,
false
,
false
),
{
NULL
,
None
}));
...
...
test/tests/wrapperdesc.py
View file @
64bc9769
...
...
@@ -5,4 +5,5 @@ print type(C).__str__ is object.__str__
print
type
(
None
).
__str__
is
object
.
__str__
print
type
(
None
).
__str__
is
None
.
__str__
print
type
(
None
.
__str__
)
print
(
None
.
__str__
.
__name__
)
print
type
(
type
(
None
).
__str__
.
__get__
(
None
,
type
(
None
)))
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