[issue14161] python2 file __repr__ does not escape filename

2012-10-02 Thread Ronny Pfannschmidt
Ronny Pfannschmidt added the comment: sorry for the buzz, i got myself up to date on the c api now why is there still the unicode case? the PyObject_Repr variant should work fine in both cases -- ___ Python tracker

[issue14161] python2 file __repr__ does not escape filename

2012-10-02 Thread Ronny Pfannschmidt
Ronny Pfannschmidt added the comment: wtf? you made it possible to return NULL in some case -- ___ Python tracker ___ ___ Python-bugs-

[issue14161] python2 file __repr__ does not escape filename

2012-09-30 Thread Ezio Melotti
Ezio Melotti added the comment: Not sure why this is still open -- probably I was just waiting for the buildbots and forgot it open. The issue seems fixed, so I'm going to close it now. -- assignee: -> ezio.melotti resolution: -> fixed stage: test needed -> committed/rejected status

[issue14161] python2 file __repr__ does not escape filename

2012-03-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 6b1fad34d893 by Ezio Melotti in branch '2.7': #14161: fix test failures on Windows. http://hg.python.org/cpython/rev/6b1fad34d893 -- ___ Python tracker __

[issue14161] python2 file __repr__ does not escape filename

2012-03-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 86c749151660 by Ezio Melotti in branch '2.7': #14161: fix compile error under Windows. http://hg.python.org/cpython/rev/86c749151660 -- ___ Python tracker ___

[issue14161] python2 file __repr__ does not escape filename

2012-03-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 6c1964dee98b by Ezio Melotti in branch '2.7': #14161: fix the __repr__ of file objects to escape the file name. http://hg.python.org/cpython/rev/6c1964dee98b -- nosy: +python-dev ___ Python tracker

[issue14161] python2 file __repr__ does not escape filename

2012-03-02 Thread Philip Jenvey
Philip Jenvey added the comment: I think you want to decref the result of PyObject_Repr after the fact, too -- nosy: +pjenvey ___ Python tracker ___

[issue14161] python2 file __repr__ does not escape filename

2012-03-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: 1. PyObject_Repr() should IMO be preferred (it's the abstract, high-level function). 2. You must check the result for NULL before calling PyString_AsString() on it. -- ___ Python tracker

[issue14161] python2 file __repr__ does not escape filename

2012-03-01 Thread Ezio Melotti
Ezio Melotti added the comment: The attached patch seems to do the trick (not sure if it's the best way to fix the issue though): >>> open('woo\raa') >>> open('woo\ra\'a', 'w') >>> open('woo\ra\'a"', 'w') >>> It's more or less equivalent to: - return "" % (fname, mode, addr) + return "" %

[issue14161] python2 file __repr__ does not escape filename

2012-02-29 Thread Éric Araujo
Éric Araujo added the comment: Duh, obviously that code branch is used only for unicode paths: >>> open('/tmp/t\nest', 'w') >>> open(u'/tmp/t\nest', 'w') There does not seem to be something similar in http://docs.python.org/c-api/string, so I guess one would have to create intermed

[issue14161] python2 file __repr__ does not escape filename

2012-02-29 Thread Éric Araujo
Éric Araujo added the comment: Funny one :D Reproduced on linux: >>> open('/tmp/t\nest', 'w') file_repr in Objects/fileobject.c calls http://docs.python.org/c-api/unicode#PyUnicode_AsUnicodeEscapeString, equivalent to encode('unicode-escape'), so backslashes should be escaped. ---

[issue14161] python2 file __repr__ does not escape filename

2012-02-29 Thread Ezio Melotti
Changes by Ezio Melotti : -- components: +Interpreter Core nosy: +eric.araujo, ezio.melotti, pitrou stage: -> needs patch versions: -Python 2.6 ___ Python tracker ___ _

[issue14161] python2 file __repr__ does not escape filename

2012-02-29 Thread Ronny Pfannschmidt
New submission from Ronny Pfannschmidt : behaviour: >>> name = 'woo\raa' >>> open(name, 'w') aa', mode 'w' at 0x295a8a0> expected: >>> name = 'woo\raa' >>> open(name, 'w') note: don't ask why i tried this chunk of code in the first place -- messages: 154649 nosy: Ronny.Pfannschmidt pr