mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +00:00 
			
		
		
		
	utils/misc: fix to_identifier for unicode
string.translate() can fail when passed a unicode object; explicitly str() it first to avoid this.
This commit is contained in:
		
				
					committed by
					
						
						setrofim
					
				
			
			
				
	
			
			
			
						parent
						
							515095d9b2
						
					
				
				
					commit
					9e8f77b8f2
				
			@@ -526,7 +526,7 @@ def to_identifier(text):
 | 
			
		||||
    whitespace and punctuation and adding a prefix if starting with a digit"""
 | 
			
		||||
    if text[:1].isdigit():
 | 
			
		||||
        text = '_' + text
 | 
			
		||||
    return re.sub('_+', '_', text.translate(TRANS_TABLE))
 | 
			
		||||
    return re.sub('_+', '_', str(text).translate(TRANS_TABLE))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def unique(alist):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user