mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Issue #14687: Optimize str%tuple for the "%(name)s" syntax
Avoid an useless and expensive call to PyUnicode_READ().
This commit is contained in:
		
							parent
							
								
									598b2f6bd0
								
							
						
					
					
						commit
						bff7c96834
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -13737,9 +13737,10 @@ PyUnicode_Format(PyObject *format, PyObject *args)
 | 
				
			||||||
                keystart = fmtpos;
 | 
					                keystart = fmtpos;
 | 
				
			||||||
                /* Skip over balanced parentheses */
 | 
					                /* Skip over balanced parentheses */
 | 
				
			||||||
                while (pcount > 0 && --fmtcnt >= 0) {
 | 
					                while (pcount > 0 && --fmtcnt >= 0) {
 | 
				
			||||||
                    if (PyUnicode_READ(fmtkind, fmt, fmtpos) == ')')
 | 
					                    c = PyUnicode_READ(fmtkind, fmt, fmtpos);
 | 
				
			||||||
 | 
					                    if (c == ')')
 | 
				
			||||||
                        --pcount;
 | 
					                        --pcount;
 | 
				
			||||||
                    else if (PyUnicode_READ(fmtkind, fmt, fmtpos) == '(')
 | 
					                    else if (c == '(')
 | 
				
			||||||
                        ++pcount;
 | 
					                        ++pcount;
 | 
				
			||||||
                    fmtpos++;
 | 
					                    fmtpos++;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue