Rename DEBUG macro to Py_DEBUG
diff --git a/Include/frameobject.h b/Include/frameobject.h
index 40dd653..85c1f4c 100644
--- a/Include/frameobject.h
+++ b/Include/frameobject.h
@@ -80,7 +80,7 @@
 
 /* Tuple access macros */
 
-#ifndef DEBUG
+#ifndef Py_DEBUG
 #define GETITEM(v, i) PyTuple_GET_ITEM((PyTupleObject *)(v), (i))
 #define GETITEMNAME(v, i) \
 	PyString_AS_STRING((PyStringObject *)GETITEM((v), (i)))
diff --git a/Include/node.h b/Include/node.h
index 03d674a..0575f4a 100644
--- a/Include/node.h
+++ b/Include/node.h
@@ -56,7 +56,7 @@
 #define STR(n)		((n)->n_str)
 
 /* Assert that the type of a node is what we expect */
-#ifndef DEBUG
+#ifndef Py_DEBUG
 #define REQ(n, type) { /*pass*/ ; }
 #else
 #define REQ(n, type) \
diff --git a/Include/object.h b/Include/object.h
index e876e91..54b5481 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -84,7 +84,7 @@
 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12
 */
 
-#ifdef DEBUG
+#ifdef Py_DEBUG
 
 /* Turn on heavy reference debugging */
 #define Py_TRACE_REFS
@@ -92,7 +92,7 @@
 /* Turn on reference counting */
 #define Py_REF_DEBUG
 
-#endif /* DEBUG */
+#endif /* Py_DEBUG */
 
 #ifdef Py_TRACE_REFS
 #define PyObject_HEAD \
diff --git a/Parser/acceler.c b/Parser/acceler.c
index 025f01f..ef1edc3 100644
--- a/Parser/acceler.c
+++ b/Parser/acceler.c
@@ -56,14 +56,14 @@
 {
 	dfa *d;
 	int i;
-#ifdef DEBUG
+#ifdef Py_DEBUG
 	fprintf(stderr, "Adding parser accelerators ...\n");
 #endif
 	d = g->g_dfa;
 	for (i = g->g_ndfas; --i >= 0; d++)
 		fixdfa(g, d);
 	g->g_accel = 1;
-#ifdef DEBUG
+#ifdef Py_DEBUG
 	fprintf(stderr, "Done.\n");
 #endif
 }
diff --git a/Parser/grammar.c b/Parser/grammar.c
index 51bf90e..5eebd31 100644
--- a/Parser/grammar.c
+++ b/Parser/grammar.c
@@ -171,7 +171,7 @@
 {
 	int i;
 
-#ifdef DEBUG
+#ifdef Py_DEBUG
 	printf("Translating labels ...\n");
 #endif
 	/* Don't translate EMPTY */
diff --git a/Parser/parser.c b/Parser/parser.c
index e6fc180..e42fb11 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -44,7 +44,7 @@
 #include "errcode.h"
 
 
-#ifdef DEBUG
+#ifdef Py_DEBUG
 extern int debugging;
 #define D(x) if (!debugging); else x
 #else
@@ -85,7 +85,7 @@
 	return 0;
 }
 
-#ifdef DEBUG
+#ifdef Py_DEBUG
 
 static void s_pop PROTO((stack *));
 
@@ -98,7 +98,7 @@
 	s->s_top++;
 }
 
-#else /* !DEBUG */
+#else /* !Py_DEBUG */
 
 #define s_pop(s) (s)->s_top++
 
@@ -309,7 +309,7 @@
 }
 
 
-#ifdef DEBUG
+#ifdef Py_DEBUG
 
 /* DEBUG OUTPUT */
 
@@ -379,7 +379,7 @@
 	printf("\n");
 }
 
