[Python-checkins] CVS: python/dist/src/Python codecs.c,2.5,2.6

Fred Drake python-dev@python.org
Tue, 9 May 2000 15:56:02 -0400


Update of /projects/cvsroot/python/dist/src/Python
In directory seahag.cnri.reston.va.us:/home/fdrake/projects/python/Python

Modified Files:
	codecs.c 
Log Message:

M.-A. Lemburg <mal@lemburg.com>:
Moved some docs to the include file.

Added a NULL check to _PyCodec_Lookup() to make it
core dump safe.


Index: codecs.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/codecs.c,v
retrieving revision 2.5
retrieving revision 2.6
diff -C2 -r2.5 -r2.6
*** codecs.c	2000/04/05 20:11:21	2.5
--- codecs.c	2000/05/09 19:55:59	2.6
***************
*** 56,67 ****
  }
  
- /* Register a new codec search function.
- 
-    As side effect, this tries to load the encodings package, if not
-    yet done, to make sure that it is always first in the list of
-    search functions.
- 
-    The search_function's refcount is incremented by this function. */
- 
  int PyCodec_Register(PyObject *search_function)
  {
--- 56,59 ----
***************
*** 118,122 ****
     effectively case-insensitive.
  
!    If no codec is found, a KeyError is set and NULL returned. 
  
     As side effect, this tries to load the encodings package, if not
--- 110,114 ----
     effectively case-insensitive.
  
!    If no codec is found, a LookupError is set and NULL returned. 
  
     As side effect, this tries to load the encodings package, if not
***************
*** 131,134 ****
--- 123,130 ----
      int i, len;
  
+     if (encoding == NULL) {
+ 	PyErr_BadArgument();
+ 	goto onError;
+     }
      if (_PyCodec_SearchCache == NULL || 
  	_PyCodec_SearchPath == NULL) {