[issue43359] Dead assignment in Py_UniversalNewlineFgets

2021-03-08 Thread Alex Henrie
Alex Henrie added the comment: Hi Victor, just so we're all on the same page, removing the line does not trigger a compiler warning. The comment on this line is misleading. -- ___ Python tracker <https://bugs.python.org/issue43

[issue39523] Unnecessary variable assignment and initial loop check in pysqlite_cursor_executescript

2020-02-01 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17682 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18305 ___ Python tracker <https://bugs.python.org/issu

[issue39523] Unnecessary variable assignment and initial loop check in pysqlite_cursor_executescript

2020-02-01 Thread Alex Henrie
New submission from Alex Henrie : pysqlite_cursor_executescript currently has the following while loop: /* execute statement, and ignore results of SELECT statements */ rc = SQLITE_ROW; while (rc == SQLITE_ROW) { rc = pysqlite_step(statement, self->connect

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-02-01 Thread Alex Henrie
Alex Henrie added the comment: Sorry about that, I didn't notice that GCC's -Wall option emits a warning about this. I just added the extra sets of parentheses. -- ___ Python tracker <https://bugs.python.org/issue39

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-01-31 Thread Alex Henrie
Alex Henrie added the comment: You're right, that's even better. I forgot that the equals operator also returns the variable's new value. I just updated my pull request :-) -- ___ Python tracker <https://bugs.python.org/issue39

[issue39497] Unused variable script_str in pysqlite_cursor_executescript

2020-01-29 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17646 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18271 ___ Python tracker <https://bugs.python.org/issu

[issue39497] Unused variable script_str in pysqlite_cursor_executescript

2020-01-29 Thread Alex Henrie
New submission from Alex Henrie : The function pysqlite_cursor_executescript defines a variable called script_str, initializes it to NULL, and calls Py_XDECREF on it. However, this variable has been unused since August 2007: https://github.com/python/cpython/commit

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-01-29 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17645 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18270 ___ Python tracker <https://bugs.python.org/issu

[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-01-29 Thread Alex Henrie
New submission from Alex Henrie : pysqlite_cursor_fetchall currently has the following bit of code: /* just make sure we enter the loop */ row = (PyObject*)Py_None; while (row) { row = pysqlite_cursor_iternext(self); if (row) { PyList_Append(list, row

[issue39494] Extra null terminators in keyword arrays in sqlite module

2020-01-29 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17644 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18267 ___ Python tracker <https://bugs.python.org/issu

[issue39494] Extra null terminators in keyword arrays in sqlite module

2020-01-29 Thread Alex Henrie
New submission from Alex Henrie : Modules/_sqlite/cursor.c currently has the following variable declaration: static char *kwlist[] = {"size", NULL, NULL}; The second null terminator is unnecessary and detrimental in that it makes the code harder to read and understand. Modul

[issue39307] Memory leak in parsetok

2020-01-11 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17363 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17953 ___ Python tracker <https://bugs.python.org/issu

[issue39307] Memory leak in parsetok

2020-01-11 Thread Alex Henrie
New submission from Alex Henrie : The parsetok function currently contains the following code: if (!growable_comment_array_init(_ignores, 10)) { err_ret->error = E_NOMEM; PyTokenizer_Free(tok); return NULL; } if ((ps = PyParser_New(g, start)) == N

[issue39272] Dead assignment in _ssl__SSLContext_load_verify_locations_impl

2020-01-08 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17328 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17916 ___ Python tracker <https://bugs.python.org/issu

[issue39272] Dead assignment in _ssl__SSLContext_load_verify_locations_impl

2020-01-08 Thread Alex Henrie
New submission from Alex Henrie : The function _ssl__SSLContext_load_verify_locations_impl currently contains the following code: if (r != 1) { ok = 0; if (errno != 0) { ERR_clear_error(); PyErr_SetFromErrno(PyExc_OSError

[issue39271] Dead assignment in pattern_subx

2020-01-08 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17327 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17915 ___ Python tracker <https://bugs.python.org/issu

[issue39271] Dead assignment in pattern_subx

2020-01-08 Thread Alex Henrie
New submission from Alex Henrie : The function pattern_subx currently sets the variable b to charsize, but that variable is reset to STATE_OFFSET(, state.start) before it is ever used. -- components: Regular Expressions messages: 359653 nosy: alex.henrie, ezio.melotti, mrabarnett

[issue39270] Dead assignment in config_init_module_search_paths

2020-01-08 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17326 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17914 ___ Python tracker <https://bugs.python.org/issu

[issue39270] Dead assignment in config_init_module_search_paths

2020-01-08 Thread Alex Henrie
New submission from Alex Henrie : config_init_module_search_paths currently has the following code: const wchar_t *p = sys_path; while (1) { p = wcschr(sys_path, delim); The first assignment to p is unnecessary because it is immediately overwritten. Victor Stinner suggested

[issue39262] Unused error message in _sharedexception_bind

2020-01-08 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17319 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17908 ___ Python tracker <https://bugs.python.org/issu

[issue39262] Unused error message in _sharedexception_bind

2020-01-08 Thread Alex Henrie
New submission from Alex Henrie : The function _sharedexception_bind currently has the following bit of code in two places: if (PyErr_ExceptionMatches(PyExc_MemoryError)) { failure = "out of memory copying exception type name"; } failure = "unable to

[issue39261] Dead assignment in pyinit_config

2020-01-08 Thread Alex Henrie
Change by Alex Henrie : -- type: -> performance ___ Python tracker <https://bugs.python.org/issue39261> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue39261] Dead assignment in pyinit_config

2020-01-08 Thread Alex Henrie
Change by Alex Henrie : -- versions: +Python 3.9 ___ Python tracker <https://bugs.python.org/issue39261> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39261] Dead assignment in pyinit_config

2020-01-08 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17318 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17907 ___ Python tracker <https://bugs.python.org/issu

[issue39261] Dead assignment in pyinit_config

2020-01-08 Thread Alex Henrie
New submission from Alex Henrie : The function pyinit_config currently contains the following line: config = >interp->config; However, the config variable is not used after that point. Victor Stinner has confirmed that this assignment is unnecessary: https://github.com/python/c

[issue39237] Redundant call to round in delta_new

2020-01-08 Thread Alex Henrie
Alex Henrie added the comment: Thank you! -- ___ Python tracker <https://bugs.python.org/issue39237> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39237] Redundant call to round in delta_new

2020-01-06 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +17293 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17877 ___ Python tracker <https://bugs.python.org/issu

[issue39237] Redundant call to round in delta_new

2020-01-06 Thread Alex Henrie
New submission from Alex Henrie : The delta_new function in _datetimemodule.c currently contains the following code: /* Round to nearest whole # of us, and add into x. */ double whole_us = round(leftover_us); int x_is_odd; PyObject *temp; whole_us = round(leftover_us

[issue34889] int.to_bytes and int.from_bytes should default to the system byte order like the struct module does

2018-10-03 Thread Alex Henrie
Change by Alex Henrie : -- keywords: +patch pull_requests: +9081 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34889> ___ ___ Py

[issue34889] int.to_bytes and int.from_bytes should default to the system byte order like the struct module does

2018-10-03 Thread Alex Henrie
New submission from Alex Henrie : When serializing a single integer, int.to_bytes and int.from_bytes are more efficient alternatives to struct.pack and struct.unpack. However, struct.pack and struct.unpack currently have the advantage that the byteorder does not have to be specified (because