File tree Expand file tree Collapse file tree
Misc/NEWS.d/next/Core and Builtins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ async def test_lock(self):
3939
4040 with self .assertRaisesRegex (
4141 TypeError ,
42- "object Lock can't be used in 'await' expression "
42+ "' Lock' object can't be awaited "
4343 ):
4444 await lock
4545
@@ -77,7 +77,7 @@ async def test_lock_by_with_statement(self):
7777 self .assertFalse (lock .locked ())
7878 with self .assertRaisesRegex (
7979 TypeError ,
80- r"object \w+ can't be used in 'await' expression "
80+ r"' \w+' object can't be awaited "
8181 ):
8282 with await lock :
8383 pass
@@ -941,7 +941,7 @@ async def test_semaphore(self):
941941
942942 with self .assertRaisesRegex (
943943 TypeError ,
944- "object Semaphore can't be used in 'await' expression " ,
944+ "' Semaphore' object can't be awaited " ,
945945 ):
946946 await sem
947947
@@ -1270,7 +1270,7 @@ async def test_barrier(self):
12701270 self .assertIn ("filling" , repr (barrier ))
12711271 with self .assertRaisesRegex (
12721272 TypeError ,
1273- "object Barrier can't be used in 'await' expression " ,
1273+ "' Barrier' object can't be awaited " ,
12741274 ):
12751275 await barrier
12761276
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ async def test(lock):
7777 self .assertFalse (lock .locked ())
7878 with self .assertRaisesRegex (
7979 TypeError ,
80- "can't be used in 'await' expression "
80+ "can't be awaited "
8181 ):
8282 with await lock :
8383 pass
Original file line number Diff line number Diff line change @@ -974,13 +974,13 @@ def test_await_1(self):
974974
975975 async def foo ():
976976 await 1
977- with self .assertRaisesRegex (TypeError , "object int can.t.*await " ):
977+ with self .assertRaisesRegex (TypeError , "' int' object can.t be awaited " ):
978978 run_async (foo ())
979979
980980 def test_await_2 (self ):
981981 async def foo ():
982982 await []
983- with self .assertRaisesRegex (TypeError , "object list can.t.*await " ):
983+ with self .assertRaisesRegex (TypeError , "' list' object can.t be awaited " ):
984984 run_async (foo ())
985985
986986 def test_await_3 (self ):
@@ -1040,7 +1040,7 @@ class Awaitable:
10401040 async def foo (): return await Awaitable ()
10411041
10421042 with self .assertRaisesRegex (
1043- TypeError , "object Awaitable can't be used in 'await' expression " ):
1043+ TypeError , "' Awaitable' object can't be awaited " ):
10441044
10451045 run_async (foo ())
10461046
Original file line number Diff line number Diff line change 1+ Changed the error message for awaiting something that can't be awaited from "object <type> can't be used in an await expression" to "'<type>' object can't be awaited".
Original file line number Diff line number Diff line change @@ -1047,7 +1047,7 @@ _PyCoro_GetAwaitableIter(PyObject *o)
10471047 }
10481048
10491049 PyErr_Format (PyExc_TypeError ,
1050- "object %.100s can't be used in 'await' expression " ,
1050+ "' %.100s' object can't be awaited " ,
10511051 ot -> tp_name );
10521052 return NULL ;
10531053}
You can’t perform that action at this time.
0 commit comments