summaryrefslogtreecommitdiffstats
path: root/packaging/macosx/ports/lang/python25/files/patch-64bit.diff
blob: 100617df69f84c0f90e3e81aad9720dffd711399 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
--- Include/pymactoolbox.h.orig	2004-11-05 18:02:59.000000000 +1100
+++ Include/pymactoolbox.h	2009-09-10 18:08:58.000000000 +1000
@@ -8,7 +8,9 @@
 #endif
 
 #include <Carbon/Carbon.h>
+#ifndef __LP64__
 #include <QuickTime/QuickTime.h>
+#endif /* !__LP64__ */
 
 /*
 ** Helper routines for error codes and such.
@@ -18,8 +20,10 @@
 PyObject *PyMac_GetOSErrException(void);	/* Initialize & return it */
 PyObject *PyErr_Mac(PyObject *, int);		/* Exception with a mac error */
 PyObject *PyMac_Error(OSErr);			/* Uses PyMac_GetOSErrException */
+#ifndef __LP64__
 extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
 							      fsspec->path */
+#endif /* !__LP64__ */
 /*
 ** These conversion routines are defined in mactoolboxglue.c itself.
 */
@@ -83,9 +87,10 @@
 #endif /* USE_TOOLBOX_OBJECT_GLUE */
 
 /* macfs exports */
+#ifndef __LP64__
 int PyMac_GetFSSpec(PyObject *, FSSpec *);	/* argument parser for FSSpec */
 PyObject *PyMac_BuildFSSpec(FSSpec *);		/* Convert FSSpec to PyObject */
-
+#endif /* !__LP64__ */
 int PyMac_GetFSRef(PyObject *, FSRef *);	/* argument parser for FSRef */
 PyObject *PyMac_BuildFSRef(FSRef *);		/* Convert FSRef to PyObject */
 
@@ -101,39 +106,54 @@
 extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
 
 /* Ctl exports */
+#ifndef __LP64__
 extern PyObject *CtlObj_New(ControlHandle);
 extern int CtlObj_Convert(PyObject *, ControlHandle *);
+#endif /* !__LP64__ */
 
 /* Dlg exports */
+#ifndef __LP64__
 extern PyObject *DlgObj_New(DialogPtr);
 extern int DlgObj_Convert(PyObject *, DialogPtr *);
 extern PyObject *DlgObj_WhichDialog(DialogPtr);
+#endif /* !__LP64__ */
 
 /* Drag exports */
+#ifndef __LP64__
 extern PyObject *DragObj_New(DragReference);
 extern int DragObj_Convert(PyObject *, DragReference *);
+#endif /* !__LP64__ */
 
 /* List exports */
+#ifndef __LP64__
 extern PyObject *ListObj_New(ListHandle);
 extern int ListObj_Convert(PyObject *, ListHandle *);
+#endif /* !__LP64__ */
 
 /* Menu exports */
+#ifndef __LP64__
 extern PyObject *MenuObj_New(MenuHandle);
 extern int MenuObj_Convert(PyObject *, MenuHandle *);
+#endif /* !__LP64__ */
 
 /* Qd exports */
+#ifndef __LP64__
 extern PyObject *GrafObj_New(GrafPtr);
 extern int GrafObj_Convert(PyObject *, GrafPtr *);
 extern PyObject *BMObj_New(BitMapPtr);
 extern int BMObj_Convert(PyObject *, BitMapPtr *);
 extern PyObject *QdRGB_New(RGBColor *);
 extern int QdRGB_Convert(PyObject *, RGBColor *);
+#endif /* !__LP64__ */
 
 /* Qdoffs exports */
+#ifndef __LP64__
 extern PyObject *GWorldObj_New(GWorldPtr);
 extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
+#endif /* !__LP64__ */
 
 /* Qt exports */
+#ifndef __LP64__
 extern PyObject *TrackObj_New(Track);
 extern int TrackObj_Convert(PyObject *, Track *);
 extern PyObject *MovieObj_New(Movie);
@@ -146,6 +166,7 @@
 extern int UserDataObj_Convert(PyObject *, UserData *);
 extern PyObject *MediaObj_New(Media);
 extern int MediaObj_Convert(PyObject *, Media *);
+#endif /* !__LP64__ */
 
 /* Res exports */
 extern PyObject *ResObj_New(Handle);
@@ -154,13 +175,17 @@
 extern int OptResObj_Convert(PyObject *, Handle *);
 
 /* TE exports */
+#ifndef __LP64__
 extern PyObject *TEObj_New(TEHandle);
 extern int TEObj_Convert(PyObject *, TEHandle *);
+#endif /* !__LP64__ */
 
 /* Win exports */
+#ifndef __LP64__
 extern PyObject *WinObj_New(WindowPtr);
 extern int WinObj_Convert(PyObject *, WindowPtr *);
 extern PyObject *WinObj_WhichWindow(WindowPtr);
+#endif /* !__LP64__ */
 
 /* CF exports */
 extern PyObject *CFObj_New(CFTypeRef);
--- Python/mactoolboxglue.c.orig	2006-07-12 02:44:25.000000000 +1000
+++ Python/mactoolboxglue.c	2009-09-10 19:26:39.000000000 +1000
@@ -105,7 +105,7 @@
 	return PyErr_Mac(PyMac_GetOSErrException(), err);
 }
 
-
+#ifndef __LP64__
 OSErr
 PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
 {
@@ -153,6 +153,7 @@
 	Py_XDECREF(fs);
 	return err;
 }
+#endif /* !__LP64__ */
 
 /* Convert a 4-char string object argument to an OSType value */
 int
@@ -417,6 +418,7 @@
 GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
 GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
 
+#ifndef __LP64__
 GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
 GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
 GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@@ -429,6 +431,7 @@
 GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
 GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
 GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
+#endif /* !__LP64__ */
 
 GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
 GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")
--- Modules/_ctypes/libffi/src/darwin/ffitarget.h.orig	2006-05-26 07:58:05.000000000 +1000
+++ Modules/_ctypes/libffi/src/darwin/ffitarget.h	2009-09-10 20:15:39.000000000 +1000
@@ -4,7 +4,7 @@
  * created by configure). This makes is possible to build a univeral binary
  * of ctypes in one go.
  */
-#if defined(__i386__)
+#if defined(__i386__) || defined(__x86_64__)
 
 #ifndef X86_DARWIN
 #define X86_DARWIN
@@ -13,7 +13,7 @@
 
 #include "../src/x86/ffitarget.h"
 
-#elif defined(__ppc__)
+#elif defined(__ppc__) || defined(__ppc64__)
 
 #ifndef POWERPC_DARWIN
 #define POWERPC_DARWIN
--- Mac/Modules/res/_Resmodule.c.orig	2005-07-04 06:59:44.000000000 +1000
+++ Mac/Modules/res/_Resmodule.c	2009-09-10 20:44:43.000000000 +1000
@@ -414,6 +414,7 @@
 	return _res;
 }
 
+#ifndef __LP64__
 static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
 {
 	PyObject *_res = NULL;
@@ -431,6 +432,7 @@
 	return _res;
 
 }
+#endif /* !__LP64__ */
 
 static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
 {
@@ -501,10 +503,12 @@
 	 PyDoc_STR("(long newSize) -> None")},
 	{"GetNextFOND", (PyCFunction)ResObj_GetNextFOND, 1,
 	 PyDoc_STR("() -> (Handle _rv)")},
+#ifndef __LP64__
 	{"as_Control", (PyCFunction)ResObj_as_Control, 1,
 	 PyDoc_STR("Return this resource/handle as a Control")},
 	{"as_Menu", (PyCFunction)ResObj_as_Menu, 1,
 	 PyDoc_STR("Return this resource/handle as a Menu")},
+#endif /* !__LP64__ */
 	{"LoadResource", (PyCFunction)ResObj_LoadResource, 1,
 	 PyDoc_STR("() -> None")},
 	{"AutoDispose", (PyCFunction)ResObj_AutoDispose, 1,
@@ -1152,6 +1156,7 @@
 	return _res;
 }
 
+#ifndef __LP64__
 static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
 {
 	PyObject *_res = NULL;
@@ -1287,6 +1292,7 @@
 	_res = Py_None;
 	return _res;
 }
+#endif /* !__LP64__ */
 
 static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
 {
@@ -1327,6 +1333,7 @@
 	return _res;
 }
 
+#ifndef __LP64__
 static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
 {
 	PyObject *_res = NULL;
@@ -1413,6 +1420,7 @@
 	                     nextRefNum);
 	return _res;
 }
+#endif /* !__LP64__ */
 
 static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
 {
@@ -1438,6 +1446,7 @@
 	return _res;
 }
 
+#ifndef __LP64__
 static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
 {
 	PyObject *_res = NULL;
@@ -1534,6 +1543,7 @@
 	                     PyMac_BuildFSSpec, &newSpec);
 	return _res;
 }
+#endif /* !__LP64__ */
 
 static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
 {
@@ -1637,6 +1647,7 @@
 	 PyDoc_STR("(short refNum) -> (short _rv)")},
 	{"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
 	 PyDoc_STR("(short refNum, short attrs) -> None")},
