File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -115,10 +115,10 @@ def _repr_info(self):
115
115
return base_tasks ._task_repr_info (self )
116
116
117
117
def set_result (self , result ):
118
- raise NotImplementedError
118
+ raise RuntimeError ( 'Tasks do not support set_result operation' )
119
119
120
120
def set_exception (self , exception ):
121
- raise NotImplementedError
121
+ raise RuntimeError ( 'Tasks do not support set_exception operation' )
122
122
123
123
def get_stack (self , * , limit = None ):
124
124
"""Return the list of stack frames for this task's coroutine.
Original file line number Diff line number Diff line change @@ -1340,10 +1340,10 @@ def notmuch():
1340
1340
gen = notmuch ()
1341
1341
task = self .new_task (self .loop , gen )
1342
1342
1343
- with self .assertRaises ( NotImplementedError ):
1343
+ with self .assertRaisesRegex ( RuntimeError , 'not support set_result' ):
1344
1344
task .set_result ('ok' )
1345
1345
1346
- with self .assertRaises ( NotImplementedError ):
1346
+ with self .assertRaisesRegex ( RuntimeError , 'not support set_exception' ):
1347
1347
task .set_exception (ValueError ())
1348
1348
1349
1349
self .assertEqual (
Original file line number Diff line number Diff line change @@ -2243,7 +2243,8 @@ static PyObject *
2243
2243
_asyncio_Task_set_result (TaskObj * self , PyObject * result )
2244
2244
/*[clinic end generated code: output=1dcae308bfcba318 input=9d1a00c07be41bab]*/
2245
2245
{
2246
- PyErr_SetNone (PyExc_NotImplementedError );
2246
+ PyErr_SetString (PyExc_RuntimeError ,
2247
+ "Tasks do not support set_result operation" );
2247
2248
return NULL ;
2248
2249
}
2249
2250
@@ -2258,7 +2259,8 @@ static PyObject *
2258
2259
_asyncio_Task_set_exception (TaskObj * self , PyObject * exception )
2259
2260
/*[clinic end generated code: output=bc377fc28067303d input=9a8f65c83dcf893a]*/
2260
2261
{
2261
- PyErr_SetNone (PyExc_NotImplementedError );
2262
+ PyErr_SetString (PyExc_RuntimeError ,
2263
+ "Tasks do not support set_exception operation" );
2262
2264
return NULL ;
2263
2265
}
2264
2266
You can’t perform that action at this time.
0 commit comments