mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Merged revisions 78886 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78886 | victor.stinner | 2010-03-13 01:13:22 +0100 (sam., 13 mars 2010) | 2 lines Issue #7818: set().test_c_api() doesn't expect a set('abc'), modify the set. ........
This commit is contained in:
		
							parent
							
								
									6540a82a40
								
							
						
					
					
						commit
						08b36bdab4
					
				
					 2 changed files with 16 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -2360,11 +2360,25 @@ test_c_api(PySetObject *so)
 | 
			
		|||
	PyObject *elem=NULL, *dup=NULL, *t, *f, *dup2, *x;
 | 
			
		||||
	PyObject *ob = (PyObject *)so;
 | 
			
		||||
	long hash;
 | 
			
		||||
	PyObject *str;
 | 
			
		||||
 | 
			
		||||
	/* Verify preconditions and exercise type/size checks */
 | 
			
		||||
	/* Verify preconditions */
 | 
			
		||||
	assert(PyAnySet_Check(ob));
 | 
			
		||||
	assert(PyAnySet_CheckExact(ob));
 | 
			
		||||
	assert(!PyFrozenSet_CheckExact(ob));
 | 
			
		||||
 | 
			
		||||
	/* so.clear(); so |= set("abc"); */
 | 
			
		||||
	str = PyUnicode_FromString("abc");
 | 
			
		||||
	if (str == NULL)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	set_clear_internal(so);
 | 
			
		||||
	if (set_update_internal(so, str) == -1) {
 | 
			
		||||
		Py_DECREF(str);
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
	Py_DECREF(str);
 | 
			
		||||
 | 
			
		||||
	/* Exercise type/size checks */
 | 
			
		||||
	assert(PySet_Size(ob) == 3);
 | 
			
		||||
	assert(PySet_GET_SIZE(ob) == 3);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue