mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Getting rid of code conditional on TARGET_API_MAC_*.
This commit is contained in:
		
							parent
							
								
									9588770e25
								
							
						
					
					
						commit
						a53f4eba19
					
				
					 18 changed files with 2 additions and 748 deletions
				
			
		|  | @ -225,32 +225,10 @@ def getargsCheck(self, name): | |||
| 		return 1; | ||||
| 	} | ||||
| 	PyErr_Clear(); | ||||
| #if !TARGET_API_MAC_OSX | ||||
| 	/* On OS9 we now try a pathname */ | ||||
| 	if ( PyString_Check(v) ) { | ||||
| 		/* It's a pathname */ | ||||
| 		if( !PyArg_Parse(v, "O&", PyMac_GetStr255, &path) ) | ||||
| 			return 0; | ||||
| 		refnum = 0; /* XXXX Should get CurWD here?? */ | ||||
| 		parid = 0; | ||||
| 		err = FSMakeFSSpec(refnum, parid, path, spec); | ||||
| 		if ( err && err != fnfErr ) { | ||||
| 			PyMac_Error(err); | ||||
| 			return 0; | ||||
| 		} | ||||
| 		return 1; | ||||
| 	} | ||||
| 	PyErr_Clear(); | ||||
| #endif | ||||
| 	/* Otherwise we try to go via an FSRef. On OSX we go all the way, | ||||
| 	** on OS9 we accept only a real FSRef object | ||||
| 	*/ | ||||
| #if TARGET_API_MAC_OSX | ||||
| 	if ( PyMac_GetFSRef(v, &fsr) ) { | ||||
| #else | ||||
| 	if (FSRef_Check(v)) { | ||||
| 		fsr = ((FSRefObject *)v)->ob_itself; | ||||
| #endif	 | ||||
| 		err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL); | ||||
| 		if (err != noErr) { | ||||
| 			PyMac_Error(err); | ||||
|  | @ -258,9 +236,6 @@ def getargsCheck(self, name): | |||
| 		} | ||||
| 		return 1; | ||||
| 	} | ||||
| #if !TARGET_API_MAC_OSX | ||||
| 	PyErr_SetString(PyExc_TypeError, "FSSpec, FSRef, pathname or (refnum, parid, path) required"); | ||||
| #endif | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
|  | @ -275,7 +250,6 @@ def getargsCheck(self, name): | |||
| 		return 1; | ||||
| 	} | ||||
| 
 | ||||
| #if TARGET_API_MAC_OSX | ||||
| 	/* On OSX we now try a pathname */ | ||||
| 	if ( PyString_Check(v) || PyUnicode_Check(v)) { | ||||
| 		char *path = NULL; | ||||
|  | @ -288,14 +262,9 @@ def getargsCheck(self, name): | |||
| 		return 1; | ||||
| 	} | ||||
| 	/* XXXX Should try unicode here too */ | ||||
| #endif | ||||
| 	/* Otherwise we try to go via an FSSpec */ | ||||
| #if TARGET_API_MAC_OSX | ||||
| 	if (FSSpec_Check(v)) { | ||||
| 		fss = ((FSSpecObject *)v)->ob_itself; | ||||
| #else | ||||
| 	if (PyMac_GetFSSpec(v, &fss)) { | ||||
| #endif | ||||
| 		if ((err=FSpMakeFSRef(&fss, fsr)) == 0) | ||||
| 			return 1; | ||||
| 		PyMac_Error(err); | ||||
|  | @ -814,26 +783,9 @@ def parseArgumentList(self, args): | |||
| fsref_methods.append(f) | ||||
| 
 | ||||
| FSRef_as_pathname_body = """ | ||||
| #if TARGET_API_MAC_OSX | ||||
| if (!PyArg_ParseTuple(_args, "")) | ||||
| 	return NULL; | ||||
| _res = FSRef_FSRefMakePath(_self, _args); | ||||
| #else | ||||
| char strbuf[1024]; | ||||
| OSErr err; | ||||
| FSSpec fss; | ||||
| 
 | ||||
| if (!PyArg_ParseTuple(_args, "")) | ||||
| 	return NULL; | ||||
| if ( !PyMac_GetFSSpec((PyObject *)_self, &fss)) | ||||
| 	return NULL; | ||||
| err = PyMac_GetFullPathname(&fss, strbuf, sizeof(strbuf)); | ||||
| if ( err ) { | ||||
| 	PyMac_Error(err); | ||||
| 	return NULL; | ||||
| } | ||||
| _res = PyString_FromString(strbuf); | ||||
| #endif | ||||
| return _res; | ||||
| """ | ||||
| f = ManualGenerator("as_pathname", FSRef_as_pathname_body) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jack Jansen
						Jack Jansen