File tree 3 files changed +23
-28
lines changed
3 files changed +23
-28
lines changed Original file line number Diff line number Diff line change @@ -371,32 +371,6 @@ connection_dealloc(pysqlite_Connection *self)
371
371
Py_DECREF (tp );
372
372
}
373
373
374
- /*
375
- * Registers a cursor with the connection.
376
- *
377
- * 0 => error; 1 => ok
378
- */
379
- int pysqlite_connection_register_cursor (pysqlite_Connection * connection , PyObject * cursor )
380
- {
381
- PyObject * weakref ;
382
-
383
- weakref = PyWeakref_NewRef ((PyObject * )cursor , NULL );
384
- if (!weakref ) {
385
- goto error ;
386
- }
387
-
388
- if (PyList_Append (connection -> cursors , weakref ) != 0 ) {
389
- Py_CLEAR (weakref );
390
- goto error ;
391
- }
392
-
393
- Py_DECREF (weakref );
394
-
395
- return 1 ;
396
- error :
397
- return 0 ;
398
- }
399
-
400
374
/*[clinic input]
401
375
_sqlite3.Connection.cursor as pysqlite_connection_cursor
402
376
Original file line number Diff line number Diff line change @@ -99,7 +99,6 @@ typedef struct
99
99
PyObject * NotSupportedError ;
100
100
} pysqlite_Connection ;
101
101
102
- int pysqlite_connection_register_cursor (pysqlite_Connection * connection , PyObject * cursor );
103
102
int pysqlite_check_thread (pysqlite_Connection * self );
104
103
int pysqlite_check_connection (pysqlite_Connection * con );
105
104
Original file line number Diff line number Diff line change @@ -35,6 +35,28 @@ class _sqlite3.Cursor "pysqlite_Cursor *" "clinic_state()->CursorType"
35
35
[clinic start generated code]*/
36
36
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=3c5b8115c5cf30f1]*/
37
37
38
+ /*
39
+ * Registers a cursor with the connection.
40
+ *
41
+ * 0 => error; 1 => ok
42
+ */
43
+ static int
44
+ register_cursor (pysqlite_Connection * connection , PyObject * cursor )
45
+ {
46
+ PyObject * weakref = PyWeakref_NewRef ((PyObject * )cursor , NULL );
47
+ if (weakref == NULL ) {
48
+ return 0 ;
49
+ }
50
+
51
+ if (PyList_Append (connection -> cursors , weakref ) < 0 ) {
52
+ Py_CLEAR (weakref );
53
+ return 0 ;
54
+ }
55
+
56
+ Py_DECREF (weakref );
57
+ return 1 ;
58
+ }
59
+
38
60
/*[clinic input]
39
61
_sqlite3.Cursor.__init__ as pysqlite_cursor_init
40
62
@@ -70,7 +92,7 @@ pysqlite_cursor_init_impl(pysqlite_Cursor *self,
70
92
return -1 ;
71
93
}
72
94
73
- if (!pysqlite_connection_register_cursor (connection , (PyObject * )self )) {
95
+ if (!register_cursor (connection , (PyObject * )self )) {
74
96
return -1 ;
75
97
}
76
98
You can’t perform that action at this time.
0 commit comments