8000 bpo-46920: Remove code made dead long ago with #if 0 by arhadthedev · Pull Request #31681 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-46920: Remove code made dead long ago with #if 0 #31681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove code made dead long ago with #if 0
  • Loading branch information
arhadthedev committed Mar 4, 2022
commit a0693cfe502bdc792539a1f1cf0eee63fdf53c9e
10 changes: 0 additions & 10 deletions Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,9 @@
#include <ppc-darwin.h>
#include <architecture/ppc/mode_independent_asm.h>

#if 0
#if defined(POWERPC_DARWIN)
#include <libkern/OSCacheControl.h> // for sys_icache_invalidate()
#endif

#else

#pragma weak sys_icache_invalidate
extern void sys_icache_invalidate(void *start, size_t len);

#endif


extern void ffi_closure_ASM(void);

// The layout of a function descriptor. A C function pointer really
Expand Down
9 changes: 0 additions & 9 deletions Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,6 @@ classify_argument(
case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64:
case FFI_TYPE_POINTER:
#if 0
if (byte_offset + type->size <= 4)
classes[0] = X86_64_INTEGERSI_CLASS;
else
classes[0] = X86_64_INTEGER_CLASS;

return 1;
#else
{
int size = byte_offset + type->size;

Expand Down Expand Up @@ -187,7 +179,6 @@ classify_argument(
else
FFI_ASSERT (0);
}
#endif

case FFI_TYPE_FLOAT:
if (byte_offset == 0)
Expand Down
14 changes: 0 additions & 14 deletions Modules/_decimal/libmpdec/fourstep.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,6 @@ four_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum)
}
}

#if 0
/* An unordered transform is sufficient for convolution. */
/* Transpose the matrix. */
#include "transpose.h"
transpose_3xpow2(a, R, C);
#endif

return 1;
}

Expand All @@ -217,13 +210,6 @@ inv_four_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum)
assert(n <= 3*MPD_MAXTRANSFORM_2N);


#if 0
/* An unordered transform is sufficient for convolution. */
/* Transpose the matrix, producing an R*C matrix. */
#include "transpose.h"
transpose_3xpow2(a, C, R);
#endif

/* Length C transform on the rows. */
for (s = a; s < a+n; s += C) {
if (!inv_six_step_fnt(s, C, modnum)) {
Expand Down
16 changes: 0 additions & 16 deletions Modules/_decimal/libmpdec/sixstep.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,6 @@ six_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum)
}
mpd_free(tparams);

#if 0
/* An unordered transform is sufficient for convolution. */
/* Transpose the matrix. */
if (!transpose_pow2(a, R, C)) {
return 0;
}
#endif

return 1;
}

Expand Down Expand Up @@ -154,14 +146,6 @@ inv_six_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum)
R = ((mpd_size_t)1) << (log2n - (log2n / 2)); /* number of rows */


#if 0
/* An unordered transform is sufficient for convolution. */
/* Transpose the matrix, producing an R*C matrix. */
if (!transpose_pow2(a, C, R)) {
return 0;
}
#endif

/* Length C transform on the rows. */
if ((tparams = _mpd_init_fnt_params(C, 1, modnum)) == NULL) {
return 0;
Expand Down
13 changes: 0 additions & 13 deletions Modules/_elementtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,6 @@

/* -------------------------------------------------------------------- */

#if 0
static int memory = 0;
#define ALLOC(size, comment)\
do { memory += size; printf("%8d - %s\n", memory, comment); } while (0)
#define RELEASE(size, comment)\
do { memory -= size; printf("%8d - %s\n", memory, comment); } while (0)
#else
#define ALLOC(size, comment)
#define RELEASE(size, comment)
#endif

/* compiler tweaks */
#if defined(_MSC_VER)
#define LOCAL(type) static __inline type __fastcall
Expand Down Expand Up @@ -301,7 +290,6 @@ create_new_element(PyObject* tag, PyObject* attrib)

self->weakreflist = NULL;

ALLOC(sizeof(ElementObject), "create element");
PyObject_GC_Track(self);

if (attrib != NULL && !is_empty_dict(attrib)) {
Expand Down Expand Up @@ -676,7 +664,6 @@ element_dealloc(ElementObject* self)
*/
element_gc_clear(self);

RELEASE(sizeof(ElementObject), "destroy element");
Py_TYPE(self)->tp_free((PyObject *)self);
Py_TRASHCAN_END
}
Expand Down
6 changes: 0 additions & 6 deletions Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -3440,11 +3440,5 @@ PyInit__tkinter(void)
return NULL;
}

