]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Adding unicode filename support to FSRefs broke things on MacOS9. "Fixed" by disablin...
authorJack Jansen <jack.jansen@cwi.nl>
Fri, 21 Mar 2003 12:54:24 +0000 (12:54 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Fri, 21 Mar 2003 12:54:24 +0000 (12:54 +0000)
Lib/test/test_macfs.py
Mac/Modules/file/_Filemodule.c
Mac/Modules/file/filesupport.py

index f6b72eeb782c1035afb2bc83f11f03d7d291fbce..ad6db88cdf58fcdffa0a4364706602fdb75938b7 100644 (file)
@@ -5,6 +5,7 @@ import warnings
 warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__)
 import macfs
 import os
+import sys
 import tempfile
 from test import test_support
 
@@ -30,9 +31,10 @@ class TestMacfs(unittest.TestCase):
         self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname())
         
     def test_fsref_unicode(self):
-        testfn_unicode = unicode(test_support.TESTFN)
-        fsr = macfs.FSRef(testfn_unicode)
-        self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname())
+        if sys.getfilesystemencoding():
+            testfn_unicode = unicode(test_support.TESTFN)
+            fsr = macfs.FSRef(testfn_unicode)
+            self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname())
 
     def test_coercion(self):
         fss = macfs.FSSpec(test_support.TESTFN)
index d61172e2b53f3dcf10eaef6ba9ba375669aeb4eb..5a1cafd514d69521f87a4865f82eb6672a76fd67 100644 (file)
@@ -3194,7 +3194,8 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
 #if TARGET_API_MAC_OSX
        if ( PyMac_GetFSRef(v, &fsr) ) {
 #else
-       if ( PyArg_Parse(v, "O&", FSRef_Convert, &fsr) ) {
+       if (FSRef_Check(v)) {
+               fsr = ((FSRefObject *)v)->ob_itself;
 #endif 
                err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL);
                if (err != noErr) {
index 1237d2200efd54b5070b865fae8fbf8a908ffb1b..7223038b10f950759b63c1394ea1596fc3a9bb0e 100644 (file)
@@ -252,7 +252,8 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
 #if TARGET_API_MAC_OSX
        if ( PyMac_GetFSRef(v, &fsr) ) {
 #else
-       if ( PyArg_Parse(v, "O&", FSRef_Convert, &fsr) ) {
+       if (FSRef_Check(v)) {
+               fsr = ((FSRefObject *)v)->ob_itself;
 #endif 
                err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL);
                if (err != noErr) {