my_basename():  Removes the leading path components from a path name,
	returning a pointer to the start of the file's "base" name;
	similar to os.path.basename().

SyntaxError__str__():  Use my_basename() to keep the length of the
	file name included in the exception message short.
diff --git a/Python/exceptions.c b/Python/exceptions.c
index 4d27979..abacda4 100644
--- a/Python/exceptions.c
+++ b/Python/exceptions.c
@@ -19,6 +19,7 @@
  */
 
 #include "Python.h"
+#include "osdefs.h"
 
 /* Caution:  MS Visual C++ 6 errors if a single string literal exceeds
  * 2Kb.  So the module docstring has been broken roughly in half, using
@@ -729,6 +730,26 @@
 }
 
 
+/* This is called "my_basename" instead of just "basename" to avoid name
+   conflicts with glibc; basename is already prototyped if _GNU_SOURCE is
+   defined, and Python does define that. */
+static char *
+my_basename(char *name)
+{
+	char *cp = name;
+	char *result = name;
+
+	if (name == NULL)
+		return "???";
+	while (*cp != '\0') {
+		if (*cp == SEP)
+			result = cp + 1;
+		++cp;
+	}
+	return result;
+}
+
+
 static PyObject *
 SyntaxError__str__(PyObject *self, PyObject *args)
 {
@@ -772,12 +793,12 @@
 		if (have_filename && have_lineno)
 		    sprintf(buffer, "%s (%s, line %d)",
 			    PyString_AS_STRING(str),
-			    PyString_AS_STRING(filename),
+			    my_basename(PyString_AS_STRING(filename)),
 			    PyInt_AsLong(lineno));
 		else if (have_filename)
 		    sprintf(buffer, "%s (%s)",
 			    PyString_AS_STRING(str),
-			    PyString_AS_STRING(filename));
+			    my_basename(PyString_AS_STRING(filename)));
 		else if (have_lineno)
 		    sprintf(buffer, "%s (line %d)",
 			    PyString_AS_STRING(str),