Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(304)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 98680044: Add BaseEventLoop._closed attribute

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 7 months ago by haypo_gmail
Modified:
11 years, 7 months ago
Reviewers:
yselivanov, GvR
Visibility:
Public.
Add BaseEventLoop._closed attribute

Patch Set 1 #

Total comments: 9

Patch Set 2 : new BaseEventLoop.is_closed() method #

Created: 11 years, 7 months ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+70 lines, -19 lines) Patch
M asyncio/base_events.py View 1 6 chunks +19 lines, -0 lines 0 comments Download
M asyncio/proactor_events.py View 1 3 chunks +15 lines, -8 lines 0 comments Download
M asyncio/selector_events.py View 1 5 chunks +8 lines, -8 lines 0 comments Download
M tests/test_base_events.py View 1 1 chunk +14 lines, -0 lines 0 comments Download
M tests/test_selector_events.py View 1 3 chunks +14 lines, -3 lines 0 comments Download
Total messages: 8
|
GvR
https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py File asyncio/base_events.py (right): https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py#newcode135 asyncio/base_events.py:135: self._closed, self.get_debug())) I wonder if we should also add ...
11 years, 7 months ago (2014年05月28日 23:05:27 UTC) #1
https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py
File asyncio/base_events.py (right):
https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py#newcode135
asyncio/base_events.py:135: self._closed, self.get_debug()))
I wonder if we should also add a property or accessor method so a user can test
the closed flag. There are a lot of places in the patch now that use this
private variable.
https://codereview.appspot.com/98680044/diff/1/asyncio/proactor_events.py
File asyncio/proactor_events.py (right):
https://codereview.appspot.com/98680044/diff/1/asyncio/proactor_events.py#new...
asyncio/proactor_events.py:356: if self._closed:
I'm not sure if this is an improvement. Now you are depending on an
implementation detail of the superclass.
https://codereview.appspot.com/98680044/diff/1/asyncio/selector_events.py
File asyncio/selector_events.py (right):
https://codereview.appspot.com/98680044/diff/1/asyncio/selector_events.py#new...
asyncio/selector_events.py:58: if self._closed:
Ditto.
https://codereview.appspot.com/98680044/diff/1/tests/test_selector_events.py
File tests/test_selector_events.py (left):
https://codereview.appspot.com/98680044/diff/1/tests/test_selector_events.py#...
tests/test_selector_events.py:95: def test_close_no_selector(self):
Did you mean to delete this test?
https://codereview.appspot.com/98680044/diff/1/tests/test_selector_events.py
File tests/test_selector_events.py (right):
https://codereview.appspot.com/98680044/diff/1/tests/test_selector_events.py#...
tests/test_selector_events.py:81: 
You don't need this blank line.
Sign in to reply to this message.
yselivanov
https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py File asyncio/base_events.py (right): https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py#newcode133 asyncio/base_events.py:133: return ('<%s running=%s closed=%s debug=%s>' Hm, maybe if event ...
11 years, 7 months ago (2014年05月28日 23:07:09 UTC) #2
https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py
File asyncio/base_events.py (right):
https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py#newcode133
asyncio/base_events.py:133: return ('<%s running=%s closed=%s debug=%s>'
Hm, maybe if event loop is closed, then we only need <EventLoop closed> form,
and when it's not closed, we can shod <Event loop running=True debug=False>
form?
https://codereview.appspot.com/98680044/diff/1/tests/test_selector_events.py
File tests/test_selector_events.py (left):
https://codereview.appspot.com/98680044/diff/1/tests/test_selector_events.py#...
tests/test_selector_events.py:103: self.assertIsNone(self.loop._selector)
Are you sure it's a good idea to remove these tests?
Sign in to reply to this message.
haypo_gmail
https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py File asyncio/base_events.py (right): https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py#newcode135 asyncio/base_events.py:135: self._closed, self.get_debug())) On 2014年05月28日 23:05:26, GvR wrote: > I ...
11 years, 7 months ago (2014年05月28日 23:18:45 UTC) #3
https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py
File asyncio/base_events.py (right):
https://codereview.appspot.com/98680044/diff/1/asyncio/base_events.py#newcode135
asyncio/base_events.py:135: self._closed, self.get_debug()))
On 2014年05月28日 23:05:26, GvR wrote:
> I wonder if we should also add a property or accessor method so a user can
test
> the closed flag. There are a lot of places in the patch now that use this
> private variable.
File objects of the io module have a read-only closed property. We can add a
get_closed() method to be consistent with other flags: get_debug() for _debug.
It is useful to know if the event loop is closed or not.
https://codereview.appspot.com/98680044/diff/1/tests/test_selector_events.py
File tests/test_selector_events.py (left):
https://codereview.appspot.com/98680044/diff/1/tests/test_selector_events.py#...
tests/test_selector_events.py:103: self.assertIsNone(self.loop._selector)
On 2014年05月28日 23:07:09, yselivanov wrote:
> Are you sure it's a good idea to remove these tests?
These checks should be moved to test_close().
Sign in to reply to this message.
GvR
Since event loops don't have any other properties I think get_closed() is the thing to ...
11 years, 7 months ago (2014年05月28日 23:45:03 UTC) #4
Since event loops don't have any other properties I think get_closed() is the
thing to do.
Sign in to reply to this message.
yselivanov
On 2014年05月28日 23:45:03, GvR wrote: > Since event loops don't have any other properties I ...
11 years, 7 months ago (2014年05月28日 23:50:18 UTC) #5
On 2014年05月28日 23:45:03, GvR wrote:
> Since event loops don't have any other properties I think get_closed() is the
> thing to do.
Maybe is_closed(), similar to is_running()?
Sign in to reply to this message.
GvR
Oh, fine. On Wed, May 28, 2014 at 4:50 PM, <yselivanov@gmail.com> wrote: > On 2014年05月28日 ...
11 years, 7 months ago (2014年05月28日 23:51:47 UTC) #6
Oh, fine.
On Wed, May 28, 2014 at 4:50 PM, <yselivanov@gmail.com> wrote:
> On 2014年05月28日 23:45:03, GvR wrote:
>
>> Since event loops don't have any other properties I think get_closed()
>>
> is the
>
>> thing to do.
>>
>
> Maybe is_closed(), similar to is_running()?
>
> https://codereview.appspot.com/98680044/
>
-- 
--Guido van Rossum (python.org/~guido)
Sign in to reply to this message.
GvR
LGTM. You may shorten the __repr__ if not closed (as Yuri suggested), or you may ...
11 years, 7 months ago (2014年06月03日 03:11:34 UTC) #7
LGTM. You may shorten the __repr__ if not closed (as Yuri suggested), or you may
leave it as is.
Sign in to reply to this message.
haypo_gmail
On 2014年06月03日 03:11:34, GvR wrote: > LGTM. You may shorten the __repr__ if not closed ...
11 years, 7 months ago (2014年06月03日 23:19:33 UTC) #8
On 2014年06月03日 03:11:34, GvR wrote:
> LGTM. You may shorten the __repr__ if not closed (as Yuri suggested), or you
may
> leave it as is.
I disagree with Yury's suggestion for __repr__ because it is possible to close
an event loop while it is running (running=True). But it looks like a bug in
asyncio:
https://code.google.com/p/tulip/issues/detail?id=171
I will reconsider Yury's suggestion when this issue will be solved.
Sign in to reply to this message.
|
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /