warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__)
import macfs
import os
+import sys
import tempfile
from test import test_support
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)
#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) {
#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) {