Auto merge of #2465 - micbou:response-future, r=Valloric
[READY] Fix exception when response future is not set An `AttributeError` exception is raised when `Done` is called before `Start` in the `CompletionRequest` and `EventNotification` classes because the `_response_future` attribute is not yet defined. Fixes #2461. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2465) <!-- Reviewable:end -->
This commit is contained in:
commit
8161d35030
@ -35,6 +35,7 @@ class CompletionRequest( BaseRequest ):
|
|||||||
def __init__( self, request_data ):
|
def __init__( self, request_data ):
|
||||||
super( CompletionRequest, self ).__init__()
|
super( CompletionRequest, self ).__init__()
|
||||||
self.request_data = request_data
|
self.request_data = request_data
|
||||||
|
self._response_future = None
|
||||||
|
|
||||||
|
|
||||||
def Start( self ):
|
def Start( self ):
|
||||||
@ -44,7 +45,7 @@ class CompletionRequest( BaseRequest ):
|
|||||||
|
|
||||||
|
|
||||||
def Done( self ):
|
def Done( self ):
|
||||||
return self._response_future.done()
|
return bool( self._response_future ) and self._response_future.done()
|
||||||
|
|
||||||
|
|
||||||
def RawResponse( self ):
|
def RawResponse( self ):
|
||||||
|
@ -33,6 +33,7 @@ class EventNotification( BaseRequest ):
|
|||||||
self._event_name = event_name
|
self._event_name = event_name
|
||||||
self._filepath = filepath
|
self._filepath = filepath
|
||||||
self._extra_data = extra_data
|
self._extra_data = extra_data
|
||||||
|
self._response_future = None
|
||||||
self._cached_response = None
|
self._cached_response = None
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ class EventNotification( BaseRequest ):
|
|||||||
|
|
||||||
|
|
||||||
def Done( self ):
|
def Done( self ):
|
||||||
return self._response_future.done()
|
return bool( self._response_future ) and self._response_future.done()
|
||||||
|
|
||||||
|
|
||||||
def Response( self ):
|
def Response( self ):
|
||||||
|
Loading…
Reference in New Issue
Block a user