+#ifndef __LP64__
 	{"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
 	 PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")},
 	{"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
@@ -1647,10 +1658,12 @@
 	 PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")},
 	{"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
 	 PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
+#endif /* !__LP64__ */
 	{"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
 	 PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")},
 	{"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
 	 PyDoc_STR("(SInt16 refNum) -> None")},
+#ifndef __LP64__
 	{"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
 	 PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
 	{"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
@@ -1659,14 +1672,17 @@
 	 PyDoc_STR("() -> (SInt16 refNum)")},
 	{"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
 	 PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")},
+#endif /* !__LP64__ */
 	{"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
 	 PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")},
+#ifndef __LP64__
 	{"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
 	 PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")},
 	{"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
 	 PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
 	{"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
 	 PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")},
+#endif /* !__LP64__ */
 	{"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
 	 PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")},
 	{"Handle", (PyCFunction)Res_Handle, 1,
--- Mac/Modules/MacOS.c.orig	2006-07-26 05:20:54.000000000 +1000
+++ Mac/Modules/MacOS.c	2009-09-10 21:47:34.000000000 +1000
@@ -54,7 +54,7 @@
 do_close(rfobject *self)
 {
 	if (self->isclosed ) return;
-	(void)FSClose(self->fRefNum);
+	(void)FSCloseFork(self->fRefNum);
 	self->isclosed = 1;
 }
 
@@ -68,6 +68,7 @@
 	long n;
 	PyObject *v;
 	OSErr err;
+	ByteCount n2;
 	
 	if (self->isclosed) {
 		PyErr_SetString(PyExc_ValueError, "Operation on closed file");
@@ -81,13 +82,13 @@
 	if (v == NULL)
 		return NULL;
 		
-	err = FSRead(self->fRefNum, &n, PyString_AsString(v));
+	err = FSReadFork(self->fRefNum, fsAtMark, 0, n, PyString_AsString(v), &n2);
 	if (err && err != eofErr) {
 		PyMac_Error(err);
 		Py_DECREF(v);
 		return NULL;
 	}
-	_PyString_Resize(&v, n);
+	_PyString_Resize(&v, n2);
 	return v;
 }
 
@@ -109,7 +110,7 @@
 	}
 	if (!PyArg_ParseTuple(args, "s#", &buffer, &size))
 		return NULL;
-	err = FSWrite(self->fRefNum, &size, buffer);
+	err = FSWriteFork(self->fRefNum, fsAtMark, 0, size, buffer, NULL);
 	if (err) {
 		PyMac_Error(err);
 		return NULL;
@@ -126,9 +127,9 @@
 static PyObject *
 rf_seek(rfobject *self, PyObject *args)
 {
-	long amount, pos;
+	long amount;
 	int whence = SEEK_SET;
-	long eof;
+	int mode;
 	OSErr err;
 	
 	if (self->isclosed) {
@@ -138,35 +139,23 @@
 	if (!PyArg_ParseTuple(args, "l|i", &amount, &whence))
 		return NULL;
 	
-	if ((err = GetEOF(self->fRefNum, &eof)))
-		goto ioerr;
-	
 	switch (whence) {
 	case SEEK_CUR:
-		if ((err = GetFPos(self->fRefNum, &pos)))
-			goto ioerr; 
+		mode = fsFromMark;
 		break;
 	case SEEK_END:
-		pos = eof;
+		mode = fsFromLEOF;
 		break;
 	case SEEK_SET:
-		pos = 0;
+		mode = fsFromStart;
 		break;
 	default:
 		PyErr_BadArgument();
 		return NULL;
 	}
 	
-	pos += amount;
-	
-	/* Don't bother implementing seek past EOF */
-	if (pos > eof || pos < 0) {
-		PyErr_BadArgument();
-		return NULL;
-	}
-	
-	if ((err = SetFPos(self->fRefNum, fsFromStart, pos)) ) {
-ioerr:
+	err = FSSetForkPosition(self->fRefNum, mode, amount);
+	if (err != noErr) {
 		PyMac_Error(err);
 		return NULL;
 	}
@@ -182,7 +171,7 @@
 static PyObject *
 rf_tell(rfobject *self, PyObject *args)
 {
-	long where;
+	long long where;
 	OSErr err;
 	
 	if (self->isclosed) {
@@ -191,11 +180,13 @@
 	}
 	if (!PyArg_ParseTuple(args, ""))
 		return NULL;
-	if ((err = GetFPos(self->fRefNum, &where)) ) {
+	
+	err = FSGetForkPosition(self->fRefNum, &where);
+	if (err != noErr) {
 		PyMac_Error(err);
 		return NULL;
 	}
-	return PyInt_FromLong(where);
+	return PyLong_FromLongLong(where);
 }
 
 static char rf_close__doc__[] = 
@@ -292,17 +283,61 @@
 static PyObject *
 MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
 {
-	FSSpec fss;
-	FInfo info;
 	PyObject *creator, *type, *res;
 	OSErr err;
-	
-	if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
+	FSRef ref;
+	FSCatalogInfo	cataloginfo;
+	FileInfo* finfo;
+
+	if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSRef, &ref)) {
+#ifndef __LP64__
+		/* This function is documented to take an FSSpec as well,
+		 * which only works in 32-bit mode.
+		 */
+		PyErr_Clear();
+		FSSpec fss;
+		FInfo info;
+
+		if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
+			return NULL;
+
+		if ((err = FSpGetFInfo(&fss, &info)) != noErr) {
+			return PyErr_Mac(MacOS_Error, err);
+		}
+		creator = PyString_FromStringAndSize(
+				(char *)&info.fdCreator, 4);
+		type = PyString_FromStringAndSize((char *)&info.fdType, 4);
+		res = Py_BuildValue("OO", creator, type);
+		Py_DECREF(creator);
+		Py_DECREF(type);
+		return res;
+#else	/* __LP64__ */
+		return NULL;
+#endif	/* __LP64__ */
+	}
+
+	err = FSGetCatalogInfo(&ref, 
+			kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo, 
+			NULL, NULL, NULL);
+	if (err != noErr) {
+		PyErr_Mac(MacOS_Error, err);
 		return NULL;
-	if ((err = FSpGetFInfo(&fss, &info)) != noErr)
-		return PyErr_Mac(MacOS_Error, err);
-	creator = PyString_FromStringAndSize((char *)&info.fdCreator, 4);
-	type = PyString_FromStringAndSize((char *)&info.fdType, 4);
+	}
+
+	if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
+		/* Directory: doesn't have type/creator info.
+		 *
+		 * The specific error code is for backward compatibility with
+		 * earlier versions.
+		 */
+		PyErr_Mac(MacOS_Error, fnfErr);
+		return NULL;
+
+	} 
+	finfo = (FileInfo*)&(cataloginfo.finderInfo);
+	creator = PyString_FromStringAndSize((char*)&(finfo->fileCreator), 4);
+	type = PyString_FromStringAndSize((char*)&(finfo->fileType), 4);
+
 	res = Py_BuildValue("OO", creator, type);
 	Py_DECREF(creator);
 	Py_DECREF(type);
@@ -314,20 +349,66 @@
 static PyObject *
 MacOS_SetCreatorAndType(PyObject *self, PyObject *args)
 {
-	FSSpec fss;
 	ResType creator, type;
-	FInfo info;
+	FSRef ref;
+	FileInfo* finfo;
 	OSErr err;
-	
+	FSCatalogInfo	cataloginfo;
+
 	if (!PyArg_ParseTuple(args, "O&O&O&",
+			PyMac_GetFSRef, &ref, PyMac_GetOSType, &creator, PyMac_GetOSType, &type)) {
+#ifndef __LP64__
+		/* Try to handle FSSpec arguments, for backward compatibility */
+		FSSpec fss;
+		FInfo info;
+
+		if (!PyArg_ParseTuple(args, "O&O&O&",
 			PyMac_GetFSSpec, &fss, PyMac_GetOSType, &creator, PyMac_GetOSType, &type))
+			return NULL;
+
+		if ((err = FSpGetFInfo(&fss, &info)) != noErr)
+			return PyErr_Mac(MacOS_Error, err);
+
+		info.fdCreator = creator;
+		info.fdType = type;
+
+		if ((err = FSpSetFInfo(&fss, &info)) != noErr)
+			return PyErr_Mac(MacOS_Error, err);
+		Py_INCREF(Py_None);
+		return Py_None;
+#else /* __LP64__ */
+		return NULL;
+#endif /* __LP64__ */
+	}
+	
+	err = FSGetCatalogInfo(&ref, 
+			kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo, 
+			NULL, NULL, NULL);
+	if (err != noErr) {
+		PyErr_Mac(MacOS_Error, err);
 		return NULL;
-	if ((err = FSpGetFInfo(&fss, &info)) != noErr)
-		return PyErr_Mac(MacOS_Error, err);
-	info.fdCreator = creator;
-	info.fdType = type;
-	if ((err = FSpSetFInfo(&fss, &info)) != noErr)
-		return PyErr_Mac(MacOS_Error, err);
+	}
+
+	if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
+		/* Directory: doesn't have type/creator info.
+		 *
+		 * The specific error code is for backward compatibility with
+		 * earlier versions.
+		 */
+		PyErr_Mac(MacOS_Error, fnfErr);
+		return NULL;
+
+	} 
+	finfo = (FileInfo*)&(cataloginfo.finderInfo);
+	finfo->fileCreator = creator;
+	finfo->fileType = type;
+
+	err = FSSetCatalogInfo(&ref, kFSCatInfoFinderInfo, &cataloginfo);
+	if (err != noErr) {
+		PyErr_Mac(MacOS_Error, fnfErr);
+		return NULL;
+	}
+
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -399,6 +480,7 @@
 	return Py_BuildValue("s", buf);
 }
 
+#ifndef __LP64__
 static char splash_doc[] = "Open a splash-screen dialog by resource-id (0=close)";
 
 static PyObject *
@@ -470,6 +552,7 @@
 	Py_INCREF(Py_None);
 	return Py_None;
 }
+#endif /* !__LP64__ */
 
 static char WMAvailable_doc[] = 
 	"True if this process can interact with the display."
@@ -530,17 +613,18 @@
 {
 	OSErr err;
 	char *mode = "r";
-	FSSpec fss;
-	SignedByte permission = 1;
+	FSRef ref;
+	SInt8 permission = fsRdPerm;
 	rfobject *fp;
+	HFSUniStr255 name;
 		
-	if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSSpec, &fss, &mode))
+	if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSRef, &ref, &mode))
 		return NULL;
 	while (*mode) {
 		switch (*mode++) {
 		case '*': break;
-		case 'r': permission = 1; break;
-		case 'w': permission = 2; break;
+		case 'r': permission = fsRdPerm; break;
+		case 'w': permission = fsWrPerm; break;
 		case 'b': break;
 		default:
 			PyErr_BadArgument();
@@ -548,33 +632,18 @@
 		}
 	}
 	
-	if ( (fp = newrfobject()) == NULL )
+	err = FSGetResourceForkName(&name);
+	if (err != noErr) {
+		PyMac_Error(err);
 		return NULL;
+	}
 		
-	err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
+	if ( (fp = newrfobject()) == NULL )
+		return NULL;
+
 	
-	if ( err == fnfErr ) {
-		/* In stead of doing complicated things here to get creator/type
-		** correct we let the standard i/o library handle it
-		*/
-		FILE *tfp;
-		char pathname[PATHNAMELEN];
-		
-		if ( (err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN)) ) {
-			PyMac_Error(err);
-			Py_DECREF(fp);
-			return NULL;
-		}
-		
-		if ( (tfp = fopen(pathname, "w")) == NULL ) {
-			PyMac_Error(fnfErr); /* What else... */
-			Py_DECREF(fp);
-			return NULL;
-		}
-		fclose(tfp);
-		err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
-	}
-	if ( err ) {
+	err = FSOpenFork(&ref, name.length, name.unicode, permission, &fp->fRefNum);
+	if (err != noErr) {
 		Py_DECREF(fp);
 		PyMac_Error(err);
 		return NULL;
@@ -589,10 +658,12 @@
 	{"SetCreatorAndType",		MacOS_SetCreatorAndType, 1,	setcrtp_doc},
 	{"GetErrorString",		MacOS_GetErrorString,	1,	geterr_doc},
 	{"openrf",			MacOS_openrf, 		1, 	openrf_doc},
+#ifndef __LP64__
 	{"splash",			MacOS_splash,		1, 	splash_doc},
 	{"DebugStr",			MacOS_DebugStr,		1,	DebugStr_doc},
-	{"GetTicks",			MacOS_GetTicks,		1,	GetTicks_doc},
 	{"SysBeep",			MacOS_SysBeep,		1,	SysBeep_doc},
+#endif /* !__LP64__ */
+	{"GetTicks",			MacOS_GetTicks,		1,	GetTicks_doc},
 	{"WMAvailable",			MacOS_WMAvailable,		1,	WMAvailable_doc},
 	{NULL,				NULL}		 /* Sentinel */
 };
--- Mac/Modules/file/_Filemodule.c.orig	2006-05-29 07:57:35.000000000 +1000
+++ Mac/Modules/file/_Filemodule.c	2009-09-10 22:48:47.000000000 +1000
@@ -18,9 +18,11 @@
 #include <Carbon/Carbon.h>
 
 #ifdef USE_TOOLBOX_OBJECT_GLUE
+#ifndef __LP64__
 extern int _PyMac_GetFSSpec(PyObject *v, FSSpec *spec);
-extern int _PyMac_GetFSRef(PyObject *v, FSRef *fsr);
 extern PyObject *_PyMac_BuildFSSpec(FSSpec *spec);
+#endif /* !__LP64__ */
+extern int _PyMac_GetFSRef(PyObject *v, FSRef *fsr);
 extern PyObject *_PyMac_BuildFSRef(FSRef *spec);
 
 #define PyMac_GetFSSpec _PyMac_GetFSSpec
@@ -28,20 +30,26 @@
 #define PyMac_BuildFSSpec _PyMac_BuildFSSpec
 #define PyMac_BuildFSRef _PyMac_BuildFSRef
 #else
+#ifndef __LP64__
 extern int PyMac_GetFSSpec(PyObject *v, FSSpec *spec);
-extern int PyMac_GetFSRef(PyObject *v, FSRef *fsr);
 extern PyObject *PyMac_BuildFSSpec(FSSpec *spec);
+#endif /* !__LP64__ */
+extern int PyMac_GetFSRef(PyObject *v, FSRef *fsr);
 extern PyObject *PyMac_BuildFSRef(FSRef *spec);
 #endif
 
 /* Forward declarations */
+#ifndef __LP64__
 static PyObject *FInfo_New(FInfo *itself);
-static PyObject *FSRef_New(FSRef *itself);
 static PyObject *FSSpec_New(FSSpec *itself);
+#define FSSpec_Convert PyMac_GetFSSpec
+#endif /* !__LP64__ */
+static PyObject *FSRef_New(FSRef *itself);
 static PyObject *Alias_New(AliasHandle itself);
+#ifndef __LP64__
 static int FInfo_Convert(PyObject *v, FInfo *p_itself);
+#endif /* !__LP64__ */
 #define FSRef_Convert PyMac_GetFSRef
-#define FSSpec_Convert PyMac_GetFSSpec
 static int Alias_Convert(PyObject *v, AliasHandle *p_itself);
 
 /*
@@ -62,6 +70,7 @@
 /*
 ** Optional fsspec and fsref pointers. None will pass NULL
 */
+#ifndef __LP64__
 static int
 myPyMac_GetOptFSSpecPtr(PyObject *v, FSSpec **spec)
 {
@@ -71,6 +80,7 @@
         }
         return PyMac_GetFSSpec(v, *spec);
 }
+#endif /* !__LP64__ */
 
 static int
 myPyMac_GetOptFSRefPtr(PyObject *v, FSRef **ref)
@@ -92,6 +102,7 @@
         return Py_BuildValue("u#", itself->unicode, itself->length);
 }
 
+#ifndef __LP64__
 static OSErr
 _PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
 {
@@ -135,6 +146,7 @@
 	}
 	return 0;
 }
+#endif /* !__LP64__ */
 
 
 static PyObject *File_Error;
@@ -282,12 +294,28 @@
 
 static PyObject *FSCatalogInfo_get_permissions(FSCatalogInfoObject *self, void *closure)
 {
-	return Py_BuildValue("(llll)", self->ob_itself.permissions[0], self->ob_itself.permissions[1], self->ob_itself.permissions[2], self->ob_itself.permissions[3]);
+	FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions);
+	return Py_BuildValue("(llll)", info->userID, info->groupID, info->userAccess, info->mode);
 }
 
 static int FSCatalogInfo_set_permissions(FSCatalogInfoObject *self, PyObject *v, void *closure)
 {
-	return PyArg_Parse(v, "(llll)", &self->ob_itself.permissions[0], &self->ob_itself.permissions[1], &self->ob_itself.permissions[2], &self->ob_itself.permissions[3])-1;
+	long userID;
+	long groupID;
+	long userAccess;
+	long mode;
+	int r;
+
+	FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions);
+
+	r = PyArg_Parse(v, "(llll)", &userID, &groupID, &userAccess, &mode);
+	if (!r) {
+		return -1;
+	}
+	info->userID = userID;
+	info->groupID = groupID;
+	info->userAccess = userAccess;
+	info->mode = mode;
 	return 0;
 }
 
@@ -501,6 +529,7 @@
 
 /* ----------------------- Object type FInfo ------------------------ */
 
+#ifndef __LP64__
 static PyTypeObject FInfo_Type;
 
 #define FInfo_Check(x) ((x)->ob_type == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type))
@@ -682,6 +711,7 @@
 	FInfo_tp_free, /* tp_free */
 };
 
+#endif /* !__LP64__ */
 /* --------------------- End object type FInfo ---------------------- */
 
 
@@ -729,6 +759,7 @@
 	self->ob_type->tp_free((PyObject *)self);
 }
 
+#ifndef __LP64__
 static PyObject *Alias_ResolveAlias(AliasObject *_self, PyObject *_args)
 {
 	PyObject *_res = NULL;
@@ -818,6 +849,7 @@
 	                     wasChanged);
 	return _res;
 }
+#endif /* !__LP64__ */
 
 static PyObject *Alias_FSResolveAliasWithMountFlags(AliasObject *_self, PyObject *_args)
 {
@@ -891,6 +923,7 @@
 }
 
 static PyMethodDef Alias_methods[] = {
+#ifndef __LP64__
 	{"ResolveAlias", (PyCFunction)Alias_ResolveAlias, 1,
 	 PyDoc_STR("(FSSpec fromFile) -> (FSSpec target, Boolean wasChanged)")},
 	{"GetAliasInfo", (PyCFunction)Alias_GetAliasInfo, 1,
@@ -899,6 +932,7 @@
 	 PyDoc_STR("(FSSpec fromFile, unsigned long mountFlags) -> (FSSpec target, Boolean wasChanged)")},
 	{"FollowFinderAlias", (PyCFunction)Alias_FollowFinderAlias, 1,
 	 PyDoc_STR("(FSSpec fromFile, Boolean logon) -> (FSSpec target, Boolean wasChanged)")},
+#endif /* !__LP64__ */
 	{"FSResolveAliasWithMountFlags", (PyCFunction)Alias_FSResolveAliasWithMountFlags, 1,
 	 PyDoc_STR("(FSRef fromFile, unsigned long mountFlags) -> (FSRef target, Boolean wasChanged)")},
 	{"FSResolveAlias", (PyCFunction)Alias_FSResolveAlias, 1,
@@ -1033,6 +1067,7 @@
 
 
 /* ----------------------- Object type FSSpec ----------------------- */
+#ifndef __LP64__
 
 static PyTypeObject FSSpec_Type;
 
@@ -1488,6 +1523,7 @@
 	FSSpec_tp_free, /* tp_free */
 };
 
+#endif /* !__LP64__ */
 /* --------------------- End object type FSSpec --------------------- */
 
 
@@ -1568,7 +1604,9 @@
 	FSCatalogInfoBitmap whichInfo;
 	FSCatalogInfo catalogInfo;
 	FSRef newRef;
+#ifndef __LP64__
 	FSSpec newSpec;
+#endif /* !__LP64__ */
 	if (!PyArg_ParseTuple(_args, "u#lO&",
 	                      &nameLength__in__, &nameLength__in_len__,
 	                      &whichInfo,
@@ -1580,11 +1618,20 @@
 	                           whichInfo,
 	                           &catalogInfo,
 	                           &newRef,
-	                           &newSpec);
+#ifndef __LP64__
+	                           &newSpec
+#else
+                               NULL
+#endif /* !__LP64__ */
+	                           );
 	if (_err != noErr) return PyMac_Error(_err);
+#ifndef __LP64__
 	_res = Py_BuildValue("O&O&",
 	                     FSRef_New, &newRef,
 	                     FSSpec_New, &newSpec);
+#else
+    _res = Py_BuildValue("O&O", FSRef_New, &newRef, Py_None);
+#endif /* !__LP64__ */
 	return _res;
 }
 
@@ -1598,7 +1645,9 @@
 	FSCatalogInfoBitmap whichInfo;
 	FSCatalogInfo catalogInfo;
 	FSRef newRef;
+#ifndef __LP64__
 	FSSpec newSpec;
+#endif /* !__LP64__ */
 	UInt32 newDirID;
 	if (!PyArg_ParseTuple(_args, "u#lO&",
 	                      &nameLength__in__, &nameLength__in_len__,
@@ -1611,13 +1660,25 @@
 	                                whichInfo,
 	                                &catalogInfo,
 	                                &newRef,
+#ifndef __LP64__
 	                                &newSpec,
+#else
+                                    NULL,
+#endif /* !__LP64__ */
 	                                &newDirID);
 	if (_err != noErr) return PyMac_Error(_err);
+	
+#ifndef __LP64__
 	_res = Py_BuildValue("O&O&l",
 	                     FSRef_New, &newRef,
 	                     FSSpec_New, &newSpec,
 	                     newDirID);
+#else
+    _res = Py_BuildValue("O&Ol",
+	                     FSRef_New, &newRef,
+	                     Py_None,
+	                     newDirID);
+#endif /* !__LP64__ */
 	return _res;
 }
 
@@ -1699,7 +1760,9 @@
 	FSCatalogInfoBitmap whichInfo;
 	FSCatalogInfo catalogInfo;
 	HFSUniStr255 outName;
+#ifndef __LP64__
 	FSSpec fsSpec;
+#endif /* !__LP64__ */
 	FSRef parentRef;
 	if (!PyArg_ParseTuple(_args, "l",
 	                      &whichInfo))
@@ -1708,14 +1771,26 @@
 	                        whichInfo,
 	                        &catalogInfo,
 	                        &outName,
+#ifndef __LP64__
 	                        &fsSpec,
+#else
+                            NULL,
+#endif /* !__LP64__ */
 	                        &parentRef);
 	if (_err != noErr) return PyMac_Error(_err);
