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
ec8adc6f
Commit
ec8adc6f
authored
Feb 29, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More ref fixes
parent
abaede1e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
6 deletions
+17
-6
src/capi/typeobject.cpp
src/capi/typeobject.cpp
+1
-0
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+1
-1
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+11
-4
src/runtime/dict.cpp
src/runtime/dict.cpp
+4
-1
No files found.
src/capi/typeobject.cpp
View file @
ec8adc6f
...
...
@@ -3372,6 +3372,7 @@ static Box* tppProxyToTpCall(Box* self, CallRewriteArgs* rewrite_args, ArgPassSp
rewrite_args
->
out_rtn
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
self
->
cls
->
tp_call
,
rewrite_args
->
obj
,
rewrite_args
->
arg1
,
rewrite_args
->
arg2
);
rewrite_args
->
out_rtn
->
setType
(
RefType
::
OWNED
);
if
(
S
==
CXX
)
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
out_success
=
true
;
...
...
src/codegen/ast_interpreter.cpp
View file @
ec8adc6f
...
...
@@ -236,7 +236,6 @@ void ASTInterpreter::setFrameInfo(const FrameInfo* frame_info) {
}
void
ASTInterpreter
::
setGlobals
(
Box
*
globals
)
{
assert
(
0
&&
"Check refcounting (of callers)"
);
assert
(
!
this
->
frame_info
.
globals
);
this
->
frame_info
.
globals
=
incref
(
globals
);
}
...
...
@@ -892,6 +891,7 @@ Value ASTInterpreter::visit_langPrimitive(AST_LangPrimitive* node) {
int
level
=
static_cast
<
AST_Num
*>
(
node
->
args
[
0
])
->
n_int
;
Value
froms
=
visit_expr
(
node
->
args
[
1
]);
AUTO_DECREF
(
froms
.
o
);
auto
ast_str
=
ast_cast
<
AST_Str
>
(
node
->
args
[
2
]);
assert
(
ast_str
->
str_type
==
AST_Str
::
STR
);
const
std
::
string
&
module_name
=
ast_str
->
str_data
;
...
...
src/runtime/builtin_modules/builtins.cpp
View file @
ec8adc6f
...
...
@@ -493,7 +493,7 @@ Box* delattrFunc(Box* obj, Box* _str) {
return
None
;
}
static
Box
*
getattrFuncHelper
(
Box
*
return_val
,
Box
*
obj
,
BoxedString
*
str
,
Box
*
default_val
)
noexcept
{
static
Box
*
getattrFuncHelper
(
STOLEN
(
Box
*
)
return_val
,
Box
*
obj
,
BoxedString
*
str
,
Box
*
default_val
)
noexcept
{
assert
(
PyString_Check
(
str
));
if
(
return_val
)
...
...
@@ -506,7 +506,7 @@ static Box* getattrFuncHelper(Box* return_val, Box* obj, BoxedString* str, Box*
if
(
default_val
)
{
if
(
exc
)
PyErr_Clear
();
return
default_val
;
return
incref
(
default_val
)
;
}
if
(
!
exc
)
raiseAttributeErrorCapi
(
obj
,
str
->
s
());
...
...
@@ -527,6 +527,10 @@ Box* getattrFuncInternal(BoxedFunctionBase* func, CallRewriteArgs* rewrite_args,
Box
*
_str
=
arg2
;
Box
*
default_value
=
arg3
;
AUTO_DECREF
(
obj
);
AUTO_DECREF
(
_str
);
AUTO_XDECREF
(
default_value
);
if
(
rewrite_args
)
{
// We need to make sure that the attribute string will be the same.
// Even though the passed string might not be the exact attribute name
...
...
@@ -549,6 +553,7 @@ Box* getattrFuncInternal(BoxedFunctionBase* func, CallRewriteArgs* rewrite_args,
_str
=
coerceUnicodeToStr
<
S
>
(
_str
);
if
(
S
==
CAPI
&&
!
_str
)
return
NULL
;
AUTO_DECREF
(
_str
);
if
(
!
PyString_Check
(
_str
))
{
if
(
S
==
CAPI
)
{
...
...
@@ -594,8 +599,10 @@ Box* getattrFuncInternal(BoxedFunctionBase* func, CallRewriteArgs* rewrite_args,
if
(
rewrite_args
)
{
assert
(
PyString_CHECK_INTERNED
(
str
)
==
SSTATE_INTERNED_IMMORTAL
);
RewriterVar
*
r_str
=
rewrite_args
->
rewriter
->
loadConst
((
intptr_t
)
str
,
Location
::
forArg
(
2
));
RewriterVar
*
final_rtn
=
rewrite_args
->
rewriter
->
call
(
false
,
(
void
*
)
getattrFuncHelper
,
r_rtn
,
rewrite_args
->
arg1
,
r_str
,
rewrite_args
->
arg3
);
RewriterVar
*
final_rtn
=
rewrite_args
->
rewriter
->
call
(
false
,
(
void
*
)
getattrFuncHelper
,
r_rtn
,
rewrite_args
->
arg1
,
r_str
,
rewrite_args
->
arg3
)
->
setType
(
RefType
::
OWNED
);
r_rtn
->
refConsumed
();
if
(
S
==
CXX
)
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
final_rtn
);
...
...
src/runtime/dict.cpp
View file @
ec8adc6f
...
...
@@ -82,7 +82,10 @@ Box* dictCopy(BoxedDict* self) {
raiseExcHelper
(
TypeError
,
"descriptor 'copy' requires a 'dict' object but received a '%s'"
,
getTypeName
(
self
));
BoxedDict
*
r
=
new
BoxedDict
();
assert
(
0
&&
"check refcounting"
);
for
(
auto
&&
p
:
self
->
d
)
{
Py_INCREF
(
p
.
first
.
value
);
Py_INCREF
(
p
.
second
);
}
r
->
d
=
self
->
d
;
return
r
;
}
...
...
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