[issue4071] ntpath.abspath fails for long str paths

Hirokazu Yamamoto report at bugs.python.org
Thu Oct 9 20:37:39 CEST 2008


Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp> added the comment:

I think attached patch "fix_getfullpathname.patch" will fix unicode
issue at least. For ansi issue, I followed the manner of win32_chdir for
now.

After some investigation, GetFullPathNameA fails if output size is more
than MAX_PATH even if input size is less than MAX_PATH. I feel it's
difficult check this before invoking GetFullPathNameA.

This is test for unicode issue.

/////////////////////////////////////////////////////////

import unittest
import ntpath
import os

class TestCase(unittest.TestCase):
    def test_getfullpathname(self):
        for count in xrange(1, 1000):
            name = u"x" * count
            path = ntpath._getfullpathname(name)
            self.assertEqual(os.path.basename(path), name)

if __name__ == '__main__':
    unittest.main()

----------
keywords: +patch
versions: +Python 2.6, Python 3.0
Added file: http://bugs.python.org/file11755/fix_getfullpathname.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4071>
_______________________________________


More information about the Python-bugs-list mailing list