+#ifndef __LP64__
 	_res = Py_BuildValue("O&O&O&O&",
 	                     FSCatalogInfo_New, &catalogInfo,
 	                     PyMac_BuildHFSUniStr255, &outName,
 	                     FSSpec_New, &fsSpec,
 	                     FSRef_New, &parentRef);
+#else
+    _res = Py_BuildValue("O&O&OO&",
+	                     FSCatalogInfo_New, &catalogInfo,
+	                     PyMac_BuildHFSUniStr255, &outName,
+	                     Py_None,
+	                     FSRef_New, &parentRef);
+#endif /* !__LP64__ */
 	return _res;
 }
 
@@ -1784,7 +1859,7 @@
 	UniCharCount forkNameLength__len__;
 	int forkNameLength__in_len__;
 	SInt8 permissions;
-	SInt16 forkRefNum;
+	FSIORefNum forkRefNum;
 	if (!PyArg_ParseTuple(_args, "u#b",
 	                      &forkNameLength__in__, &forkNameLength__in_len__,
 	                      &permissions))
@@ -2034,7 +2109,7 @@
 
 /* --------------------- End object type FSRef ---------------------- */
 
-
+#ifndef __LP64__
 static PyObject *File_UnmountVol(PyObject *_self, PyObject *_args)
 {
 	PyObject *_res = NULL;
@@ -2562,6 +2637,7 @@
 	                     FSSpec_New, &spec);
 	return _res;
 }
