Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Kirill Smelkov
cpython
Commits
c6249a62
Commit
c6249a62
authored
May 02, 2015
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Defer deleted item decref until after the deque is restored to a consistent state.
parent
1dd8e71e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
Misc/NEWS
Misc/NEWS
+4
-0
Modules/_collectionsmodule.c
Modules/_collectionsmodule.c
+6
-6
No files found.
Misc/NEWS
View file @
c6249a62
...
...
@@ -45,6 +45,10 @@ Library
- Issues #24099, #24100, and #24101: Fix free-after-use bug in heapq'
s
siftup
and
siftdown
functions
.
-
Backport
collections
.
deque
fixes
from
Python
3.5
.
Prevents
reentrant
badness
during
deletion
by
deferring
the
decref
until
the
container
has
been
restored
to
a
consistent
state
.
-
Issue
#
23008
:
Fixed
resolving
attributes
with
boolean
value
is
False
in
pydoc
.
-
Fix
asyncio
issue
235
:
LifoQueue
and
PriorityQueue
's put didn'
t
...
...
Modules/_collectionsmodule.c
View file @
c6249a62
...
...
@@ -698,9 +698,9 @@ deque_remove(dequeobject *deque, PyObject *value)
if
(
cmp
>
0
)
{
PyObject
*
tgt
=
deque_popleft
(
deque
,
NULL
);
assert
(
tgt
!=
NULL
);
Py_DECREF
(
tgt
);
if
(
_deque_rotate
(
deque
,
i
)
==
-
1
)
if
(
_deque_rotate
(
deque
,
i
))
return
NULL
;
Py_DECREF
(
tgt
);
Py_RETURN_NONE
;
}
else
if
(
cmp
<
0
)
{
...
...
@@ -781,16 +781,16 @@ static int
deque_del_item
(
dequeobject
*
deque
,
Py_ssize_t
i
)
{
PyObject
*
item
;
int
rv
;
assert
(
i
>=
0
&&
i
<
Py_SIZE
(
deque
));
if
(
_deque_rotate
(
deque
,
-
i
)
==
-
1
)
if
(
_deque_rotate
(
deque
,
-
i
))
return
-
1
;
item
=
deque_popleft
(
deque
,
NULL
);
rv
=
_deque_rotate
(
deque
,
i
);
assert
(
item
!=
NULL
);
Py_DECREF
(
item
);
return
_deque_rotate
(
deque
,
i
);
return
rv
;
}
static
int
...
...
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