Index: twisted/test/test_compat.py
===================================================================
--- twisted/test/test_compat.py	(revision 34232)
+++ twisted/test/test_compat.py	(working copy)
@@ -206,17 +206,23 @@
     Tests for the Python 3-friendly L{execfile} implementation.
     """
 
-    def setUp(self):
-        self.script = FilePath(self.mktemp())
-        self.script.setContent("foo += 1\n")
+    def writeScript(self, content):
+        """
+        Write L{content} to a new temporary file, returning the L{FilePath}
+        for the new file.
+        """
+        script = FilePath(self.mktemp())
+        script.setContent(content.encode("ascii"))
+        return script
 
 
     def test_execfileGlobals(self):
         """
         L{execfile} executes the specified file in the given global namespace.
         """
+        script = self.writeScript("foo += 1\n")
         globalNamespace = {"foo": 1}
-        execfile(self.script.path, globalNamespace)
+        execfile(script.path, globalNamespace)
         self.assertEqual(2, globalNamespace["foo"])
 
 
@@ -225,8 +231,21 @@
         L{execfile} executes the specified file in the given global and local
         namespaces.
         """
+        script = self.writeScript("foo += 1\n")
         globalNamespace = {"foo": 10}
         localNamespace = {"foo": 20}
-        execfile(self.script.path, globalNamespace, localNamespace)
+        execfile(script.path, globalNamespace, localNamespace)
         self.assertEqual(10, globalNamespace["foo"])
         self.assertEqual(21, localNamespace["foo"])
+
+
+    def test_execfileUniversalNewlines(self):
+        """
+        L{execfile} reads in the specified file using universal newlines so
+        that scripts written on one platform will work on another.
+        """
+        for lineEnding in "\n", "\r", "\r\n":
+            script = self.writeScript("foo = 'okay'" + lineEnding)
+            globalNamespace = {"foo": None}
+            execfile(script.path, globalNamespace)
+            self.assertEqual("okay", globalNamespace["foo"])
Index: twisted/python/compat.py
===================================================================
--- twisted/python/compat.py	(revision 34232)
+++ twisted/python/compat.py	(working copy)
@@ -191,7 +191,7 @@
     """
     if locals is None:
         locals = globals
-    fin = open(filename, "rb")
+    fin = open(filename, "rbU")
     try:
         source = fin.read()
     finally:
Index: twisted/python/test/test_dist.py
===================================================================
--- twisted/python/test/test_dist.py	(revision 34232)
+++ twisted/python/test/test_dist.py	(working copy)
@@ -79,7 +79,7 @@
     def writeSetup(self, name, *path):
         """
         Write out a C{setup.py} file to a location determined by
-        L{self.basedir} and L{path}. L{self.setup_template} is used to
+        L{self.basedir} and L{path}. L{self.setupTemplate} is used to
         generate its contents.
         """
         outdir = self.basedir.descendant(path)