#if 0
/* This was not a good idea; through <Destroy> bindings,
Tcl_Finalize() may invoke Python code but at that point the
interpreter and thread state have already been destroyed! */
Py_AtExit(Tcl_Finalize);
#endif
return m;
}
19 changes: 0 additions & 19 deletions Modules/getaddrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,6 @@
* - PF_UNSPEC case would be handled in getipnodebyname() with the AI_ALL flag.
*/

#if 0
#include <sys/types.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <netdb.h>
#include <resolv.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <ctype.h>
#include <unistd.h>

#include "addrinfo.h"
#endif

#if defined(__KAME__) && defined(ENABLE_IPV6)
# define FAITH
#endif
Expand Down
14 changes: 0 additions & 14 deletions Modules/getnameinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@
* but INRIA implementation returns EAI_xxx defined for getaddrinfo().
*/

#if 0
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <netdb.h>
#include <resolv.h>
#include <string.h>
#include <stddef.h>

#include "addrinfo.h"
#endif

#define SUCCESS 0
#define YES 1
#define NO 0
Expand Down
28 changes: 0 additions & 28 deletions Modules/sre_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,34 +333,6 @@ SRE(count)(SRE_STATE* state, const SRE_CODE* pattern, Py_ssize_t maxcount)
return ptr - (SRE_CHAR*) state->ptr;
}

#if 0 /* not used in this release */
LOCAL(int)
SRE(info)(SRE_STATE* state, const SRE_CODE* pattern)
{
/* check if an SRE_OP_INFO block matches at the current position.
returns the number of SRE_CODE objects to skip if successful, 0
if no match */

const SRE_CHAR* end = (const SRE_CHAR*) state->end;
const SRE_CHAR* ptr = (const SRE_CHAR*) state->ptr;
Py_ssize_t i;

/* check minimal length */
if (pattern[3] && end - ptr < pattern[3])
return 0;

/* check known prefix */
if (pattern[2] & SRE_INFO_PREFIX && pattern[5] > 1) {
/* <length> <skip> <prefix data> <overlap data> */
for (i = 0; i < pattern[5]; i++)
if ((SRE_CODE) ptr[i] != pattern[7 + i])
return 0;
return pattern[0] + 2 * pattern[6];
}
return pattern[0];
}
#endif

/* The macros below should be used to protect recursive SRE(match)()
* calls that *failed* and do *not* return immediately (IOW, those
* that will backtrack). Explaining:
Expand Down
13 changes: 0 additions & 13 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -13657,14 +13657,6 @@ unicode_zfill_impl(PyObject *self, Py_ssize_t width)
return u;
}

#if 0
static PyObject *
unicode__decimal2ascii(PyObject *self)
{
return PyUnicode_TransformDecimalAndSpaceToASCII(self);
}
#endif

PyDoc_STRVAR(startswith__doc__,
"S.startswith(prefix[, start[, end]]) -> bool\n\
\n\
Expand Down Expand Up @@ -14250,11 +14242,6 @@ static PyMethodDef unicode_methods[] = {
UNICODE___FORMAT___METHODDEF
UNICODE_MAKETRANS_METHODDEF
UNICODE_SIZEOF_METHODDEF
#if 0
/* These methods are just used for debugging the implementation. */
{"_decimal2ascii", (PyCFunction) unicode__decimal2ascii, METH_NOARGS},
#endif

