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
5e0bfd08
Commit
5e0bfd08
authored
Apr 28, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Went down the rabit hole again that is descriptors especially on 'type'
parent
e734cdb7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
5 deletions
+37
-5
test/tests/69.py
test/tests/69.py
+1
-5
test/tests/cls_attr_inheritance.py
test/tests/cls_attr_inheritance.py
+16
-0
test/tests/descriptors.py
test/tests/descriptors.py
+20
-0
No files found.
test/tests/69.py
View file @
5e0bfd08
# expected: fail
# expected: fail
# - I'm not sure how this is supposed to work
# - type.__name__ is a descriptor
# I guess the __name__ attribute on classes is weird?
class
C
(
object
):
class
C
(
object
):
pass
pass
print
C
.
__name__
print
C
.
__name__
print
C
.
__module__
print
C
.
__module__
# print C.__dict__.keys() # __name__ doesn't appear!
# print dir(C) # __name__ doesn't appear!
c
=
C
()
c
=
C
()
print
c
.
__name__
# this should err
print
c
.
__name__
# this should err
test/tests/cls_attr_inheritance.py
0 → 100644
View file @
5e0bfd08
# expected: fail
# - inheritance not implemented
class
C
(
object
):
x
=
1
class
D
(
C
):
pass
d
=
D
()
# When going from an instance, looking through the classes should look at base classes:
print
d
.
x
# But also when doing instance-level lookups!
print
D
.
x
print
D
.
__dict__
test/tests/descriptors.py
0 → 100644
View file @
5e0bfd08
# expected: fail
# - descriptors not implemented yet
class
D
(
object
):
def
__get__
(
self
,
instance
,
owner
):
print
"get"
,
instance
,
owner
return
1
def
__set__
(
self
,
instance
,
value
):
print
"set"
,
instance
,
value
class
C
(
object
):
d
=
D
()
print
C
.
d
print
C
().
d
c
=
C
()
c
.
d
=
2
print
c
.
d
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