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
e5a0e465
Commit
e5a0e465
authored
Jan 08, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A couple fixes and things seem to be working ok
parent
39dbe4fd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
12 deletions
+23
-12
src/capi/typeobject.cpp
src/capi/typeobject.cpp
+18
-11
src/capi/typeobject.h
src/capi/typeobject.h
+1
-0
src/runtime/capi.cpp
src/runtime/capi.cpp
+2
-1
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+2
-0
No files found.
src/capi/typeobject.cpp
View file @
e5a0e465
...
...
@@ -1536,6 +1536,23 @@ static void inherit_slots(PyTypeObject* type, PyTypeObject* base) {
}
}
// PystonType_Ready is for the common code between PyType_Ready (which is just for extension classes)
// and our internal type-creation endpoints (BoxedClass::BoxedClass()).
// TODO: Move more of the duplicated logic into here.
void
PystonType_Ready
(
BoxedClass
*
cls
)
{
inherit_special
(
cls
,
cls
->
tp_base
);
// This is supposed to be over the MRO but we don't support multiple inheritance yet:
BoxedClass
*
b
=
cls
->
tp_base
;
while
(
b
)
{
// Not sure when this could fail; maybe not in Pyston right now but apparently it can in CPython:
if
(
PyType_Check
(
b
))
inherit_slots
(
cls
,
b
);
b
=
b
->
tp_base
;
}
}
extern
"C"
int
PyType_Ready
(
PyTypeObject
*
cls
)
{
gc
::
registerNonheapRootObject
(
cls
);
...
...
@@ -1642,17 +1659,7 @@ extern "C" int PyType_Ready(PyTypeObject* cls) {
printf
(
"warning: ignoring tp_getset for now
\n
"
);
}
inherit_special
(
cls
,
cls
->
tp_base
);
// This is supposed to be over the MRO but we don't support multiple inheritance yet:
BoxedClass
*
b
=
base
;
while
(
b
)
{
// Not sure when this could fail; maybe not in Pyston right now but apparently it can in CPython:
if
(
PyType_Check
(
b
))
inherit_slots
(
cls
,
b
);
b
=
b
->
tp_base
;
}
PystonType_Ready
(
cls
);
cls
->
gc_visit
=
&
conservativeGCHandler
;
cls
->
is_user_defined
=
true
;
...
...
src/capi/typeobject.h
View file @
e5a0e465
...
...
@@ -23,6 +23,7 @@ namespace pyston {
bool
update_slot
(
BoxedClass
*
self
,
const
std
::
string
&
attr
);
void
fixup_slot_dispatchers
(
BoxedClass
*
self
);
void
PystonType_Ready
(
BoxedClass
*
cls
);
}
#endif
src/runtime/capi.cpp
View file @
e5a0e465
...
...
@@ -801,7 +801,8 @@ extern "C" int PyExceptionInstance_Check(PyObject* o) {
}
extern
"C"
const
char
*
PyExceptionClass_Name
(
PyObject
*
o
)
{
return
PyClass_Check
(
o
)
?
PyString_AS_STRING
(
static_cast
<
BoxedClassobj
*>
(
o
)
->
name
)
:
o
->
cls
->
tp_name
;
return
PyClass_Check
(
o
)
?
PyString_AS_STRING
(
static_cast
<
BoxedClassobj
*>
(
o
)
->
name
)
:
static_cast
<
BoxedClass
*>
(
o
)
->
tp_name
;
}
extern
"C"
PyObject
*
PyExceptionInstance_Class
(
PyObject
*
o
)
{
...
...
src/runtime/objmodel.cpp
View file @
e5a0e465
...
...
@@ -3334,6 +3334,8 @@ Box* typeNew(Box* _cls, Box* arg1, Box* arg2, Box** _args) {
// TODO should this function (typeNew) call PyType_Ready?
made
->
tp_new
=
base
->
tp_new
;
made
->
tp_alloc
=
reinterpret_cast
<
decltype
(
cls
->
tp_alloc
)
>
(
PyType_GenericAlloc
);
PystonType_Ready
(
made
);
fixup_slot_dispatchers
(
made
);
return
made
;
...
...
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