+#endif /* !__LP64__ */
 
 static PyObject *File_FSGetForkPosition(PyObject *_self, PyObject *_args)
 {
@@ -2785,6 +2861,7 @@
 	return _res;
 }
 
+#ifndef __LP64__
 static PyObject *File_NewAlias(PyObject *_self, PyObject *_args)
 {
 	PyObject *_res = NULL;
@@ -2933,6 +3010,7 @@
 	                     wasAliased);
 	return _res;
 }
+#endif /* !__LP64__ */
 
 static PyObject *File_FSNewAlias(PyObject *_self, PyObject *_args)
 {
@@ -3050,6 +3128,7 @@
 }
 
 static PyMethodDef File_methods[] = {
+#ifndef __LP64__
 	{"UnmountVol", (PyCFunction)File_UnmountVol, 1,
 	 PyDoc_STR("(Str63 volName, short vRefNum) -> None")},
 	{"FlushVol", (PyCFunction)File_FlushVol, 1,
@@ -3100,6 +3179,7 @@
 	 PyDoc_STR("(short vRefNum, long dirID, Str255 oldName, long newDirID, Str255 newName) -> None")},
 	{"FSMakeFSSpec", (PyCFunction)File_FSMakeFSSpec, 1,
 	 PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> (FSSpec spec)")},
+#endif /* !__LP64__ */
 	{"FSGetForkPosition", (PyCFunction)File_FSGetForkPosition, 1,
 	 PyDoc_STR("(SInt16 forkRefNum) -> (SInt64 position)")},
 	{"FSSetForkPosition", (PyCFunction)File_FSSetForkPosition, 1,
@@ -3124,6 +3204,7 @@
 	 PyDoc_STR("(UInt8 * path, FNMessage message, OptionBits flags) -> None")},
 	{"FNNotifyAll", (PyCFunction)File_FNNotifyAll, 1,
 	 PyDoc_STR("(FNMessage message, OptionBits flags) -> None")},
+#ifndef __LP64__
 	{"NewAlias", (PyCFunction)File_NewAlias, 1,
 	 PyDoc_STR("(FSSpec fromFile, FSSpec target) -> (AliasHandle alias)")},
 	{"NewAliasMinimalFromFullPath", (PyCFunction)File_NewAliasMinimalFromFullPath, 1,
@@ -3136,6 +3217,7 @@
 	 PyDoc_STR("(FSSpec fromFile, FSSpec target, AliasHandle alias) -> (Boolean wasChanged)")},
 	{"ResolveAliasFileWithMountFlagsNoUI", (PyCFunction)File_ResolveAliasFileWithMountFlagsNoUI, 1,
 	 PyDoc_STR("(FSSpec theSpec, Boolean resolveAliasChains, unsigned long mountFlags) -> (FSSpec theSpec, Boolean targetIsFolder, Boolean wasAliased)")},
+#endif /* !__LP64__ */
 	{"FSNewAlias", (PyCFunction)File_FSNewAlias, 1,
 	 PyDoc_STR("(FSRef fromFile, FSRef target) -> (AliasHandle inAlias)")},
 	{"FSResolveAliasFileWithMountFlags", (PyCFunction)File_FSResolveAliasFileWithMountFlags, 1,
@@ -3150,7 +3232,7 @@
 };
 
 
-
+#ifndef __LP64__
 int
 PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
 {
@@ -3188,12 +3270,15 @@
         }
         return 0;
 }
+#endif /* !__LP64__ */
 
 int
 PyMac_GetFSRef(PyObject *v, FSRef *fsr)
 {
         OSStatus err;
+#ifndef __LP64__
         FSSpec fss;
+#endif /* !__LP64__ */
 
         if (FSRef_Check(v)) {
                 *fsr = ((FSRefObject *)v)->ob_itself;
@@ -3211,6 +3296,7 @@
                 return !err;
         }
         /* XXXX Should try unicode here too */
+#ifndef __LP64__
         /* Otherwise we try to go via an FSSpec */
         if (FSSpec_Check(v)) {
                 fss = ((FSSpecObject *)v)->ob_itself;
@@ -3219,15 +3305,18 @@
                 PyMac_Error(err);
                 return 0;
         }
+#endif /* !__LP64__ */
         PyErr_SetString(PyExc_TypeError, "FSRef, FSSpec or pathname required");
         return 0;
 }
 
+#ifndef __LP64__
 extern PyObject *
 PyMac_BuildFSSpec(FSSpec *spec)
 {
         return FSSpec_New(spec);
 }
+#endif /* !__LP64__ */
 
 extern PyObject *
 PyMac_BuildFSRef(FSRef *spec)
@@ -3242,10 +3331,11 @@
 	PyObject *d;
 
 
-
+#ifndef __LP64__
 	PyMac_INIT_TOOLBOX_OBJECT_NEW(FSSpec *, PyMac_BuildFSSpec);
-	PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef);
 	PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSSpec, PyMac_GetFSSpec);
