[Python-checkins] CVS: python/dist/src/Python exceptions.c,1.10,1.11

Thomas Wouters python-dev@python.org
Sat, 22 Jul 2000 11:45:08 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory slayer.i.sourceforge.net:/tmp/cvs-serv14831

Modified Files:
	exceptions.c 
Log Message:

Fix two instances of empty argument lists, and fix style
('PyObject** x' -> 'PyObject **x')



Index: exceptions.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** exceptions.c	2000/07/16 12:04:32	1.10
--- exceptions.c	2000/07/22 18:45:06	1.11
***************
*** 102,106 ****
  /* Helper function for populating a dictionary with method wrappers. */
  static int
! populate_methods(PyObject* klass, PyObject* dict, PyMethodDef* methods) 
  {
      if (!methods)
--- 102,106 ----
  /* Helper function for populating a dictionary with method wrappers. */
  static int
! populate_methods(PyObject *klass, PyObject *dict, PyMethodDef *methods)
  {
      if (!methods)
***************
*** 109,114 ****
      while (methods->ml_name) {
  	/* get a wrapper for the built-in function */
! 	PyObject* func = PyCFunction_New(methods, NULL);
! 	PyObject* meth;
  	int status;
  
--- 109,114 ----
      while (methods->ml_name) {
  	/* get a wrapper for the built-in function */
! 	PyObject *func = PyCFunction_New(methods, NULL);
! 	PyObject *meth;
  	int status;
  
***************
*** 140,149 ****
  /* This function is used to create all subsequent exception classes. */
  static int
! make_class(PyObject** klass, PyObject* base,
! 	   char* name, PyMethodDef* methods,
! 	   char* docstr)
  {
!     PyObject* dict = PyDict_New();
!     PyObject* str = NULL;
      int status = -1;
  
--- 140,149 ----
  /* This function is used to create all subsequent exception classes. */
  static int
! make_class(PyObject **klass, PyObject *base,
! 	   char *name, PyMethodDef *methods,
! 	   char *docstr)
  {
!     PyObject *dict = PyDict_New();
!     PyObject *str = NULL;
      int status = -1;
  
***************
*** 180,186 ****
  
  /* Use this for *args signatures, otherwise just use PyArg_ParseTuple() */
! static PyObject* get_self(PyObject* args)
  {
!     PyObject* self = PyTuple_GetItem(args, 0);
      if (!self) {
  	/* Watch out for being called to early in the bootstrapping process */
--- 180,187 ----
  
  /* Use this for *args signatures, otherwise just use PyArg_ParseTuple() */
! static PyObject *
! get_self(PyObject *args)
  {
!     PyObject *self = PyTuple_GetItem(args, 0);
      if (!self) {
  	/* Watch out for being called to early in the bootstrapping process */
***************
*** 216,221 ****
  
  
! static PyObject*
! Exception__init__(PyObject* self, PyObject* args)
  {
      int status;
--- 217,222 ----
  
  
! static PyObject *
! Exception__init__(PyObject *self, PyObject *args)
  {
      int status;
***************
*** 239,246 ****
  
  
! static PyObject*
! Exception__str__(PyObject* self, PyObject* args)
  {
!     PyObject* out;
  
      if (!PyArg_ParseTuple(args, "O", &self))
--- 240,247 ----
  
  
! static PyObject *
! Exception__str__(PyObject *self, PyObject *args)
  {
!     PyObject *out;
  
      if (!PyArg_ParseTuple(args, "O", &self))
***************
*** 257,261 ****
      case 1:
      {
! 	PyObject* tmp = PySequence_GetItem(args, 0);
  	if (tmp) {
  	    out = PyObject_Str(tmp);
--- 258,262 ----
      case 1:
      {
! 	PyObject *tmp = PySequence_GetItem(args, 0);
  	if (tmp) {
  	    out = PyObject_Str(tmp);
***************
*** 276,284 ****
  
  
! static PyObject*
! Exception__getitem__(PyObject* self, PyObject* args)
  {
!     PyObject* out;
!     PyObject* index;
  
      if (!PyArg_ParseTuple(args, "OO", &self, &index))
--- 277,285 ----
  
  
! static PyObject *
! Exception__getitem__(PyObject *self, PyObject *args)
  {
!     PyObject *out;
!     PyObject *index;
  
      if (!PyArg_ParseTuple(args, "OO", &self, &index))
***************
*** 306,314 ****
  
  static int
! make_Exception(char* modulename)
  {
!     PyObject* dict = PyDict_New();
!     PyObject* str = NULL;
!     PyObject* name = NULL;
      int status = -1;
  
--- 307,315 ----
  
  static int
! make_Exception(char *modulename)
  {
!     PyObject *dict = PyDict_New();
!     PyObject *str = NULL;
!     PyObject *name = NULL;
      int status = -1;
  
***************
*** 366,373 ****
  
  
! static PyObject*
! SystemExit__init__(PyObject* self, PyObject* args)
  {
!     PyObject* code;
      int status;
  
--- 367,374 ----
  
  
! static PyObject *
! SystemExit__init__(PyObject *self, PyObject *args)
  {
!     PyObject *code;
      int status;
  
***************
*** 431,442 ****
  
  
! static PyObject*
! EnvironmentError__init__(PyObject* self, PyObject* args) 
  {
!     PyObject* item0 = NULL;
!     PyObject* item1 = NULL;
!     PyObject* item2 = NULL;
!     PyObject* subslice = NULL;
!     PyObject* rtnval = NULL;
  
      if (!(self = get_self(args)))
--- 432,443 ----
  
  
! static PyObject *
! EnvironmentError__init__(PyObject *self, PyObject *args)
  {
!     PyObject *item0 = NULL;
!     PyObject *item1 = NULL;
!     PyObject *item2 = NULL;
!     PyObject *subslice = NULL;
!     PyObject *rtnval = NULL;
  
      if (!(self = get_self(args)))
***************
*** 515,526 ****
  
  
! static PyObject*
! EnvironmentError__str__(PyObject* self, PyObject* args) 
  {
!     PyObject* originalself = self;
!     PyObject* filename;
!     PyObject* serrno;
!     PyObject* strerror;
!     PyObject* rtnval = NULL;
  
      if (!PyArg_ParseTuple(args, "O", &self))
--- 516,527 ----
  
  
! static PyObject *
! EnvironmentError__str__(PyObject *self, PyObject *args)
  {
!     PyObject *originalself = self;
!     PyObject *filename;
!     PyObject *serrno;
!     PyObject *strerror;
!     PyObject *rtnval = NULL;
  
      if (!PyArg_ParseTuple(args, "O", &self))
***************
*** 534,540 ****
  
      if (filename != Py_None) {
! 	PyObject* fmt = PyString_FromString("[Errno %s] %s: %s");
! 	PyObject* repr = PyObject_Repr(filename);
! 	PyObject* tuple = PyTuple_New(3);
  
  	if (!fmt || !repr || !tuple) {
--- 535,541 ----
  
      if (filename != Py_None) {
! 	PyObject *fmt = PyString_FromString("[Errno %s] %s: %s");
! 	PyObject *repr = PyObject_Repr(filename);
! 	PyObject *tuple = PyTuple_New(3);
  
  	if (!fmt || !repr || !tuple) {
***************
*** 558,563 ****
      }
      else if (PyObject_IsTrue(serrno) && PyObject_IsTrue(strerror)) {
! 	PyObject* fmt = PyString_FromString("[Errno %s] %s");
! 	PyObject* tuple = PyTuple_New(2);
  
  	if (!fmt || !tuple) {
--- 559,564 ----
      }
      else if (PyObject_IsTrue(serrno) && PyObject_IsTrue(strerror)) {
! 	PyObject *fmt = PyString_FromString("[Errno %s] %s");
! 	PyObject *tuple = PyTuple_New(2);
  
  	if (!fmt || !tuple) {
***************
*** 644,650 ****
  
  static int
! SyntaxError__classinit__(PyObject* klass)
  {
!     PyObject* emptystring = PyString_FromString("");
  
      /* Additional class-creation time initializations */
--- 645,651 ----
  
  static int
! SyntaxError__classinit__(PyObject *klass)
  {
!     PyObject *emptystring = PyString_FromString("");
  
      /* Additional class-creation time initializations */
***************
*** 664,671 ****
  
  
! static PyObject*
! SyntaxError__init__(PyObject* self, PyObject* args)
  {
!     PyObject* rtnval = NULL;
      int lenargs;
  
--- 665,672 ----
  
  
! static PyObject *
! SyntaxError__init__(PyObject *self, PyObject *args)
  {
!     PyObject *rtnval = NULL;
      int lenargs;
  
***************
*** 681,685 ****
      lenargs = PySequence_Size(args);
      if (lenargs >= 1) {
! 	PyObject* item0 = PySequence_GetItem(args, 0);
  	int status;
  
--- 682,686 ----
      lenargs = PySequence_Size(args);
      if (lenargs >= 1) {
! 	PyObject *item0 = PySequence_GetItem(args, 0);
  	int status;
  
***************
*** 692,696 ****
      }
      if (lenargs == 2) {
! 	PyObject* info = PySequence_GetItem(args, 1);
  	PyObject *filename, *lineno, *offset, *text;
  	int status = 1;
--- 693,697 ----
      }
      if (lenargs == 2) {
! 	PyObject *info = PySequence_GetItem(args, 1);
  	PyObject *filename, *lineno, *offset, *text;
  	int status = 1;
***************
*** 729,737 ****
  
  
! static PyObject*
! SyntaxError__str__(PyObject* self, PyObject* args)
  {
!     PyObject* msg;
!     PyObject* str;
  
      if (!PyArg_ParseTuple(args, "O", &self))
--- 730,738 ----
  
  
! static PyObject *
! SyntaxError__str__(PyObject *self, PyObject *args)
  {
!     PyObject *msg;
!     PyObject *str;
  
      if (!PyArg_ParseTuple(args, "O", &self))
***************
*** 855,869 ****
  
  
! /* mapping between exception names and their PyObject** */
! static struct
! {
!     char* name;
!     PyObject** exc;
!     PyObject** base;			     /* NULL == PyExc_StandardError */
!     char* docstr;
!     PyMethodDef* methods;
!     int (*classinit)(PyObject*);
! }
! exctable[] = {
   /*
    * The first three classes MUST appear in exactly this order
--- 856,868 ----
  
  
! /* mapping between exception names and their PyObject ** */
! static struct {
!     char *name;
!     PyObject **exc;
!     PyObject **base;			     /* NULL == PyExc_StandardError */
!     char *docstr;
!     PyMethodDef *methods;
!     int (*classinit)(PyObject *);
! } exctable[] = {
   /*
    * The first three classes MUST appear in exactly this order
***************
*** 929,944 ****
  __declspec(dllexport)
  #endif /* WIN32 */
! init_exceptions()
  {
!     char* modulename = "exceptions";
      int modnamesz = strlen(modulename);
      int i;
  
!     PyObject* me = Py_InitModule(modulename, functions);
!     PyObject* mydict = PyModule_GetDict(me);
!     PyObject* bltinmod = PyImport_ImportModule("__builtin__");
!     PyObject* bdict = PyModule_GetDict(bltinmod);
!     PyObject* doc = PyString_FromString(module__doc__);
!     PyObject* args;
  
      PyDict_SetItemString(mydict, "__doc__", doc);
--- 928,943 ----
  __declspec(dllexport)
  #endif /* WIN32 */
! init_exceptions(void)
  {
!     char *modulename = "exceptions";
      int modnamesz = strlen(modulename);
      int i;
  
!     PyObject *me = Py_InitModule(modulename, functions);
!     PyObject *mydict = PyModule_GetDict(me);
!     PyObject *bltinmod = PyImport_ImportModule("__builtin__");
!     PyObject *bdict = PyModule_GetDict(bltinmod);
!     PyObject *doc = PyString_FromString(module__doc__);
!     PyObject *args;
  
      PyDict_SetItemString(mydict, "__doc__", doc);
***************
*** 960,965 ****
      for (i=1; exctable[i].name; i++) {
  	int status;
! 	char* cname = PyMem_NEW(char, modnamesz+strlen(exctable[i].name)+2);
! 	PyObject* base;
  
  	(void)strcpy(cname, modulename);
--- 959,964 ----
      for (i=1; exctable[i].name; i++) {
  	int status;
! 	char *cname = PyMem_NEW(char, modnamesz+strlen(exctable[i].name)+2);
! 	PyObject *base;
  
  	(void)strcpy(cname, modulename);
***************
*** 1015,1019 ****
  __declspec(dllexport)
  #endif /* WIN32 */
! fini_exceptions()
  {
      int i;
--- 1014,1018 ----
  __declspec(dllexport)
  #endif /* WIN32 */
! fini_exceptions(void)
  {
      int i;