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
ae138cbf
Commit
ae138cbf
authored
Jan 15, 2008
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor if/elif chain for clarity and speed
parent
f7bd964f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
Lib/Queue.py
Lib/Queue.py
+10
-11
No files found.
Lib/Queue.py
View file @
ae138cbf
...
...
@@ -102,18 +102,17 @@ class Queue:
"""
self
.
not_full
.
acquire
()
try
:
if
self
.
maxsize
>
0
:
if
not
block
:
if
self
.
maxsize
>
0
and
self
.
_qsize
()
==
self
.
maxsize
:
if
self
.
_qsize
()
==
self
.
maxsize
:
raise
Full
elif
timeout
is
None
:
if
self
.
maxsize
>
0
:
while
self
.
_qsize
()
==
self
.
maxsize
:
self
.
not_full
.
wait
()
else
:
if
timeout
<
0
:
elif
timeout
<
0
:
raise
ValueError
(
"'timeout' must be a positive number"
)
else
:
endtime
=
_time
()
+
timeout
if
self
.
maxsize
>
0
:
while
self
.
_qsize
()
==
self
.
maxsize
:
remaining
=
endtime
-
_time
()
if
remaining
<=
0.0
:
...
...
@@ -152,9 +151,9 @@ class Queue:
elif
timeout
is
None
:
while
not
self
.
_qsize
():
self
.
not_empty
.
wait
()
else
:
if
timeout
<
0
:
elif
timeout
<
0
:
raise
ValueError
(
"'timeout' must be a positive number"
)
else
:
endtime
=
_time
()
+
timeout
while
not
self
.
_qsize
():
remaining
=
endtime
-
_time
()
...
...
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