{"__getnewargs__", unicode_getnewargs, METH_NOARGS},
{NULL, NULL}
};
Expand Down
11 changes: 0 additions & 11 deletions Parser/pegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ _PyPegen_byte_offset_to_character_offset(PyObject *line, Py_ssize_t col_offset)
return size;
}

#if 0
static const char *
token_name(int type)
{
if (0 <= type && type <= N_TOKENS) {
return _PyParser_TokenNames[type];
}
return "<Huh?>";
}
#endif

// Here, mark is the start of the node, while p->mark is the end.
// If node==NULL, they should be the same.
int
Expand Down
10 changes: 0 additions & 10 deletions Parser/pegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,8 @@
#include <token.h>
#include <pycore_ast.h>

#if 0
#define PyPARSE_YIELD_IS_KEYWORD 0x0001
#endif

#define PyPARSE_DONT_IMPLY_DEDENT 0x0002

#if 0
#define PyPARSE_WITH_IS_KEYWORD 0x0003
#define PyPARSE_PRINT_IS_FUNCTION 0x0004
#define PyPARSE_UNICODE_LITERALS 0x0008
#endif

#define PyPARSE_IGNORE_COOKIE 0x0010
#define PyPARSE_BARRY_AS_BDFL 0x0020
#define PyPARSE_TYPE_COMMENTS 0x0040
Expand Down
24 changes: 0 additions & 24 deletions Parser/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,30 +282,6 @@ check_bom(int get_char(struct tok_state *),
unget_char(ch1, tok);
return 1;
}
#if 0
/* Disable support for UTF-16 BOMs until a decision
is made whether this needs to be supported. */
} else if (ch1 == 0xFE) {
ch2 = get_char(tok);
if (ch2 != 0xFF) {
unget_char(ch2, tok);
unget_char(ch1, tok);
return 1;
}
if (!set_readline(tok, "utf-16-be"))
return 0;
tok->decoding_state = STATE_NORMAL;
} else if (ch1 == 0xFF) {
ch2 = get_char(tok);
if (ch2 != 0xFE) {
unget_char(ch2, tok);
unget_char(ch1, tok);
return 1;
}
if (!set_readline(tok, "utf-16-le"))
return 0;
tok->decoding_state = STATE_NORMAL;
#endif
} else {
unget_char(ch1, tok);
return 1;
Expand Down
6 changes: 0 additions & 6 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -7062,12 +7062,6 @@ PyEval_MergeCompilerFlags(PyCompilerFlags *cf)
result = 1;
cf->cf_flags |= compilerflags;
}
#if 0 /* future keyword */
if (codeflags & CO_GENERATOR_ALLOWED) {
result = 1;
cf->cf_flags |= CO_GENERATOR_ALLOWED;
}
#endif
}
return result;
}
Expand Down
36 changes: 0 additions & 36 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -7869,42 +7869,6 @@ makecode(struct compiler *c, struct assembler *a, PyObject *constslist,
return co;
}


/* For debugging purposes only */
#if 0
static void
dump_instr(struct instr *i)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These have been useful occasionally, so I would rather not remove them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored.

{
const char *jrel = (is_relative_jump(i)) ? "jrel " : "";
const char *jabs = (is_jump(i) && !is_relative_jump(i))? "jabs " : "";

char arg[128];

*arg = '\0';
if (HAS_ARG(i->i_opcode)) {
sprintf(arg, "arg: %d ", i->i_oparg);
}
fprintf(stderr, "line: %d, opcode: %d %s%s%s\n",
i->i_lineno, i->i_opcode, arg, jabs, jrel);
}

static void
dump_basicblock(const basicblock *b)
{
const char *b_return = b->b_return ? "return " : "";
fprintf(stderr, "used: %d, depth: %d, offset: %d %s\n",
b->b_iused, b->b_startdepth, b->b_offset, b_return);
if (b->b_instr) {
int i;
for (i = 0; i < b->b_iused; i++) {
fprintf(stderr, " [%02d] ", i);
dump_instr(b->b_instr + i);
}
}
}
#endif


static int
normalize_basic_block(basicblock *bb);

Expand Down
Loading
0