Repository navigation
Remove code made dead long ago with #if 0 #91076
Copy link
Copy link
Closed
Labels
3.11only security fixesonly security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-unicodetype-featureA feature request or enhancementA feature request or enhancement
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = <Date 2022-03-14.16:58:01.166>
created_at = <Date 2022-03-04.12:13:16.134>
labels = ['extension-modules', 'interpreter-core', 'type-feature', 'expert-unicode', '3.11']
title = 'Remove code made dead long ago with #if 0'
updated_at = <Date 2022-03-14.17:03:06.996>
user = 'https://github.com/arhadthedev'bugs.python.org fields:
activity = <Date 2022-03-14.17:03:06.996>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2022-03-14.16:58:01.166>
closer = 'arhadthedev'
components = ['Extension Modules', 'Interpreter Core', 'Unicode']
creation = <Date 2022-03-04.12:13:16.134>
creator = 'arhadthedev'
dependencies = []
files = []
hgrepos = []
issue_num = 46920
keywords = ['patch']
message_count = 8.0
messages = ['414519', '414520', '414596', '415153', '415154', '415155', '415156', '415166']
nosy_count = 4.0
nosy_names = ['mark.dickinson', 'vstinner', 'ezio.melotti', 'arhadthedev']
pr_nums = ['31681', '31811', '31812', '31813', '31814']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue46920'
versions = ['Python 3.11']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-unicodetype-featureA feature request or enhancementA feature request or enhancement
Activity
arhadthedev commentedon Mar 4, 2022
git grep "#if 0"gives the following occurences of dead code (analyzed withgit 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_nameis 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 releaseis 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_SPECis used nowhere, plus putting a debugger breakpoint onto an interestingInternalFormatSpecis 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.
_decimal2asciiis mentioned nowhere else in the CPython codebase.added on 11 Aug 2006 by 0e3f591: Python/compile.c:7873. Neither
dump_instrnordump_basicblockare used.added on 7 Dec 2005 by 8c8836b: Modules/_elementtree.c:39. In addition,
ALLOC()andRELEASE()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
arhadthedev commentedon Mar 4, 2022
Also forgot to add that git grep "#if 1" gives the following:
arhadthedev commentedon Mar 5, 2022
I reverted my changes in Modules/_ctypes/libffi_osx/x86/x86-ffi64.c and Modules/_decimal/libmpdec/*step.c to not disturb third-party vendored libraries.
As a result, macOS component is no longer affected along with the corresponding experts in a nosy list.
vstinner commentedon Mar 14, 2022
New changeset e885ac3 by Oleg Iarygin in branch 'main':
bpo-46920: Remove code that has no explainer why it was disabled (GH-31814)
e885ac3
vstinner commentedon Mar 14, 2022
New changeset a52f82b by Oleg Iarygin in branch 'main':
bpo-46920: Remove disabled debug code added decades ago and likely unnecessary (GH-31812)
a52f82b
vstinner commentedon Mar 14, 2022
New changeset 13b0412 by Oleg Iarygin in branch 'main':
bpo-46920: Remove code that has explainers why it was disabled (GH-31813)
13b0412
vstinner commentedon Mar 14, 2022
Can this issue be closed? Or is there remaining dead code that you want to remove?
vstinner commentedon Mar 14, 2022
Thanks Oleg Iarygin for the cleanup!