Skip to content

Commit 0988ed0

Browse files
author
Erlend Egeberg Aasland
authored
bpo-44047: Remove unused argument to _pysqlite_seterror (GH-25915)
1 parent a0cb2e4 commit 0988ed0

File tree

4 files changed

+23
-22
lines changed

4 files changed

+23
-22
lines changed

Modules/_sqlite/connection.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pysqlite_connection_init(pysqlite_Connection *self, PyObject *args,
115115
Py_DECREF(database_obj);
116116

117117
if (rc != SQLITE_OK) {
118-
_pysqlite_seterror(self->db, NULL);
118+
_pysqlite_seterror(self->db);
119119
return -1;
120120
}
121121

@@ -342,7 +342,7 @@ pysqlite_connection_close_impl(pysqlite_Connection *self)
342342
rc = sqlite3_close_v2(self->db);
343343

344344
if (rc != SQLITE_OK) {
345-
_pysqlite_seterror(self->db, NULL);
345+
_pysqlite_seterror(self->db);
346346
return NULL;
347347
} else {
348348
self->db = NULL;
@@ -383,21 +383,21 @@ PyObject* _pysqlite_connection_begin(pysqlite_Connection* self)
383383
Py_END_ALLOW_THREADS
384384

385385
if (rc != SQLITE_OK) {
386-
_pysqlite_seterror(self->db, statement);
386+
_pysqlite_seterror(self->db);
387387
goto error;
388388
}
389389

390390
rc = pysqlite_step(statement, self);
391391
if (rc != SQLITE_DONE) {
392-
_pysqlite_seterror(self->db, statement);
392+
_pysqlite_seterror(self->db);
393393
}
394394

395395
Py_BEGIN_ALLOW_THREADS
396396
rc = sqlite3_finalize(statement);
397397
Py_END_ALLOW_THREADS
398398

399399
if (rc != SQLITE_OK && !PyErr_Occurred()) {
400-
_pysqlite_seterror(self->db, NULL);
400+
_pysqlite_seterror(self->db);
401401
}
402402

403403
error:
@@ -431,20 +431,20 @@ pysqlite_connection_commit_impl(pysqlite_Connection *self)
431431
rc = sqlite3_prepare_v2(self->db, "COMMIT", -1, &statement, NULL);
432432
Py_END_ALLOW_THREADS
433433
if (rc != SQLITE_OK) {
434-
_pysqlite_seterror(self->db, NULL);
434+
_pysqlite_seterror(self->db);
435435
goto error;
436436
}
437437

438438
rc = pysqlite_step(statement, self);
439439
if (rc != SQLITE_DONE) {
440-
_pysqlite_seterror(self->db, statement);
440+
_pysqlite_seterror(self->db);
441441
}
442442

443443
Py_BEGIN_ALLOW_THREADS
444444
rc = sqlite3_finalize(statement);
445445
Py_END_ALLOW_THREADS
446446
if (rc != SQLITE_OK && !PyErr_Occurred()) {
447-
_pysqlite_seterror(self->db, NULL);
447+
_pysqlite_seterror(self->db);
448448
}
449449

450450
}
@@ -481,20 +481,20 @@ pysqlite_connection_rollback_impl(pysqlite_Connection *self)
481481
rc = sqlite3_prepare_v2(self->db, "ROLLBACK", -1, &statement, NULL);
482482
Py_END_ALLOW_THREADS
483483
if (rc != SQLITE_OK) {
484-
_pysqlite_seterror(self->db, NULL);
484+
_pysqlite_seterror(self->db);
485485
goto error;
486486
}
487487

488488
rc = pysqlite_step(statement, self);
489489
if (rc != SQLITE_DONE) {
490-
_pysqlite_seterror(self->db, statement);
490+
_pysqlite_seterror(self->db);
491491
}
492492

493493
Py_BEGIN_ALLOW_THREADS
494494
rc = sqlite3_finalize(statement);
495495
Py_END_ALLOW_THREADS
496496
if (rc != SQLITE_OK && !PyErr_Occurred()) {
497-
_pysqlite_seterror(self->db, NULL);
497+
_pysqlite_seterror(self->db);
498498
}
499499

500500
}
@@ -1348,7 +1348,7 @@ pysqlite_connection_call(pysqlite_Connection *self, PyObject *args,
13481348
PyErr_SetString(pysqlite_Warning, "SQL is of wrong type. Must be string.");
13491349
} else {
13501350
(void)pysqlite_statement_reset(statement);
1351-
_pysqlite_seterror(self->db, NULL);
1351+
_pysqlite_seterror(self->db);
13521352
}
13531353
goto error;
13541354
}
@@ -1669,7 +1669,7 @@ pysqlite_connection_backup_impl(pysqlite_Connection *self,
16691669
Py_END_ALLOW_THREADS
16701670

16711671
if (bck_handle == NULL) {
1672-
_pysqlite_seterror(bck_conn, NULL);
1672+
_pysqlite_seterror(bck_conn);
16731673
return NULL;
16741674
}
16751675

@@ -1707,7 +1707,7 @@ pysqlite_connection_backup_impl(pysqlite_Connection *self,
17071707
Py_END_ALLOW_THREADS
17081708

17091709
if (rc != SQLITE_OK) {
1710-
_pysqlite_seterror(bck_conn, NULL);
1710+
_pysqlite_seterror(bck_conn);
17111711
return NULL;
17121712
}
17131713

@@ -1793,7 +1793,7 @@ pysqlite_connection_create_collation_impl(pysqlite_Connection *self,
17931793
PyErr_Clear();
17941794
}
17951795
}
1796-
_pysqlite_seterror(self->db, NULL);
1796+
_pysqlite_seterror(self->db);
17971797
goto finally;
17981798
}
17991799

Modules/_sqlite/cursor.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
537537
}
538538
}
539539
(void)pysqlite_statement_reset(self->statement);
540-
_pysqlite_seterror(self->connection->db, NULL);
540+
_pysqlite_seterror(self->connection->db);
541541
goto error;
542542
}
543543

@@ -715,7 +715,7 @@ pysqlite_cursor_executescript(pysqlite_Cursor *self, PyObject *script_obj)
715715
&script_cstr);
716716
Py_END_ALLOW_THREADS
717717
if (rc != SQLITE_OK) {
718-
_pysqlite_seterror(self->connection->db, NULL);
718+
_pysqlite_seterror(self->connection->db);
719719
goto error;
720720
}
721721

@@ -730,13 +730,13 @@ pysqlite_cursor_executescript(pysqlite_Cursor *self, PyObject *script_obj)
730730

731731
if (rc != SQLITE_DONE) {
732732
(void)sqlite3_finalize(statement);
733-
_pysqlite_seterror(self->connection->db, NULL);
733+
_pysqlite_seterror(self->connection->db);
734734
goto error;
735735
}
736736

737737
rc = sqlite3_finalize(statement);
738738
if (rc != SQLITE_OK) {
739-
_pysqlite_seterror(self->connection->db, NULL);
739+
_pysqlite_seterror(self->connection->db);
740740
goto error;
741741
}
742742

@@ -802,7 +802,7 @@ pysqlite_cursor_iternext(pysqlite_Cursor *self)
802802
if (rc != SQLITE_DONE && rc != SQLITE_ROW) {
803803
(void)pysqlite_statement_reset(self->statement);
804804
Py_DECREF(next_row);
805-
_pysqlite_seterror(self->connection->db, NULL);
805+
_pysqlite_seterror(self->connection->db);
806806
return NULL;
807807
}
808808

Modules/_sqlite/util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ int pysqlite_step(sqlite3_stmt* statement, pysqlite_Connection* connection)
3939
* Checks the SQLite error code and sets the appropriate DB-API exception.
4040
* Returns the error code (0 means no error occurred).
4141
*/
42-
int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st)
42+
int
43+
_pysqlite_seterror(sqlite3 *db)
4344
{
4445
int errorcode = sqlite3_errcode(db);
4546

Modules/_sqlite/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ int pysqlite_step(sqlite3_stmt* statement, pysqlite_Connection* connection);
3535
* Checks the SQLite error code and sets the appropriate DB-API exception.
3636
* Returns the error code (0 means no error occurred).
3737
*/
38-
int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st);
38+
int _pysqlite_seterror(sqlite3 *db);
3939

4040
sqlite_int64 _pysqlite_long_as_int64(PyObject * value);
4141

0 commit comments

Comments
 (0)