mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	fix Alpha bug in (x)range; different __builtins__ initialization
This commit is contained in:
		
							parent
							
								
									c3f82b6b8a
								
							
						
					
					
						commit
						0865dd9ce9
					
				
					 1 changed files with 14 additions and 8 deletions
				
			
		| 
						 | 
					@ -1011,13 +1011,13 @@ builtin_range(self, args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (gettuplesize(args) <= 1) {
 | 
						if (gettuplesize(args) <= 1) {
 | 
				
			||||||
		if (!newgetargs(args,
 | 
							if (!newgetargs(args,
 | 
				
			||||||
				"i;range() requires 1-3 int arguments",
 | 
									"l;range() requires 1-3 int arguments",
 | 
				
			||||||
				&ihigh))
 | 
									&ihigh))
 | 
				
			||||||
			return NULL;
 | 
								return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
		if (!newgetargs(args,
 | 
							if (!newgetargs(args,
 | 
				
			||||||
				"ii|i;range() requires 1-3 int arguments",
 | 
									"ll|l;range() requires 1-3 int arguments",
 | 
				
			||||||
				&ilow, &ihigh, &istep))
 | 
									&ilow, &ihigh, &istep))
 | 
				
			||||||
			return NULL;
 | 
								return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1053,18 +1053,18 @@ builtin_xrange(self, args)
 | 
				
			||||||
	object *args;
 | 
						object *args;
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	long ilow = 0, ihigh = 0, istep = 1;
 | 
						long ilow = 0, ihigh = 0, istep = 1;
 | 
				
			||||||
	int n;
 | 
						long n;
 | 
				
			||||||
	object *v;
 | 
						object *v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (gettuplesize(args) <= 1) {
 | 
						if (gettuplesize(args) <= 1) {
 | 
				
			||||||
		if (!newgetargs(args,
 | 
							if (!newgetargs(args,
 | 
				
			||||||
				"i;xrange() requires 1-3 int arguments",
 | 
									"l;xrange() requires 1-3 int arguments",
 | 
				
			||||||
				&ihigh))
 | 
									&ihigh))
 | 
				
			||||||
			return NULL;
 | 
								return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
		if (!newgetargs(args,
 | 
							if (!newgetargs(args,
 | 
				
			||||||
				"ii|i;xrange() requires 1-3 int arguments",
 | 
									"ll|l;xrange() requires 1-3 int arguments",
 | 
				
			||||||
				&ilow, &ihigh, &istep))
 | 
									&ilow, &ihigh, &istep))
 | 
				
			||||||
			return NULL;
 | 
								return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1382,8 +1382,15 @@ static struct methodlist builtin_methods[] = {
 | 
				
			||||||
	{NULL,		NULL},
 | 
						{NULL,		NULL},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static object *builtin_mod;
 | 
				
			||||||
static object *builtin_dict;
 | 
					static object *builtin_dict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					object *
 | 
				
			||||||
 | 
					getbuiltinmod()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return builtin_mod;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
object *
 | 
					object *
 | 
				
			||||||
getbuiltindict()
 | 
					getbuiltindict()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -1449,9 +1456,8 @@ initerrors()
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
initbuiltin()
 | 
					initbuiltin()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	object *m;
 | 
						builtin_mod = initmodule("__builtin__", builtin_methods);
 | 
				
			||||||
	m = initmodule("__builtin__", builtin_methods);
 | 
						builtin_dict = getmoduledict(builtin_mod);
 | 
				
			||||||
	builtin_dict = getmoduledict(m);
 | 
					 | 
				
			||||||
	INCREF(builtin_dict);
 | 
						INCREF(builtin_dict);
 | 
				
			||||||
	initerrors();
 | 
						initerrors();
 | 
				
			||||||
	(void) dictinsert(builtin_dict, "None", None);
 | 
						(void) dictinsert(builtin_dict, "None", None);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue