Title: Dead code in Objects/object.c
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.1, Python 3.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: glimberg, pitrou
Priority: low Keywords: easy, patch

Created on 2010-07-18 14:55 by pitrou, last changed 2010-07-27 22:10 by pitrou. This issue is now closed.

File name Uploaded Description Edit
internal_print_remove.patch glimberg, 2010-07-25 23:20
Messages (4)
msg110651 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-07-18 14:55
internal_print() is called from only one place, with the `nesting` argument wired to 0, therefore the following chunk of code in internal_print() never gets a chance to be executed:

    if (nesting > 10) {
        PyErr_SetString(PyExc_RuntimeError, "print recursion");
        return -1;
msg111564 - (view) Author: Grant Limberg (glimberg) Date: 2010-07-25 22:17
It looks like at one point, internal_print was a recursive function, but this is no longer the case.  I've updated the function parameters to no longer contain the "nesting" parameter and removed the if block shown in this case.
msg111572 - (view) Author: Grant Limberg (glimberg) Date: 2010-07-25 23:20
On second thought, internal_print() doesn't look like it's needed anymore as it's only called by PyObject_Print() and is no longer recursive.  This second patch moves internal_print()'s function body into PyObject_Print and removes the internal_print function.
msg111734 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-07-27 22:10
Thank you! The patch was committed in r83184 (py3k) and r83185 (3.1).
Date User Action Args
2010-07-27 22:10:44pitrousetstatus: open -> closed
resolution: fixed
messages: + msg111734

stage: needs patch -> resolved
2010-07-25 23:21:01glimbergsetfiles: - internal_print_non_recursive.patch
2010-07-25 23:20:47glimbergsetfiles: + internal_print_remove.patch

messages: + msg111572
2010-07-25 22:17:27glimbergsetfiles: + internal_print_non_recursive.patch

nosy: + glimberg
messages: + msg111564

keywords: + patch
2010-07-18 15:06:52pitrousetkeywords: + easy
2010-07-18 14:55:42pitroucreate