mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Adding unicode filename support to FSRefs broke things on MacOS9. "Fixed" by disabling unicode filenames on OS9.
This commit is contained in:
parent
7e0bc112b8
commit
3e0196cc00
3 changed files with 9 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue