mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Use typeFloat for all floating point values. The previously used
typeExtended was a Think-ism that must have stopped working years and years ago without anyone noticing.
This commit is contained in:
		
							parent
							
								
									ca74da4e2c
								
							
						
					
					
						commit
						49fc666033
					
				
					 1 changed files with 7 additions and 18 deletions
				
			
		|  | @ -45,11 +45,11 @@ | ||||||
| # we like better (and which is equivalent) | # we like better (and which is equivalent) | ||||||
| # | # | ||||||
| unpacker_coercions = { | unpacker_coercions = { | ||||||
| 	typeComp : typeExtended, | 	typeComp : typeFloat, | ||||||
| 	typeColorTable : typeAEList, | 	typeColorTable : typeAEList, | ||||||
| 	typeDrawingArea : typeAERecord, | 	typeDrawingArea : typeAERecord, | ||||||
| 	typeFixed : typeExtended, | 	typeFixed : typeFloat, | ||||||
| 	typeFloat : typeExtended, | 	typeExtended : typeFloat, | ||||||
| 	typePixelMap : typeAERecord, | 	typePixelMap : typeAERecord, | ||||||
| 	typeRotation : typeAERecord, | 	typeRotation : typeAERecord, | ||||||
| 	typeStyledText : typeAERecord, | 	typeStyledText : typeAERecord, | ||||||
|  | @ -87,14 +87,7 @@ def pack(x, forcetype = None): | ||||||
| 	if t == IntType: | 	if t == IntType: | ||||||
| 		return AE.AECreateDesc('long', struct.pack('l', x)) | 		return AE.AECreateDesc('long', struct.pack('l', x)) | ||||||
| 	if t == FloatType: | 	if t == FloatType: | ||||||
| 		# | 		return AE.AECreateDesc('doub', struct.pack('d', x)) | ||||||
| 		# XXXX (note by Guido) Weird thing -- Think C's "double" is 10 bytes, but |  | ||||||
| 		# struct.pack('d') return 12 bytes (and struct.unpack requires |  | ||||||
| 		# them, too).  The first 2 bytes seem to be repeated... |  | ||||||
| 		# Probably an alignment problem |  | ||||||
| 		# XXXX (note by Jack) haven't checked this under MW |  | ||||||
| 		# |  | ||||||
| 		return AE.AECreateDesc('exte', struct.pack('d', x)[2:]) |  | ||||||
| 	if t == StringType: | 	if t == StringType: | ||||||
| 		return AE.AECreateDesc('TEXT', x) | 		return AE.AECreateDesc('TEXT', x) | ||||||
| 	if t == ListType: | 	if t == ListType: | ||||||
|  | @ -148,14 +141,11 @@ def unpack(desc): | ||||||
| 	if t == typeEnumeration: | 	if t == typeEnumeration: | ||||||
| 		return mkenum(desc.data) | 		return mkenum(desc.data) | ||||||
| 	# typeEPS returned as unknown | 	# typeEPS returned as unknown | ||||||
| 	if t == typeExtended: |  | ||||||
| 		data = desc.data |  | ||||||
| 		# XXX See corresponding note for pack() |  | ||||||
| 		return struct.unpack('d', data[:2] + data)[0] |  | ||||||
| 	if t == typeFalse: | 	if t == typeFalse: | ||||||
| 		return 0 | 		return 0 | ||||||
| 	# typeFixed coerced to extended | 	if t == typeFloat: | ||||||
| 	# typeFloat coerced to extended | 		data = desc.data | ||||||
|  | 		return struct.unpack('d', data)[0] | ||||||
| 	if t == typeFSS: | 	if t == typeFSS: | ||||||
| 		return macfs.RawFSSpec(desc.data) | 		return macfs.RawFSSpec(desc.data) | ||||||
| 	if t == typeInsertionLoc: | 	if t == typeInsertionLoc: | ||||||
|  | @ -170,7 +160,6 @@ def unpack(desc): | ||||||
| 		return aetypes.IntlWritingCode(script, language) | 		return aetypes.IntlWritingCode(script, language) | ||||||
| 	if t == typeKeyword: | 	if t == typeKeyword: | ||||||
| 		return mkkeyword(desc.data) | 		return mkkeyword(desc.data) | ||||||
| 	# typeLongFloat is equal to typeFloat |  | ||||||
| 	if t == typeLongInteger: | 	if t == typeLongInteger: | ||||||
| 		return struct.unpack('l', desc.data)[0] | 		return struct.unpack('l', desc.data)[0] | ||||||
| 	if t == typeNull: | 	if t == typeNull: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jack Jansen
						Jack Jansen