mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Patch #403514: precompute _subst_format_str to avoid a call to
string.join() on each invocation of _bind.
This commit is contained in:
		
							parent
							
								
									e358b423c2
								
							
						
					
					
						commit
						c8718c13e8
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -848,8 +848,7 @@ def _bind(self, what, sequence, func, add, needcleanup=1): | ||||||
|             cmd = ('%sif {"[%s %s]" == "break"} break\n' |             cmd = ('%sif {"[%s %s]" == "break"} break\n' | ||||||
|                    % |                    % | ||||||
|                    (add and '+' or '', |                    (add and '+' or '', | ||||||
|                 funcid, |                 funcid, self._subst_format_str)) | ||||||
|                 " ".join(self._subst_format))) |  | ||||||
|             self.tk.call(what + (sequence, cmd)) |             self.tk.call(what + (sequence, cmd)) | ||||||
|             return funcid |             return funcid | ||||||
|         elif sequence: |         elif sequence: | ||||||
|  | @ -1012,6 +1011,7 @@ def _root(self): | ||||||
|     _subst_format = ('%#', '%b', '%f', '%h', '%k', |     _subst_format = ('%#', '%b', '%f', '%h', '%k', | ||||||
|              '%s', '%t', '%w', '%x', '%y', |              '%s', '%t', '%w', '%x', '%y', | ||||||
|              '%A', '%E', '%K', '%N', '%W', '%T', '%X', '%Y', '%D') |              '%A', '%E', '%K', '%N', '%W', '%T', '%X', '%Y', '%D') | ||||||
|  |     _subst_format_str = " ".join(_subst_format) | ||||||
|     def _substitute(self, *args): |     def _substitute(self, *args): | ||||||
|         """Internal function.""" |         """Internal function.""" | ||||||
|         if len(args) != len(self._subst_format): return args |         if len(args) != len(self._subst_format): return args | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Martin v. Löwis
						Martin v. Löwis