Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Commit 2df68c3

Browse files
authored
sqlite3: fix row_factory deletion error (RustPython#8693)
Match CPython 3.14 by distinguishing row_factory assignment from deletion and raising AttributeError with the compatible message. Unmark the passing row_factory deletion test. Assisted-by: GitHub Copilot:GPT-5.6 Luna (high)
1 parent 5dc83d9 commit 2df68c3

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎Lib/test/test_sqlite3/test_factory.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ def test_sqlite_row_index(self):
159159
with self.assertRaises(IndexError):
160160
row[complex()] # index must be int or string
161161

162-
@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: can't delete attribute
163162
def test_delete_connection_row_factory(self):
164163
# gh-149738: deleting row_factory should raise an exception
165164
with self.assertRaises(AttributeError):

‎crates/stdlib/src/_sqlite3.rs‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,8 +1661,20 @@ mod _sqlite3 {
16611661
self.row_factory.to_owned()
16621662
}
16631663
#[pygetset(setter)]
1664-
fn set_row_factory(&self, val: Option<PyObjectRef>) {
1665-
let _ = unsafe { self.row_factory.swap(val) };
1664+
fn set_row_factory(
1665+
&self,
1666+
val: PySetterValue<Option<PyObjectRef>>,
1667+
vm: &VirtualMachine,
1668+
) -> PyResult<()> {
1669+
match val {
1670+
PySetterValue::Assign(val) => {
1671+
let _ = unsafe { self.row_factory.swap(val) };
1672+
Ok(())
1673+
}
1674+
PySetterValue::Delete => {
1675+
Err(vm.new_attribute_error("cannot delete row_factory attribute"))
1676+
}
1677+
}
16661678
}
16671679

16681680
fn check_thread(&self, vm: &VirtualMachine) -> PyResult<()> {

0 commit comments

Comments
 (0)