[Python-checkins] CVS: python/dist/src/Python getargs.c,2.49,2.50

Guido van Rossum python-dev@python.org
Fri, 1 Dec 2000 04:59:07 -0800


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

Modified Files:
	getargs.c 
Log Message:
Clarified some of the error messages, esp. "read-only character
buffer" replaced by "string or read-only character buffer".


Index: getargs.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v
retrieving revision 2.49
retrieving revision 2.50
diff -C2 -r2.49 -r2.50
*** getargs.c	2000/09/26 05:46:01	2.49
--- getargs.c	2000/12/01 12:59:05	2.50
***************
*** 566,570 ****
  							            arg, NULL);
  				    if (arg == NULL)
! 					return "unicode conversion error";
  				    *p = PyString_AS_STRING(arg);
  				    *q = PyString_GET_SIZE(arg);
--- 566,570 ----
  							            arg, NULL);
  				    if (arg == NULL)
! 					return "(unicode conversion error)";
  				    *p = PyString_AS_STRING(arg);
  				    *q = PyString_GET_SIZE(arg);
***************
*** 576,582 ****
  					 pb->bf_getreadbuffer == NULL ||
  					 pb->bf_getsegcount == NULL )
! 					return "read-only buffer";
  				    if ( (*pb->bf_getsegcount)(arg, NULL) != 1 )
! 					return "single-segment read-only buffer";
  				    if ( (count =
  					  (*pb->bf_getreadbuffer)(arg, 0, p)) < 0 )
--- 576,582 ----
  					 pb->bf_getreadbuffer == NULL ||
  					 pb->bf_getsegcount == NULL )
! 					return "string or read-only buffer";
  				    if ( (*pb->bf_getsegcount)(arg, NULL) != 1 )
! 					return "string or single-segment read-only buffer";
  				    if ( (count =
  					  (*pb->bf_getreadbuffer)(arg, 0, p)) < 0 )
***************
*** 594,598 ****
  							            arg, NULL);
  				    if (arg == NULL)
! 					return "unicode conversion error";
  				    *p = PyString_AS_STRING(arg);
  				}
--- 594,598 ----
  							            arg, NULL);
  				    if (arg == NULL)
! 					return "(unicode conversion error)";
  				    *p = PyString_AS_STRING(arg);
  				}
***************
*** 623,627 ****
  							            arg, NULL);
  				    if (arg == NULL)
! 					return "unicode conversion error";
  				    *p = PyString_AS_STRING(arg);
  				    *q = PyString_GET_SIZE(arg);
--- 623,627 ----
  							            arg, NULL);
  				    if (arg == NULL)
! 					return "(unicode conversion error)";
  				    *p = PyString_AS_STRING(arg);
  				    *q = PyString_GET_SIZE(arg);
***************
*** 633,639 ****
  					 pb->bf_getreadbuffer == NULL ||
  					 pb->bf_getsegcount == NULL )
! 					return "read-only buffer";
  				    if ( (*pb->bf_getsegcount)(arg, NULL) != 1 )
! 					return "single-segment read-only buffer";
  				    if ( (count =
  					  (*pb->bf_getreadbuffer)(arg, 0, p)) < 0 )
--- 633,639 ----
  					 pb->bf_getreadbuffer == NULL ||
  					 pb->bf_getsegcount == NULL )
! 					return "string or read-only buffer";
  				    if ( (*pb->bf_getsegcount)(arg, NULL) != 1 )
! 					return "string or single-segment read-only buffer";
  				    if ( (count =
  					  (*pb->bf_getreadbuffer)(arg, 0, p)) < 0 )
***************
*** 653,661 ****
  								  arg, NULL);
  				  if (arg == NULL)
! 				      return "unicode conversion error";
  				  *p = PyString_AS_STRING(arg);
  				}
  				else
! 				  return "None or string";
  				if (*format == '#') {
  				  int *q = va_arg(*p_va, int *);
--- 653,661 ----
  								  arg, NULL);
  				  if (arg == NULL)
! 				      return "(unicode conversion error)";
  				  *p = PyString_AS_STRING(arg);
  				}
  				else
! 				  return "string or None";
  				if (*format == '#') {
  				  int *q = va_arg(*p_va, int *);
***************
*** 668,672 ****
  				else if (*p != NULL &&
  					 (int)strlen(*p) != PyString_Size(arg))
! 				  return "None or string without null bytes";
  			}
  			break;
--- 668,672 ----
  				else if (*p != NULL &&
  					 (int)strlen(*p) != PyString_Size(arg))
! 				  return "string without null bytes or None";
  			}
  			break;
***************
*** 696,700 ****
  			u = PyUnicode_FromObject(arg);
  			if (u == NULL)
! 				return "string, unicode or text buffer";
  			
  			/* Encode object; use default error handling */
--- 696,700 ----
  			u = PyUnicode_FromObject(arg);
  			if (u == NULL)
! 				return "string or unicode or text buffer";
  			
  			/* Encode object; use default error handling */
***************
*** 774,779 ****
  				 */
  				if ((int)strlen(PyString_AS_STRING(s)) != size)
! 					return "(encoded string without "\
! 					       "NULL bytes)";
  				*buffer = PyMem_NEW(char, size + 1);
  				if (*buffer == NULL) {
--- 774,778 ----
  				 */
  				if ((int)strlen(PyString_AS_STRING(s)) != size)
! 					return "(encoded string without NULL bytes)";
  				*buffer = PyMem_NEW(char, size + 1);
  				if (*buffer == NULL) {
***************
*** 800,806 ****
  				     pb->bf_getreadbuffer == NULL ||
  				     pb->bf_getsegcount == NULL )
! 				  return "read-only buffer";
  				if ( (*pb->bf_getsegcount)(arg, NULL) != 1 )
! 				  return "single-segment read-only buffer";
  				if ( (count =
  				      (*pb->bf_getreadbuffer)(arg, 0, p)) < 0 )
--- 799,805 ----
  				     pb->bf_getreadbuffer == NULL ||
  				     pb->bf_getsegcount == NULL )
! 				  return "unicode or read-only buffer";
  				if ( (*pb->bf_getsegcount)(arg, NULL) != 1 )
! 				  return "unicode or single-segment read-only buffer";
  				if ( (count =
  				      (*pb->bf_getreadbuffer)(arg, 0, p)) < 0 )
***************
*** 917,923 ****
  			     pb->bf_getcharbuffer == NULL ||
  			     pb->bf_getsegcount == NULL )
! 				return "read-only character buffer";
  			if ( (*pb->bf_getsegcount)(arg, NULL) != 1 )
! 				return "single-segment read-only buffer";
  			if ( (count = pb->bf_getcharbuffer(arg, 0, p)) < 0 )
  				return "(unspecified)";
--- 916,922 ----
  			     pb->bf_getcharbuffer == NULL ||
  			     pb->bf_getsegcount == NULL )
! 				return "string or read-only character buffer";
  			if ( (*pb->bf_getsegcount)(arg, NULL) != 1 )
! 				return "string or single-segment read-only buffer";
  			if ( (count = pb->bf_getcharbuffer(arg, 0, p)) < 0 )
  				return "(unspecified)";