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
a0f0cb72
Commit
a0f0cb72
authored
May 02, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1152 from kmod/refcounting
Fix another raise-before-stealing-argument bug
parents
9e7817ed
5deae4d4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
src/runtime/dict.cpp
src/runtime/dict.cpp
+11
-0
src/runtime/types.h
src/runtime/types.h
+1
-0
No files found.
src/runtime/dict.cpp
View file @
a0f0cb72
...
@@ -48,6 +48,17 @@ static void _dictSetStolen(BoxedDict* self, BoxAndHash k, STOLEN(Box*) v) {
...
@@ -48,6 +48,17 @@ static void _dictSetStolen(BoxedDict* self, BoxAndHash k, STOLEN(Box*) v) {
}
}
}
}
static
void
_dictSetStolen
(
BoxedDict
*
self
,
Box
*
k
,
STOLEN
(
Box
*
)
v
)
{
BoxAndHash
hashed_key
;
try
{
hashed_key
=
BoxAndHash
(
k
);
}
catch
(
ExcInfo
e
)
{
Py_DECREF
(
v
);
throw
e
;
}
return
_dictSetStolen
(
self
,
hashed_key
,
v
);
}
static
void
_dictSet
(
BoxedDict
*
self
,
BoxAndHash
k
,
Box
*
v
)
{
static
void
_dictSet
(
BoxedDict
*
self
,
BoxAndHash
k
,
Box
*
v
)
{
_dictSetStolen
(
self
,
k
,
incref
(
v
));
_dictSetStolen
(
self
,
k
,
incref
(
v
));
}
}
...
...
src/runtime/types.h
View file @
a0f0cb72
...
@@ -920,6 +920,7 @@ struct BoxAndHash {
...
@@ -920,6 +920,7 @@ struct BoxAndHash {
Box
*
value
;
Box
*
value
;
size_t
hash
;
size_t
hash
;
BoxAndHash
()
{}
BoxAndHash
(
Box
*
value
)
:
value
(
value
),
hash
(
PyHasher
()(
value
))
{}
BoxAndHash
(
Box
*
value
)
:
value
(
value
),
hash
(
PyHasher
()(
value
))
{}
BoxAndHash
(
Box
*
value
,
size_t
hash
)
:
value
(
value
),
hash
(
hash
)
{}
BoxAndHash
(
Box
*
value
,
size_t
hash
)
:
value
(
value
),
hash
(
hash
)
{}
...
...
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