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
0682ccb0
Commit
0682ccb0
authored
Mar 03, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More fixes
parent
8e87df72
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
26 deletions
+20
-26
src/codegen/irgen/hooks.cpp
src/codegen/irgen/hooks.cpp
+1
-1
src/runtime/classobj.cpp
src/runtime/classobj.cpp
+4
-8
src/runtime/code.cpp
src/runtime/code.cpp
+0
-4
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+4
-3
src/runtime/types.cpp
src/runtime/types.cpp
+11
-8
src/runtime/types.h
src/runtime/types.h
+0
-2
No files found.
src/codegen/irgen/hooks.cpp
View file @
0682ccb0
...
...
@@ -429,7 +429,7 @@ extern "C" PyCodeObject* PyAST_Compile(struct _mod* _mod, const char* filename,
return
NULL
;
}
return
(
PyCodeObject
*
)
md
->
getCode
(
);
return
(
PyCodeObject
*
)
incref
(
md
->
getCode
()
);
}
catch
(
ExcInfo
e
)
{
setCAPIException
(
e
);
return
NULL
;
...
...
src/runtime/classobj.cpp
View file @
0682ccb0
...
...
@@ -534,6 +534,8 @@ void instanceSetattroInternal(Box* _inst, Box* _attr, STOLEN(Box*) value, Setatt
}
}
AUTO_DECREF
(
value
);
static
BoxedString
*
setattr_str
=
getStaticString
(
"__setattr__"
);
if
(
rewrite_args
)
{
...
...
@@ -572,10 +574,6 @@ void instanceSetattroInternal(Box* _inst, Box* _attr, STOLEN(Box*) value, Setatt
}
}
void
instanceSetattr
(
Box
*
_inst
,
Box
*
_attr
,
Box
*
value
)
{
instanceSetattroInternal
(
_inst
,
_attr
,
value
,
NULL
);
}
Box
*
instanceDelattr
(
Box
*
_inst
,
Box
*
_attr
)
{
RELEASE_ASSERT
(
_inst
->
cls
==
instance_cls
,
""
);
BoxedInstance
*
inst
=
static_cast
<
BoxedInstance
*>
(
_inst
);
...
...
@@ -611,10 +609,10 @@ Box* instanceDelattr(Box* _inst, Box* _attr) {
return
None
;
}
int
instance_setattro
(
Box
*
cls
,
Box
*
attr
,
Box
*
value
)
noexcept
{
int
instance_setattro
(
Box
*
inst
,
Box
*
attr
,
Box
*
value
)
noexcept
{
try
{
if
(
value
)
{
instanceSetattr
(
cls
,
attr
,
value
);
instanceSetattr
oInternal
(
inst
,
attr
,
value
,
NULL
);
return
0
;
}
else
{
RELEASE_ASSERT
(
0
,
""
);
...
...
@@ -1833,8 +1831,6 @@ void setupClassobj() {
instance_cls
->
giveAttr
(
"__getattribute__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
(
(
void
*
)
instanceGetattroInternal
<
CXX
>
,
UNKNOWN
,
2
)));
instance_cls
->
giveAttr
(
"__setattr__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
instanceSetattr
,
UNKNOWN
,
3
)));
instance_cls
->
giveAttr
(
"__delattr__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
instanceDelattr
,
UNKNOWN
,
2
)));
instance_cls
->
giveAttr
(
"__str__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
instanceStr
,
UNKNOWN
,
1
)));
...
...
src/runtime/code.cpp
View file @
0682ccb0
...
...
@@ -91,10 +91,6 @@ Box* BoxedCode::flags(Box* b, void*) {
return
boxInt
(
flags
);
}
Box
*
codeForFunction
(
BoxedFunction
*
f
)
{
return
f
->
md
->
getCode
();
}
FunctionMetadata
*
metadataFromCode
(
Box
*
code
)
{
assert
(
code
->
cls
==
code_cls
);
return
static_cast
<
BoxedCode
*>
(
code
)
->
f
;
...
...
src/runtime/objmodel.cpp
View file @
0682ccb0
...
...
@@ -2379,9 +2379,10 @@ Box* getattrInternalGeneric(Box* obj, BoxedString* attr, GetattrRewriteArgs* rew
throwCAPIException
();
if
(
rewrite_args
)
{
RewriterVar
*
r_rtn
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
local_get
,
r_val
,
rewrite_args
->
rewriter
->
loadConst
(
0
,
Location
::
forArg
(
1
)),
rewrite_args
->
obj
);
RewriterVar
*
r_rtn
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
local_get
,
r_val
,
rewrite_args
->
rewriter
->
loadConst
(
0
,
Location
::
forArg
(
1
)),
rewrite_args
->
obj
)
->
setType
(
RefType
::
OWNED
);
// rewrite_args->rewriter->checkAndThrowCAPIException(rewrite_args->out_rtn);
rewrite_args
->
setReturn
(
r_rtn
,
ReturnConvention
::
CAPI_RETURN
);
}
...
...
src/runtime/types.cpp
View file @
0682ccb0
...
...
@@ -1536,7 +1536,7 @@ static void funcSetName(Box* b, Box* v, void*) {
raiseExcHelper
(
TypeError
,
"__name__ must be set to a string object"
);
}
func
->
name
=
static_cast
<
BoxedString
*>
(
v
);
func
->
name
=
incref
(
static_cast
<
BoxedString
*>
(
v
)
);
}
static
Box
*
builtinFunctionOrMethodName
(
Box
*
b
,
void
*
)
{
...
...
@@ -1548,13 +1548,13 @@ static Box* builtinFunctionOrMethodName(Box* b, void*) {
assert
(
b
->
cls
==
builtin_function_or_method_cls
);
BoxedBuiltinFunctionOrMethod
*
func
=
static_cast
<
BoxedBuiltinFunctionOrMethod
*>
(
b
);
assert
(
func
->
name
);
return
func
->
name
;
return
incref
(
func
->
name
)
;
}
static
Box
*
functionCode
(
Box
*
self
,
void
*
)
{
assert
(
self
->
cls
==
function_cls
);
BoxedFunction
*
func
=
static_cast
<
BoxedFunction
*>
(
self
);
return
codeForFunction
(
func
);
return
incref
(
func
->
md
->
getCode
()
);
}
extern
"C"
PyObject
*
PyFunction_GetCode
(
PyObject
*
func
)
noexcept
{
...
...
@@ -1689,11 +1689,11 @@ Box* instancemethodGet(BoxedInstanceMethod* self, Box* obj, Box* type) {
RELEASE_ASSERT
(
self
->
cls
==
instancemethod_cls
,
""
);
if
(
self
->
obj
!=
NULL
)
{
return
self
;
return
incref
(
self
)
;
}
if
(
!
PyObject_IsSubclass
(
type
,
self
->
im_class
))
{
return
self
;
return
incref
(
self
)
;
}
if
(
obj
==
None
)
...
...
@@ -1731,6 +1731,7 @@ static Box* instancemethodRepr(Box* b) {
static
BoxedString
*
name_str
=
getStaticString
(
"__name__"
);
funcname
=
getattrInternal
<
CXX
>
(
func
,
name_str
);
AUTO_XDECREF
(
funcname
);
if
(
funcname
!=
NULL
)
{
if
(
!
PyString_Check
(
funcname
))
{
...
...
@@ -1751,12 +1752,14 @@ static Box* instancemethodRepr(Box* b) {
}
}
}
AUTO_XDECREF
(
klassname
);
if
(
self
==
NULL
)
result
=
PyString_FromFormat
(
"<unbound method %s.%s>"
,
sklassname
,
sfuncname
);
else
{
// This was a CPython comment: /* XXX Shouldn't use repr() here! */
Box
*
selfrepr
=
repr
(
self
);
AUTO_DECREF
(
selfrepr
);
assert
(
PyString_Check
(
selfrepr
));
result
=
PyString_FromFormat
(
"<bound method %s.%s of %s>"
,
sklassname
,
sfuncname
,
PyString_AS_STRING
(
selfrepr
));
}
...
...
@@ -3354,7 +3357,7 @@ void dealloc_null(Box* box) {
static
Box
*
getsetGet
(
Box
*
self
,
Box
*
obj
,
Box
*
type
)
{
// TODO: should call the full descr_check instead
if
(
obj
==
NULL
||
obj
==
None
)
return
self
;
return
incref
(
self
)
;
BoxedGetsetDescriptor
*
getset_descr
=
static_cast
<
BoxedGetsetDescriptor
*>
(
self
);
...
...
@@ -3383,12 +3386,12 @@ static Box* getsetSet(Box* self, Box* obj, Box* val) {
if
(
isSubclass
(
self
->
cls
,
pyston_getset_cls
))
{
getset_descr
->
set
(
obj
,
val
,
getset_descr
->
closure
);
return
None
;
return
incref
(
None
)
;
}
else
{
RELEASE_ASSERT
(
isSubclass
(
self
->
cls
,
capi_getset_cls
),
""
);
getset_descr
->
set
(
obj
,
val
,
getset_descr
->
closure
);
checkAndThrowCAPIException
();
return
None
;
return
incref
(
None
)
;
}
}
...
...
src/runtime/types.h
View file @
0682ccb0
...
...
@@ -1261,8 +1261,6 @@ AST* unboxAst(Box* b);
// are supposed to add one themselves. type_cls and function_cls do this, for example.
extern
Box
*
dict_descr
;
Box
*
codeForFunction
(
BoxedFunction
*
);
Box
*
codeForFunctionMetadata
(
FunctionMetadata
*
);
FunctionMetadata
*
metadataFromCode
(
Box
*
code
);
Box
*
getFrame
(
FrameInfo
*
frame_info
);
...
...
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