+#endif /* !__LP64__ */
+    PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef);
 	PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSRef, PyMac_GetFSRef);
 
 
@@ -3262,6 +3352,7 @@
 	/* Backward-compatible name */
 	Py_INCREF(&FSCatalogInfo_Type);
 	PyModule_AddObject(m, "FSCatalogInfoType", (PyObject *)&FSCatalogInfo_Type);
+#ifndef __LP64__
 	FInfo_Type.ob_type = &PyType_Type;
 	if (PyType_Ready(&FInfo_Type) < 0) return;
 	Py_INCREF(&FInfo_Type);
@@ -3269,6 +3360,7 @@
 	/* Backward-compatible name */
 	Py_INCREF(&FInfo_Type);
 	PyModule_AddObject(m, "FInfoType", (PyObject *)&FInfo_Type);
+#endif /* !__LP64__ */
 	Alias_Type.ob_type = &PyType_Type;
 	if (PyType_Ready(&Alias_Type) < 0) return;
 	Py_INCREF(&Alias_Type);
@@ -3276,6 +3368,7 @@
 	/* Backward-compatible name */
 	Py_INCREF(&Alias_Type);
 	PyModule_AddObject(m, "AliasType", (PyObject *)&Alias_Type);
+#ifndef __LP64__
 	FSSpec_Type.ob_type = &PyType_Type;
 	if (PyType_Ready(&FSSpec_Type) < 0) return;
 	Py_INCREF(&FSSpec_Type);
