[Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.124,2.124.2.1

Guido van Rossum gvanrossum@users.sourceforge.net
Thu, 13 Dec 2001 20:13:27 -0800


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv27623

Modified Files:
      Tag: r22rc1-branch
	typeobject.c 
Log Message:
Fix for SF bug #492345.  (I could've sworn I checked this in, but
apparently I didn't!)

This code:

    class Classic:
        pass

    class New(Classic):
        __metaclass__ = type

attempts to create a new-style class with only classic bases -- but it
doesn't work right.  Attempts to fix it so it works caused problems
elsewhere, so I'm now raising a TypeError in this case.


Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.124
retrieving revision 2.124.2.1
diff -C2 -d -r2.124 -r2.124.2.1
*** typeobject.c	2001/12/06 02:35:58	2.124
--- typeobject.c	2001/12/14 04:13:25	2.124.2.1
***************
*** 758,762 ****
  		}
  	}
! 	assert(base != NULL);
  	return base;
  }
--- 758,764 ----
  		}
  	}
! 	if (base == NULL)
! 		PyErr_SetString(PyExc_TypeError,
! 			"a new-style class can't have only classic bases");
  	return base;
  }