mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
bpo-32348: Optimize asyncio.Future schedule/add/remove callback. (#4907)
This commit is contained in:
parent
4c72bc4a38
commit
1b7c11ff0e
4 changed files with 499 additions and 102 deletions
|
@ -2187,23 +2187,51 @@ def add_subclass_tests(cls):
|
|||
return cls
|
||||
|
||||
|
||||
@unittest.skipUnless(hasattr(futures, '_CFuture'),
|
||||
@unittest.skipUnless(hasattr(futures, '_CFuture') and
|
||||
hasattr(tasks, '_CTask'),
|
||||
'requires the C _asyncio module')
|
||||
class CTask_CFuture_Tests(BaseTaskTests, test_utils.TestCase):
|
||||
Task = getattr(tasks, '_CTask', None)
|
||||
Future = getattr(futures, '_CFuture', None)
|
||||
|
||||
|
||||
@unittest.skipUnless(hasattr(futures, '_CFuture'),
|
||||
@unittest.skipUnless(hasattr(futures, '_CFuture') and
|
||||
hasattr(tasks, '_CTask'),
|
||||
'requires the C _asyncio module')
|
||||
@add_subclass_tests
|
||||
class CTask_CFuture_SubclassTests(BaseTaskTests, test_utils.TestCase):
|
||||
Task = getattr(tasks, '_CTask', None)
|
||||
Future = getattr(futures, '_CFuture', None)
|
||||
|
||||
class Task(tasks._CTask):
|
||||
pass
|
||||
|
||||
class Future(futures._CFuture):
|
||||
pass
|
||||
|
||||
|
||||
@unittest.skipUnless(hasattr(tasks, '_CTask'),
|
||||
'requires the C _asyncio module')
|
||||
@add_subclass_tests
|
||||
class CTaskSubclass_PyFuture_Tests(BaseTaskTests, test_utils.TestCase):
|
||||
|
||||
class Task(tasks._CTask):
|
||||
pass
|
||||
|
||||
Future = futures._PyFuture
|
||||
|
||||
|
||||
@unittest.skipUnless(hasattr(futures, '_CFuture'),
|
||||
'requires the C _asyncio module')
|
||||
@add_subclass_tests
|
||||
class PyTask_CFutureSubclass_Tests(BaseTaskTests, test_utils.TestCase):
|
||||
|
||||
class Future(futures._CFuture):
|
||||
pass
|
||||
|
||||
Task = tasks._PyTask
|
||||
|
||||
|
||||
@unittest.skipUnless(hasattr(tasks, '_CTask'),
|
||||
'requires the C _asyncio module')
|
||||
class CTask_PyFuture_Tests(BaseTaskTests, test_utils.TestCase):
|
||||
Task = getattr(tasks, '_CTask', None)
|
||||
Future = futures._PyFuture
|
||||
|
@ -2223,8 +2251,11 @@ class PyTask_PyFuture_Tests(BaseTaskTests, test_utils.TestCase):
|
|||
|
||||
@add_subclass_tests
|
||||
class PyTask_PyFuture_SubclassTests(BaseTaskTests, test_utils.TestCase):
|
||||
Task = tasks._PyTask
|
||||
Future = futures._PyFuture
|
||||
class Task(tasks._PyTask):
|
||||
pass
|
||||
|
||||
class Future(futures._PyFuture):
|
||||
pass
|
||||
|
||||
|
||||
class BaseTaskIntrospectionTests:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue