mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
sqlite: Align Connection.__call__ error handling with CPython (#6042)
This commit is contained in:
1 parent
cee579e7ea
commit
1e6da5f430
2 files changed
+6
-4
No files matched your search
Vendored
-2
@@ -1744,8 +1744,6 @@ class ClosedConTests(unittest.TestCase):
|
||||
with self.assertRaises(sqlite.ProgrammingError):
|
||||
con.set_progress_handler(progress, 100)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_closed_call(self):
|
||||
con = sqlite.connect(":memory:")
|
||||
con.close()
|
||||
|
||||
@@ -852,10 +852,14 @@ mod _sqlite {
|
||||
}
|
||||
|
||||
impl Callable for Connection {
|
||||
type Args = (PyUtf8StrRef,);
|
||||
type Args = FuncArgs;
|
||||
|
||||
fn call(zelf: &Py<Self>, args: Self::Args, vm: &VirtualMachine) -> PyResult {
|
||||
if let Some(stmt) = Statement::new(zelf, args.0, vm)? {
|
||||
let _ = zelf.db_lock(vm)?;
|
||||
|
||||
let (sql,): (PyUtf8StrRef,) = args.bind(vm)?;
|
||||
|
||||
if let Some(stmt) = Statement::new(zelf, sql, vm)? {
|
||||
Ok(stmt.into_ref(&vm.ctx).into())
|
||||
} else {
|
||||
Ok(vm.ctx.none())
|
||||
|
||||
Reference in new issue
Block a user