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
b6df2364
Commit
b6df2364
authored
Nov 12, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working through pytype_ready
parent
ead008eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
src/capi/typeobject.cpp
src/capi/typeobject.cpp
+3
-1
src/runtime/types.cpp
src/runtime/types.cpp
+10
-0
src/runtime/types.h
src/runtime/types.h
+2
-0
No files found.
src/capi/typeobject.cpp
View file @
b6df2364
...
@@ -3408,6 +3408,8 @@ extern "C" int PyType_Ready(PyTypeObject* cls) noexcept {
...
@@ -3408,6 +3408,8 @@ extern "C" int PyType_Ready(PyTypeObject* cls) noexcept {
ASSERT
(
!
cls
->
is_pyston_class
,
"should not call this on Pyston classes"
);
ASSERT
(
!
cls
->
is_pyston_class
,
"should not call this on Pyston classes"
);
gc
::
registerNonheapRootObject
(
cls
,
sizeof
(
PyTypeObject
));
gc
::
registerNonheapRootObject
(
cls
,
sizeof
(
PyTypeObject
));
classes
.
push_back
(
cls
);
_Py_INC_REFTOTAL
;
// unhandled fields:
// unhandled fields:
int
ALLOWABLE_FLAGS
=
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_BASETYPE
|
Py_TPFLAGS_HAVE_GC
|
Py_TPFLAGS_CHECKTYPES
int
ALLOWABLE_FLAGS
=
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_BASETYPE
|
Py_TPFLAGS_HAVE_GC
|
Py_TPFLAGS_CHECKTYPES
...
@@ -3440,7 +3442,7 @@ extern "C" int PyType_Ready(PyTypeObject* cls) noexcept {
...
@@ -3440,7 +3442,7 @@ extern "C" int PyType_Ready(PyTypeObject* cls) noexcept {
base
=
cls
->
tp_base
=
object_cls
;
base
=
cls
->
tp_base
=
object_cls
;
if
(
!
cls
->
cls
)
if
(
!
cls
->
cls
)
cls
->
cls
=
cls
->
tp_base
->
cls
;
cls
->
cls
=
cls
->
tp_base
->
cls
;
cls
->
giveAttr
(
"__base__"
,
base
);
cls
->
giveAttr
Borrowed
(
"__base__"
,
base
);
assert
(
cls
->
tp_dict
==
NULL
);
assert
(
cls
->
tp_dict
==
NULL
);
cls
->
tp_dict
=
cls
->
getAttrWrapper
();
cls
->
tp_dict
=
cls
->
getAttrWrapper
();
...
...
src/runtime/types.cpp
View file @
b6df2364
...
@@ -3678,6 +3678,15 @@ void BoxedModule::dealloc(Box* b) noexcept {
...
@@ -3678,6 +3678,15 @@ void BoxedModule::dealloc(Box* b) noexcept {
self
->
clearAttrs
();
self
->
clearAttrs
();
}
}
void
BoxedClass
::
dealloc
(
Box
*
b
)
noexcept
{
BoxedClass
*
self
=
static_cast
<
BoxedClass
*>
(
b
);
self
->
clearAttrs
();
Py_XDECREF
(
self
->
tp_dict
);
// XXX: need to import cpython's type_dealloc
}
#ifndef Py_REF_DEBUG
#ifndef Py_REF_DEBUG
#define PRINT_TOTAL_REFS()
#define PRINT_TOTAL_REFS()
...
@@ -3707,6 +3716,7 @@ void setupRuntime() {
...
@@ -3707,6 +3716,7 @@ void setupRuntime() {
type_cls
->
has_safe_tp_dealloc
=
false
;
type_cls
->
has_safe_tp_dealloc
=
false
;
type_cls
->
tp_flags
|=
Py_TPFLAGS_TYPE_SUBCLASS
;
type_cls
->
tp_flags
|=
Py_TPFLAGS_TYPE_SUBCLASS
;
type_cls
->
tp_itemsize
=
sizeof
(
BoxedHeapClass
::
SlotOffset
);
type_cls
->
tp_itemsize
=
sizeof
(
BoxedHeapClass
::
SlotOffset
);
type_cls
->
tp_dealloc
=
BoxedClass
::
dealloc
;
PyObject_Init
(
object_cls
,
type_cls
);
PyObject_Init
(
object_cls
,
type_cls
);
PyObject_Init
(
type_cls
,
type_cls
);
PyObject_Init
(
type_cls
,
type_cls
);
// XXX silly that we have to set this again
// XXX silly that we have to set this again
...
...
src/runtime/types.h
View file @
b6df2364
...
@@ -293,6 +293,8 @@ public:
...
@@ -293,6 +293,8 @@ public:
DEFAULT_CLASS_VAR
(
type_cls
,
sizeof
(
SlotOffset
));
DEFAULT_CLASS_VAR
(
type_cls
,
sizeof
(
SlotOffset
));
static
void
dealloc
(
Box
*
self
)
noexcept
;
protected:
protected:
// These functions are not meant for external callers and will mostly just be called
// These functions are not meant for external callers and will mostly just be called
// by BoxedHeapClass::create(), but setupRuntime() also needs to do some manual class
// by BoxedHeapClass::create(), but setupRuntime() also needs to do some manual class
...
...
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