-#endif /* DEBUG */
+#endif /* Py_DEBUG */
 
 /*
 
diff --git a/Parser/pgen.c b/Parser/pgen.c
index c5a0618..9668630 100644
--- a/Parser/pgen.c
+++ b/Parser/pgen.c
@@ -166,7 +166,7 @@
 	return nf;
 }
 
-#ifdef DEBUG
+#ifdef Py_DEBUG
 
 static char REQNFMT[] = "metacompile: less than %d children\n";
 
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 8a726e0..75c1e4e 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -736,7 +736,7 @@
 }
 
 
-#ifdef DEBUG
+#ifdef Py_DEBUG
 
 void
 tok_dump(type, start, end)
diff --git a/Python/ceval.c b/Python/ceval.c
index 7b7fdf0..816973f 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -51,7 +51,7 @@
 /* Turn this on if your compiler chokes on the big switch: */
 /* #define CASE_TOO_BIG 1 */
 
-#ifdef DEBUG
+#ifdef Py_DEBUG
 /* For debugging the interpreter: */
 #define LLTRACE  1	/* Low-level trace feature */
 #define CHECKEXC 1	/* Double-check exception checking */
@@ -339,7 +339,7 @@
 #ifdef LLTRACE
 	int lltrace;
 #endif
-#if defined(DEBUG) || defined(LLTRACE)
+#if defined(Py_DEBUG) || defined(LLTRACE)
 	/* Make it easier to find out where we are with a debugger */
 	char *filename = getstringvalue(co->co_filename);
 #endif
@@ -602,7 +602,7 @@
 
 		/* Extract opcode and argument */
 
-#if defined(DEBUG) || defined(LLTRACE)
+#if defined(Py_DEBUG) || defined(LLTRACE)
 		f->f_lasti = INSTR_OFFSET();
 #endif
 		
diff --git a/Python/thread.c b/Python/thread.c
index 0e6d6ee..ad7dd5c 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -83,7 +83,7 @@
 #define _P2(v1,t1,v2,t2)	(v1,v2) t1; t2;
 #endif /* __STDC__ */
 
-#ifdef DEBUG
+#ifdef Py_DEBUG
 static int thread_debug = 0;
 #define dprintf(args)	((thread_debug & 1) && printf args)
 #define d2printf(args)	((thread_debug & 8) && printf args)
@@ -98,7 +98,7 @@
 
 void init_thread _P0()
 {
-#ifdef DEBUG
+#ifdef Py_DEBUG
 	char *p = getenv("THREADDEBUG");
 
 	if (p) {
@@ -107,7 +107,7 @@
 		else
 			thread_debug = 1;
 	}
-#endif /* DEBUG */
+#endif /* Py_DEBUG */
 	if (initialized)
 		return;
 	initialized = 1;
diff --git a/Python/thread_sgi.h b/Python/thread_sgi.h
index 2774e49..32b94f2 100644
--- a/Python/thread_sgi.h
+++ b/Python/thread_sgi.h
@@ -77,7 +77,7 @@
 	}
 	if (do_exit) {
 		d2printf(("exiting in exit_sig\n"));
-#ifdef DEBUG
+#ifdef Py_DEBUG
 		if ((thread_debug & 8) == 0)
 			thread_debug &= ~1; /* don't produce debug messages */
 #endif
@@ -140,12 +140,12 @@
 	if (usconfig(CONF_ARENATYPE, US_SHAREDONLY) < 0)
 		perror("usconfig - CONF_ARENATYPE");
 	usconfig(CONF_LOCKTYPE, US_DEBUG); /* XXX */
-#ifdef DEBUG
+#ifdef Py_DEBUG
 	if (thread_debug & 4)
 		usconfig(CONF_LOCKTYPE, US_DEBUGPLUS);
 	else if (thread_debug & 2)
 		usconfig(CONF_LOCKTYPE, US_DEBUG);
-#endif /* DEBUG */
+#endif /* Py_DEBUG */
 	if ((shared_arena = usinit(tmpnam(0))) == 0)
 		perror("usinit");
 #ifdef USE_DL