This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hynek
Recipients alex, hynek, pitrou
Date 2012-01-24.15:52:12
SpamBayes Score 8.9928065e-15
Marked as misclassified No
Message-id <1327420334.39.0.229704124266.issue13848@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2012-01-24 15:52:14hyneksetrecipients: + hynek, pitrou, alex
2012-01-24 15:52:14hyneksetmessageid: <1327420334.39.0.229704124266.issue13848@psf.upfronthosting.co.za>
2012-01-24 15:52:13hyneklinkissue13848 messages
2012-01-24 15:52:13hynekcreate