Hynek Schlawack <h...@ox.cx> added the comment:

So I have good news and bad news. The good is: I fixed it for non-Win platforms 
and the patch is truly beautiful:

 Lib/test/test_builtin.py |   6 ++++++
 Modules/_io/fileio.c     |  25 ++++---------------------
 2 files changed, 10 insertions(+), 21 deletions(-)

;)

Two problems:

  1. I'm not sure if it's okay for me to put the test where I put it? 
  2. I'm not sure how to fix it for Win32 (and I also can't test it :().

It's just about the case when it's called with a Unicode path name. The current 
code looks like as following:

    if (PyUnicode_Check(nameobj)) {
        widename = PyUnicode_AsUnicode(nameobj);
        if (widename == NULL)
            return -1;
    }

We can't use the nifty PyUnicode_FSConverter because we want to keep Unicode. 
So I assume the way to go would be the C equivalent of somthing like:

if '\0' in widename:
  raise TypeError()

Right?

I hope someone would be so kind to implement it, otherwise the patch attached 
passes all test on Linux and Mac (except for test_recursion_limit but that 
fails currently for me on the Mac even without my patch).

----------
keywords: +patch
Added file: http://bugs.python.org/file24316/open-nul.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13848>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to