[New-bugs-announce] [issue46920] Remove code made dead long ago with #if 0

Oleg Iarygin report at bugs.python.org
Fri Mar 4 07:13:16 EST 2022


New submission from Oleg Iarygin <oleg at arhadthedev.net>:

`git grep "#if 0"` gives the following occurences of dead code (analyzed with `git blame`, removed by a linked pull request):

- added on 27 Apr 2020 by 2b74c83: Parser/pegen.h:9, Parser/pegen.h:15. Since these constants aren't mentioned anywhere else, I think it's some initial experiment now abandoned.

- added on 23 Apr 2020 by c5fc156: Parser/pegen.c:40. `token_name` is mentioned nowhere in the CPython codebase too.

- added on 20 Nov 2014 by d600951: Python/pylifecycle.c:1843 with the following note:

  > XXX This is disabled because it caused too many problems.  If a __del__ or weakref callback triggers here, Python code has a hard time running, because even the sys module has been cleared out (sys.stdout is gone, sys.excepthook is gone, etc).  One symptom is a sequence of information-free messages coming from threads (if a __del__ or callback is invoked, other threads can execute too, and any exception they encounter triggers a comedy of errors as subsystem after subsystem fails to find what it *expects* to find in sys to help report the exception and consequent unexpected failures).  I've also seen segfaults then, after adding print statements to the Python code getting called.

  So the call is faulty for seven years with no progress.

- added on 26 Oct 2013 by 8444ebb: Modules/sre_lib.h336. The Secret Labs' Regular Expression Engine was vendored nine years ago so `not used in this release` is permanent and can be removed.

- added on 25 Aug 2012 by 2543756: Modules/_ctypes/libffi_osx/x86/x86-ffi64.c:155

- added on 21 Mar 2012 by 1919b7e: Modules/_decimal/libmpdec/sixstep.c:120, Modules/_decimal/libmpdec/sixstep.c:157, Modules/_decimal/libmpdec/fourstep.c:189, Modules/_decimal/libmpdec/fourstep.c:220

- added on 28 Sep 2011 by d63a3b8: Python/formatter_unicode.c:140. `DEBUG_PRINT_FORMAT_SPEC` is used nowhere, plus putting a debugger breakpoint onto an interesting `InternalFormatSpec` is more convenient.

- added on 5 Mar 2008 by 7864476: Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c:40

- added on 27 Aug 2007 by e226b55: Objects/unicodeobject.c:13660, Objects/unicodeobject.c:14253. `_decimal2ascii` is mentioned nowhere else in the CPython codebase.

- added on 11 Aug 2006 by 0e3f591: Python/compile.c:7873. Neither `dump_instr` nor `dump_basicblock` are used.

- added on 7 Dec 2005 by 8c8836b: Modules/_elementtree.c:39. In addition, `ALLOC()` and `RELEASE()` are removed as unconditional no-ops.

- added on 4 Aug 2002 by 00f1e3f: Parser/tokenizer.c:285. "/* Disable support for UTF-16 BOMs until a decision is made whether this needs to be supported */" - I have every reason to believe that the decision was Never Ever.

- added on 23 Mar 2002 by c24ea08: Python/ceval.c:7065-L7070. The "/* future keyword */" is quite overdue already.

- added on 23 Jun 2001 by 01dfdb3: Modules/getaddrinfo.c:41, Modules/getnameinfo.c:37

- added on 14 Jul 1998 by 43ff868: Modules/_tkinter.c:3443

----------
components: Extension Modules, Interpreter Core, Unicode, macOS
messages: 414519
nosy: arhadthedev, ezio.melotti, ned.deily, ronaldoussoren, vstinner
priority: normal
severity: normal
status: open
title: Remove code made dead long ago with #if 0
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46920>
_______________________________________


More information about the New-bugs-announce mailing list