mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
_asyncio rust impl
This commit is contained in:
committed by
Jeong, YunWon
parent
850a0a7847
commit
d8fa1b4366
2
Lib/test/test_asyncio/test_futures.py
vendored
2
Lib/test/test_asyncio/test_futures.py
vendored
@@ -730,8 +730,6 @@ class CFutureTests(BaseFutureTests, test_utils.TestCase):
|
||||
evil = gc.get_referents(_asyncio)
|
||||
gc.collect()
|
||||
|
||||
# TODO: RUSTPYTHON - _asyncio delegates to Python impl, no true C behavior
|
||||
@unittest.expectedFailure
|
||||
def test_callbacks_copy(self):
|
||||
# See https://github.com/python/cpython/issues/125789
|
||||
# In C implementation, the `_callbacks` attribute
|
||||
|
||||
2
Lib/test/test_asyncio/test_ssl.py
vendored
2
Lib/test/test_asyncio/test_ssl.py
vendored
@@ -963,8 +963,6 @@ class TestSSL(test_utils.TestCase):
|
||||
asyncio.wait_for(client(srv.addr),
|
||||
timeout=support.SHORT_TIMEOUT))
|
||||
|
||||
# TODO: RUSTPYTHON - BrokenPipeError in connection_lost callback
|
||||
@unittest.expectedFailure
|
||||
def test_start_tls_server_1(self):
|
||||
HELLO_MSG = b'1' * self.PAYLOAD_SIZE
|
||||
|
||||
|
||||
3
Lib/test/test_contextlib_async.py
vendored
3
Lib/test/test_contextlib_async.py
vendored
@@ -728,9 +728,6 @@ class TestAsyncExitStack(TestBaseExitStack, unittest.IsolatedAsyncioTestCase):
|
||||
stack.push_async_exit(cm)
|
||||
self.assertIs(stack._exit_callbacks[-1][1], cm)
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; - no _asyncio module, pure Python Task adds extra frame
|
||||
def test_exit_exception_traceback(self):
|
||||
return super().test_exit_exception_traceback()
|
||||
|
||||
|
||||
class TestAsyncNullcontext(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -92,6 +92,10 @@ pub struct VirtualMachine {
|
||||
pub async_gen_firstiter: RefCell<Option<PyObjectRef>>,
|
||||
/// Async generator finalizer hook (per-thread, set via sys.set_asyncgen_hooks)
|
||||
pub async_gen_finalizer: RefCell<Option<PyObjectRef>>,
|
||||
/// Current running asyncio event loop for this thread
|
||||
pub asyncio_running_loop: RefCell<Option<PyObjectRef>>,
|
||||
/// Current running asyncio task for this thread
|
||||
pub asyncio_running_task: RefCell<Option<PyObjectRef>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
@@ -190,6 +194,8 @@ impl VirtualMachine {
|
||||
c_stack_soft_limit: Cell::new(Self::calculate_c_stack_soft_limit()),
|
||||
async_gen_firstiter: RefCell::new(None),
|
||||
async_gen_finalizer: RefCell::new(None),
|
||||
asyncio_running_loop: RefCell::new(None),
|
||||
asyncio_running_task: RefCell::new(None),
|
||||
};
|
||||
|
||||
if vm.state.hash_secret.hash_str("")
|
||||
|
||||
@@ -237,6 +237,8 @@ impl VirtualMachine {
|
||||
c_stack_soft_limit: Cell::new(VirtualMachine::calculate_c_stack_soft_limit()),
|
||||
async_gen_firstiter: RefCell::new(None),
|
||||
async_gen_finalizer: RefCell::new(None),
|
||||
asyncio_running_loop: RefCell::new(None),
|
||||
asyncio_running_task: RefCell::new(None),
|
||||
};
|
||||
ThreadedVirtualMachine { vm }
|
||||
}
|
||||
|
||||
@@ -178,8 +178,10 @@ fn already_warned(
|
||||
Some(version_obj)
|
||||
if version_obj.try_int(vm).is_ok() || version_obj.is(&filters_version) =>
|
||||
{
|
||||
let already_warned = registry.get_item(key.as_ref(), vm)?;
|
||||
if already_warned.is_true(vm)? {
|
||||
// Use .ok() to handle KeyError when key doesn't exist (like Python's dict.get())
|
||||
if let Ok(already_warned) = registry.get_item(key.as_ref(), vm)
|
||||
&& already_warned.is_true(vm)?
|
||||
{
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user