Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Lib/test/test_sqlite3/test_dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ def test_use_after_close(self):
with self.cx:
pass

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_exceptions(self):
# Optional DB-API extension.
self.assertEqual(self.cx.Warning, sqlite.Warning)
Expand Down Expand Up @@ -401,7 +400,6 @@ def test_in_transaction_ro(self):
with self.assertRaises(AttributeError):
self.cx.in_transaction = True

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_connection_exceptions(self):
exceptions = [
"DataError",
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_sqlite3/test_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ def test_autocommit_setget(self):
cx.autocommit = mode
self.assertEqual(cx.autocommit, mode)

@unittest.expectedFailure # TODO: RUSTPYTHON; autocommit validation error messages differ
def test_autocommit_setget_invalid(self):
msg = "autocommit must be True, False, or.*LEGACY"
for mode in "a", 12, (), None:
Expand Down
43 changes: 42 additions & 1 deletion crates/stdlib/src/_sqlite3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ mod _sqlite3 {
)))
}
} else {
Err(vm.new_type_error(format!(
Err(vm.new_value_error(format!(
"autocommit must be True, False, or sqlite3.LEGACY_TRANSACTION_CONTROL, not {}",
obj.class().name()
)))
Expand Down Expand Up @@ -1642,6 +1642,47 @@ mod _sqlite3 {
fn total_changes(&self, vm: &VirtualMachine) -> PyResult<c_int> {
self._db_lock(vm).map(|x| x.total_changes())
}

#[pygetset(name = "Warning")]
fn exc_warning(&self) -> PyTypeRef {
warning_type().to_owned()
}
#[pygetset(name = "Error")]
fn exc_error(&self) -> PyTypeRef {
error_type().to_owned()
}
#[pygetset(name = "InterfaceError")]
fn exc_interface_error(&self) -> PyTypeRef {
interface_error_type().to_owned()
}
#[pygetset(name = "DatabaseError")]
fn exc_database_error(&self) -> PyTypeRef {
database_error_type().to_owned()
}
#[pygetset(name = "DataError")]
fn exc_data_error(&self) -> PyTypeRef {
data_error_type().to_owned()
}
#[pygetset(name = "OperationalError")]
fn exc_operational_error(&self) -> PyTypeRef {
operational_error_type().to_owned()
}
#[pygetset(name = "IntegrityError")]
fn exc_integrity_error(&self) -> PyTypeRef {
integrity_error_type().to_owned()
}
#[pygetset(name = "InternalError")]
fn exc_internal_error(&self) -> PyTypeRef {
internal_error_type().to_owned()
}
#[pygetset(name = "ProgrammingError")]
fn exc_programming_error(&self) -> PyTypeRef {
programming_error_type().to_owned()
}
#[pygetset(name = "NotSupportedError")]
fn exc_not_supported_error(&self) -> PyTypeRef {
not_supported_error_type().to_owned()
}
}

#[pyattr]
Expand Down
Loading