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
e66e20a3
Commit
e66e20a3
authored
Dec 16, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Old style .__dict__ and .__class__
parent
e80012b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
src/runtime/classobj.cpp
src/runtime/classobj.cpp
+7
-0
test/tests/oldstyle_classes.py
test/tests/oldstyle_classes.py
+2
-0
No files found.
src/runtime/classobj.cpp
View file @
e66e20a3
...
...
@@ -142,6 +142,13 @@ static Box* _instanceGetattribute(Box* _inst, Box* _attr, bool raise_on_missing)
BoxedString
*
attr
=
static_cast
<
BoxedString
*>
(
_attr
);
// TODO: special handling for accessing __dict__ and __class__
if
(
attr
->
s
[
0
]
==
'_'
&&
attr
->
s
[
1
]
==
'_'
)
{
if
(
attr
->
s
==
"__dict__"
)
return
makeAttrWrapper
(
inst
);
if
(
attr
->
s
==
"__class__"
)
return
inst
->
inst_cls
;
}
Box
*
r
=
inst
->
getattr
(
attr
->
s
);
if
(
r
)
...
...
test/tests/oldstyle_classes.py
View file @
e66e20a3
...
...
@@ -121,3 +121,5 @@ g = GetattrTest()
g
.
b
=
2
print
g
.
a
print
g
.
b
print
g
.
__class__
print
g
.
__dict__
.
items
()
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