diff options
author | Benjamin Peterson <benjamin@python.org> | 2017-12-31 18:04:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-31 18:04:13 (GMT) |
commit | 0a37a30037073a4a9ba45e560c8445048e5f2ba2 (patch) | |
tree | 9728950510e4e4ffe0edecca86dcf305393f5a87 /Modules | |
parent | 6c6d3a46087bacb9c767c8cf2185505348d3796d (diff) | |
download | cpython-0a37a30037073a4a9ba45e560c8445048e5f2ba2.zip cpython-0a37a30037073a4a9ba45e560c8445048e5f2ba2.tar.gz cpython-0a37a30037073a4a9ba45e560c8445048e5f2ba2.tar.bz2 |
closes bpo-32460: ensure all non-static globals have initializers (#5061)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 4 | ||||
-rw-r--r-- | Modules/_ctypes/_ctypes_test.c | 6 | ||||
-rw-r--r-- | Modules/_io/_iomodule.c | 54 | ||||
-rw-r--r-- | Modules/_sqlite/microprotocols.c | 2 | ||||
-rw-r--r-- | Modules/_sqlite/microprotocols.h | 4 | ||||
-rw-r--r-- | Modules/_sqlite/module.c | 25 |
6 files changed, 47 insertions, 48 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 4440ab0..93e8d8d 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -116,10 +116,10 @@ bytes(cdata) #endif #include "ctypes.h" -PyObject *PyExc_ArgError; +PyObject *PyExc_ArgError = NULL; /* This dict maps ctypes types to POINTER types */ -PyObject *_ctypes_ptrtype_cache; +PyObject *_ctypes_ptrtype_cache = NULL; static PyTypeObject Simple_Type; diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c index 2255e57..620a3c6 100644 --- a/Modules/_ctypes/_ctypes_test.c +++ b/Modules/_ctypes/_ctypes_test.c @@ -63,7 +63,7 @@ typedef struct { } TestReg; -EXPORT(TestReg) last_tfrsuv_arg; +EXPORT(TestReg) last_tfrsuv_arg = {0}; EXPORT(void) @@ -410,8 +410,8 @@ EXPORT(void) _py_func(void) { } -EXPORT(long long) last_tf_arg_s; -EXPORT(unsigned long long) last_tf_arg_u; +EXPORT(long long) last_tf_arg_s = 0; +EXPORT(unsigned long long) last_tf_arg_u = 0; struct BITS { int A: 1, B:2, C:3, D:4, E: 5, F: 6, G: 7, H: 8, I: 9; diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c index f0621f4..cfd78e2 100644 --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -26,33 +26,33 @@ /* Various interned strings */ -PyObject *_PyIO_str_close; -PyObject *_PyIO_str_closed; -PyObject *_PyIO_str_decode; -PyObject *_PyIO_str_encode; -PyObject *_PyIO_str_fileno; -PyObject *_PyIO_str_flush; -PyObject *_PyIO_str_getstate; -PyObject *_PyIO_str_isatty; -PyObject *_PyIO_str_newlines; -PyObject *_PyIO_str_nl; -PyObject *_PyIO_str_read; -PyObject *_PyIO_str_read1; -PyObject *_PyIO_str_readable; -PyObject *_PyIO_str_readall; -PyObject *_PyIO_str_readinto; -PyObject *_PyIO_str_readline; -PyObject *_PyIO_str_reset; -PyObject *_PyIO_str_seek; -PyObject *_PyIO_str_seekable; -PyObject *_PyIO_str_setstate; -PyObject *_PyIO_str_tell; -PyObject *_PyIO_str_truncate; -PyObject *_PyIO_str_writable; -PyObject *_PyIO_str_write; - -PyObject *_PyIO_empty_str; -PyObject *_PyIO_empty_bytes; +PyObject *_PyIO_str_close = NULL; +PyObject *_PyIO_str_closed = NULL; +PyObject *_PyIO_str_decode = NULL; +PyObject *_PyIO_str_encode = NULL; +PyObject *_PyIO_str_fileno = NULL; +PyObject *_PyIO_str_flush = NULL; +PyObject *_PyIO_str_getstate = NULL; +PyObject *_PyIO_str_isatty = NULL; +PyObject *_PyIO_str_newlines = NULL; +PyObject *_PyIO_str_nl = NULL; +PyObject *_PyIO_str_read = NULL; +PyObject *_PyIO_str_read1 = NULL; +PyObject *_PyIO_str_readable = NULL; +PyObject *_PyIO_str_readall = NULL; +PyObject *_PyIO_str_readinto = NULL; +PyObject *_PyIO_str_readline = NULL; +PyObject *_PyIO_str_reset = NULL; +PyObject *_PyIO_str_seek = NULL; +PyObject *_PyIO_str_seekable = NULL; +PyObject *_PyIO_str_setstate = NULL; +PyObject *_PyIO_str_tell = NULL; +PyObject *_PyIO_str_truncate = NULL; +PyObject *_PyIO_str_writable = NULL; +PyObject *_PyIO_str_write = NULL; + +PyObject *_PyIO_empty_str = NULL; +PyObject *_PyIO_empty_bytes = NULL; PyDoc_STRVAR(module_doc, "The io module provides the Python interfaces to stream handling. The\n" diff --git a/Modules/_sqlite/microprotocols.c b/Modules/_sqlite/microprotocols.c index 2261b80..3d01872 100644 --- a/Modules/_sqlite/microprotocols.c +++ b/Modules/_sqlite/microprotocols.c @@ -33,7 +33,7 @@ /** the adapters registry **/ -PyObject *psyco_adapters; +static PyObject *psyco_adapters = NULL; /* pysqlite_microprotocols_init - initialize the adapters dictionary */ diff --git a/Modules/_sqlite/microprotocols.h b/Modules/_sqlite/microprotocols.h index 6941716..99ff6f6 100644 --- a/Modules/_sqlite/microprotocols.h +++ b/Modules/_sqlite/microprotocols.h @@ -28,10 +28,6 @@ #include <Python.h> -/** adapters registry **/ - -extern PyObject *psyco_adapters; - /** the names of the three mandatory methods **/ #define MICROPROTOCOLS_GETQUOTED_NAME "getquoted" diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 9066c32..879c666 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -35,13 +35,20 @@ /* static objects at module-level */ -PyObject* pysqlite_Error, *pysqlite_Warning, *pysqlite_InterfaceError, *pysqlite_DatabaseError, - *pysqlite_InternalError, *pysqlite_OperationalError, *pysqlite_ProgrammingError, - *pysqlite_IntegrityError, *pysqlite_DataError, *pysqlite_NotSupportedError; - -PyObject* converters; -int _enable_callback_tracebacks; -int pysqlite_BaseTypeAdapted; +PyObject *pysqlite_Error = NULL; +PyObject *pysqlite_Warning = NULL; +PyObject *pysqlite_InterfaceError = NULL; +PyObject *pysqlite_DatabaseError = NULL; +PyObject *pysqlite_InternalError = NULL; +PyObject *pysqlite_OperationalError = NULL; +PyObject *pysqlite_ProgrammingError = NULL; +PyObject *pysqlite_IntegrityError = NULL; +PyObject *pysqlite_DataError = NULL; +PyObject *pysqlite_NotSupportedError = NULL; + +PyObject* converters = NULL; +int _enable_callback_tracebacks = 0; +int pysqlite_BaseTypeAdapted = 0; static PyObject* module_connect(PyObject* self, PyObject* args, PyObject* kwargs) @@ -461,10 +468,6 @@ PyMODINIT_FUNC PyInit__sqlite3(void) /* initialize the default converters */ converters_init(dict); - _enable_callback_tracebacks = 0; - - pysqlite_BaseTypeAdapted = 0; - error: if (PyErr_Occurred()) { |