@@ -3283,6 +3376,7 @@
 	/* Backward-compatible name */
 	Py_INCREF(&FSSpec_Type);
 	PyModule_AddObject(m, "FSSpecType", (PyObject *)&FSSpec_Type);
+#endif /* !__LP64__ */
 	FSRef_Type.ob_type = &PyType_Type;
 	if (PyType_Ready(&FSRef_Type) < 0) return;
 	Py_INCREF(&FSRef_Type);
Index: Lib/plat-mac/macresource.py
===================================================================
--- Lib/plat-mac/macresource.py	(revision 74680)
+++ Lib/plat-mac/macresource.py	(revision 74681)
@@ -79,8 +79,8 @@
     AppleSingle file"""
     try:
         refno = Res.FSpOpenResFile(pathname, 1)
-    except Res.Error, arg:
-        if arg[0] in (-37, -39):
+    except (AttributeError, Res.Error), arg:
+        if isinstance(arg, AttributeError) or arg[0] in (-37, -39):
             # No resource fork. We may be on OSX, and this may be either
             # a data-fork based resource file or a AppleSingle file
             # from the CVS repository.
@@ -106,8 +106,8 @@
     try:
         refno = Res.FSpOpenResFile(pathname, 1)
         Res.CloseResFile(refno)
-    except Res.Error, arg:
-        if arg[0] in (-37, -39):
+    except (AttributeError, Res.Error), arg:
+        if isinstance(arg, AttributeError) or arg[0] in (-37, -39):
             # No resource fork. We may be on OSX, and this may be either
             # a data-fork based resource file or a AppleSingle file
             # from the CVS repository.
Index: Lib/plat-mac/applesingle.py
===================================================================
--- Lib/plat-mac/applesingle.py	(revision 74680)
+++ Lib/plat-mac/applesingle.py	(revision 74681)
@@ -119,8 +119,13 @@
     if not hasattr(infile, 'read'):
         if isinstance(infile, Carbon.File.Alias):
             infile = infile.ResolveAlias()[0]
-        if isinstance(infile, (Carbon.File.FSSpec, Carbon.File.FSRef)):
-            infile = infile.as_pathname()
+
+        if hasattr(Carbon.File, "FSSpec"):
+            if isinstance(infile, (Carbon.File.FSSpec, Carbon.File.FSRef)):
+                infile = infile.as_pathname()
+        else:
+            if isinstance(infile, Carbon.File.FSRef):
+                infile = infile.as_pathname()
         infile = open(infile, 'rb')
 
     asfile = AppleSingle(infile, verbose=verbose)
Index: Mac/scripts/BuildApplet.py
===================================================================
--- Mac/scripts/BuildApplet.py	(revision 74680)
+++ Mac/scripts/BuildApplet.py	(revision 74681)
@@ -12,7 +12,10 @@
 
 import os
 import MacOS
-import EasyDialogs
+try:
+    import EasyDialogs
+except ImportError:
+    EasyDialogs = None
 import buildtools
 import getopt
 
@@ -32,7 +35,10 @@
     try:
         buildapplet()
     except buildtools.BuildError, detail:
-        EasyDialogs.Message(detail)
+        if EasyDialogs is None:
+            print detail
+        else:
+            EasyDialogs.Message(detail)
 
 
 def buildapplet():
@@ -46,6 +52,10 @@
     # Ask for source text if not specified in sys.argv[1:]
 
     if not sys.argv[1:]:
+        if EasyDialogs is None:
+            usage()
+            sys.exit(1)
+
         filename = EasyDialogs.AskFileForOpen(message='Select Python source or applet:',
                 typeList=('TEXT', 'APPL'))
         if not filename:
Index: Lib/plat-mac/buildtools.py
===================================================================
--- Lib/plat-mac/buildtools.py	(revision 74680)
+++ Lib/plat-mac/buildtools.py	(revision 74681)
@@ -15,7 +15,10 @@
 import MacOS
 import macostools
 import macresource
-import EasyDialogs
+try:
+    import EasyDialogs
+except ImportError:
+    EasyDialogs = None
 import shutil
 
 
@@ -67,9 +70,13 @@
         rsrcname=None, others=[], raw=0, progress="default", destroot=""):
 
     if progress == "default":
-        progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120)
-        progress.label("Compiling...")
-        progress.inc(0)
+        if EasyDialogs is None:
+            print "Compiling %s"%(os.path.split(filename)[1],)
+            process = None
+        else:
+            progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120)
+            progress.label("Compiling...")
+            progress.inc(0)
     # check for the script name being longer than 32 chars. This may trigger a bug
     # on OSX that can destroy your sourcefile.
     if '#' in os.path.split(filename)[1]:
@@ -119,7 +126,11 @@
     if MacOS.runtimemodel == 'macho':
         raise BuildError, "No updating yet for MachO applets"
     if progress:
-        progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120)
+        if EasyDialogs is None:
+            print "Updating %s"%(os.path.split(filename)[1],)
+            progress = None
+        else:
+            progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120)
     else:
         progress = None
     if not output: