10000 gh-111178: fix UBSan failures in `Modules/_sqlite` by picnixz · Pull Request #129087 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-111178: fix UBSan failures in Modules/_sqlite #129087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

8000
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
move cast macros to .c files
  • Loading branch information
picnixz committed Jan 20, 2025
commit 63afc083298428ce725679071f28ba01d091aa7b
2 changes: 2 additions & 0 deletions Modules/_sqlite/blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "clinic/blob.c.h"
#undef clinic_state

#define _pysqlite_Blob_CAST(op) ((pysqlite_Blob *)(op))

/*[clinic input]
module _sqlite3
class _sqlite3.Blob "pysqlite_Blob *" "clinic_state()->BlobType"
Expand Down
2 changes: 0 additions & 2 deletions Modules/_sqlite/blob.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ typedef struct {
PyObject *in_weakreflist;
} pysqlite_Blob;

#define _pysqlite_Blob_CAST(op) ((pysqlite_Blob *)(op))

int pysqlite_blob_setup_types(PyObject *mod);
void pysqlite_close_all_blobs(pysqlite_Connection *self);

Expand Down
2 changes: 2 additions & 0 deletions Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ sqlite3_int64_converter(PyObject *obj, sqlite3_int64 *result)
#include "clinic/connection.c.h"
#undef clinic_state

#define _pysqlite_Connection_CAST(op) ((pysqlite_Connection *)(op))

/*[clinic input]
module _sqlite3
class _sqlite3.Connection "pysqlite_Connection *" "clinic_state()->ConnectionType"
Expand Down
2 changes: 0 additions & 2 deletions Modules/_sqlite/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ typedef struct
PyObject* NotSupportedError;
} pysqlite_Connection;

#define _pysqlite_Connection_CAST(op) ((pysqlite_Connection *)(op))

int pysqlite_check_thread(pysqlite_Connection* self);
int pysqlite_check_connection(pysqlite_Connection* con);

Expand Down
2 changes: 2 additions & 0 deletions Modules/_sqlite/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ typedef enum {
#include "clinic/cursor.c.h"
#undef clinic_state

#define _pysqlite_Cursor_CAST(op) ((pysqlite_Cursor *)(op))

static inline int
check_cursor_locked(pysqlite_Cursor *cur)
{
Expand Down
2 changes: 0 additions & 2 deletions Modules/_sqlite/cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ typedef struct
PyObject* in_weakreflist; /* List of weak references */
} pysqlite_Cursor;

#define _pysqlite_Cursor_CAST(op) ((pysqlite_Cursor *)(op))

int pysqlite_cursor_setup_types(PyObject *module);

#endif
10000
2 changes: 0 additions & 2 deletions Modules/_sqlite/prepare_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ typedef struct
PyObject_HEAD
} pysqlite_PrepareProtocol;

#define _pysqlite_PrepareProtocol_CAST(op) ((pysqlite_PrepareProtocol *)(op))

int pysqlite_prepare_protocol_setup_types(PyObject *module);

#endif
2 changes: 2 additions & 0 deletions Modules/_sqlite/row.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "clinic/row.c.h"
#undef clinic_state

#define _pysqlite_Row_CAST(op) ((pysqlite_Row *)(op))

/*[clinic input]
module _sqlite3
class _sqlite3.Row "pysqlite_Row *" "clinic_state()->RowType"
Expand Down
2 changes: 0 additions & 2 deletions Modules/_sqlite/row.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ typedef struct _Row
PyObject* description;
} pysqlite_Row;

#define _pysqlite_Row_CAST(op) ((pysqlite_Row *)(op))

int pysqlite_row_setup_types(PyObject *module);

#endif
2 changes: 2 additions & 0 deletions Modules/_sqlite/statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "statement.h"
#include "util.h"

#define _pysqlite_Statement_CAST(op) ((pysqlite_Statement *)(op))

/* prototypes */
static const char *lstrip_sql(const char *sql);

Expand Down
2 changes: 0 additions & 2 deletions Modules/_sqlite/statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ typedef struct
int is_dml;
} pysqlite_Statement;

#define _pysqlite_Statement_CAST(op) ((pysqlite_Statement *)(op))

pysqlite_Statement *pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql);

int pysqlite_statement_setup_types(PyObject *module);
Expand Down
Loading
0