cpython: 6c1964dee98b (original) (raw)

Mercurial > cpython

changeset 75527:6c1964dee98b 2.7

#14161: fix the __repr__ of file objects to escape the file name. [#14161]

Ezio Melotti ezio.melotti@gmail.com
date Mon, 12 Mar 2012 01:17:02 +0200
parents b6ec3b717f7e
children 86c749151660
files Lib/test/test_file2k.py Misc/NEWS Objects/fileobject.c
diffstat 3 files changed, 19 insertions(+), 4 deletions(-)[+] [-] Lib/test/test_file2k.py 7 Misc/NEWS 2 Objects/fileobject.c 14

line wrap: on

line diff

--- a/Lib/test/test_file2k.py +++ b/Lib/test/test_file2k.py @@ -89,6 +89,13 @@ class AutoFileTests(unittest.TestCase): def testRepr(self): # verify repr works self.assertTrue(repr(self.f).startswith("<open file '" + TESTFN))

def testErrors(self): self.f.close()

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,8 @@ What's New in Python 2.7.4 Core and Builtins ----------------- +- Issue #14161: fix the repr of file objects to escape the file name. +

--- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -635,10 +635,11 @@ file_dealloc(PyFileObject *f) static PyObject * file_repr(PyFileObject *f) {

#ifdef Py_USING_UNICODE

@@ -649,11 +650,16 @@ file_repr(PyFileObject *f) return ret; #endif } else {