mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	static PyObject* variables should use PyString_InternFromString() instead of PyObject_FromString() to store a python string in a function level static var.
This commit is contained in:
		
							parent
							
								
									908caac52e
								
							
						
					
					
						commit
						d7e1b2bd17
					
				
					 6 changed files with 17 additions and 16 deletions
				
			
		|  | @ -1153,7 +1153,7 @@ compiler_mod(struct compiler *c, mod_ty mod) | |||
| 	int addNone = 1; | ||||
| 	static PyObject *module; | ||||
| 	if (!module) { | ||||
| 		module = PyString_FromString("<module>"); | ||||
| 		module = PyString_InternFromString("<module>"); | ||||
| 		if (!module) | ||||
| 			return NULL; | ||||
| 	} | ||||
|  | @ -2001,7 +2001,7 @@ compiler_assert(struct compiler *c, stmt_ty s) | |||
| 	if (Py_OptimizeFlag) | ||||
| 		return 1; | ||||
| 	if (assertion_error == NULL) { | ||||
| 		assertion_error = PyString_FromString("AssertionError"); | ||||
| 		assertion_error = PyString_InternFromString("AssertionError"); | ||||
| 		if (assertion_error == NULL) | ||||
| 			return 0; | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Christian Heimes
						Christian Heimes