summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-03-21 12:54:24 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-03-21 12:54:24 (GMT)
commit3e0196cc00a371a03a0e9c8b7ce71593681ef11d (patch)
tree54267dec9b671dd7f4cff6d0a5098396921a1e12
parent7e0bc112b8bc1174449f5573c03e51e00805218b (diff)
downloadcpython-3e0196cc00a371a03a0e9c8b7ce71593681ef11d.zip
cpython-3e0196cc00a371a03a0e9c8b7ce71593681ef11d.tar.gz
cpython-3e0196cc00a371a03a0e9c8b7ce71593681ef11d.tar.bz2
Adding unicode filename support to FSRefs broke things on MacOS9. "Fixed" by disabling unicode filenames on OS9.
-rw-r--r--Lib/test/test_macfs.py8
-rw-r--r--Mac/Modules/file/_Filemodule.c3
-rw-r--r--Mac/Modules/file/filesupport.py3
3 files changed, 9 insertions, 5 deletions
diff --git a/Lib/test/test_macfs.py b/Lib/test/test_macfs.py
index f6b72ee..ad6db88 100644
--- a/Lib/test/test_macfs.py
+++ b/Lib/test/test_macfs.py
@@ -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)
diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c
index d61172e..5a1cafd 100644
--- a/Mac/Modules/file/_Filemodule.c
+++ b/Mac/Modules/file/_Filemodule.c
@@ -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) {
diff --git a/Mac/Modules/file/filesupport.py b/Mac/Modules/file/filesupport.py
index 1237d22..7223038 100644
--- a/Mac/Modules/file/filesupport.py
+++ b/Mac/Modules/file/filesupport.py
@@ -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) {