(cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine)
| 891 | type Args = ConnectArgs; |
| 892 | |
| 893 | fn py_new(cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine) -> PyResult<Self> { |
| 894 | let text_factory = PyStr::class(&vm.ctx).to_owned().into_object(); |
| 895 | |
| 896 | // For non-subclassed Connection, initialize in __new__ |
| 897 | // For subclassed Connection, leave db as None and require __init__ to be called |
| 898 | let is_base_class = cls.is(Connection::class(&vm.ctx)); |
| 899 | |
| 900 | let db = if is_base_class { |
| 901 | // Initialize immediately for base class |
| 902 | Some(Connection::initialize_db(&args, vm)?) |
| 903 | } else { |
| 904 | // For subclasses, require __init__ to be called |
| 905 | None |
| 906 | }; |
| 907 | |
| 908 | let initialized = db.is_some(); |
| 909 | |
| 910 | Ok(Self { |
| 911 | db: PyMutex::new(db), |
| 912 | initialized: Radium::new(initialized), |
| 913 | detect_types: Radium::new(args.detect_types), |
| 914 | isolation_level: PyAtomicRef::from(args.isolation_level), |
| 915 | check_same_thread: Radium::new(args.check_same_thread), |
| 916 | thread_ident: PyMutex::new(std::thread::current().id()), |
| 917 | row_factory: PyAtomicRef::from(None), |
| 918 | text_factory: PyAtomicRef::from(text_factory), |
| 919 | autocommit: PyMutex::new(args.autocommit), |
| 920 | }) |
| 921 | } |
| 922 | } |
| 923 | |
| 924 | impl Callable for Connection { |
nothing calls this directly
no test coverage detected