A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-checkins/2002-October/030456.html below:

[Python-checkins] python/dist/src/Modules _codecsmodule.c,2.15,2.16

[Python-checkins] python/dist/src/Modules _codecsmodule.c,2.15,2.16doerwalter@users.sourceforge.net doerwalter@users.sourceforge.net
Thu, 31 Oct 2002 05:36:32 -0800
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv17805/Modules

Modified Files:
	_codecsmodule.c 
Log Message:
Add docstrings to register, lookup, register_error
and lookup_error. This closes SF patch #630622.


Index: _codecsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_codecsmodule.c,v
retrieving revision 2.15
retrieving revision 2.16
diff -C2 -d -r2.15 -r2.16
*** _codecsmodule.c	2 Sep 2002 13:14:31 -0000	2.15
--- _codecsmodule.c	31 Oct 2002 13:36:29 -0000	2.16
***************
*** 40,43 ****
--- 40,50 ----
  /* --- Registry ----------------------------------------------------------- */
  
+ PyDoc_STRVAR(register__doc__,
+ "register(search_function)\n\
+ \n\
+ Register a codec search function. Search functions are expected to take\n\
+ one argument, the encoding name in all lower case letters, and return\n\
+ a tuple of functions (encoder, decoder, stream_reader, stream_writer).");
+ 
  static
  PyObject *codecregister(PyObject *self, PyObject *args)
***************
*** 58,61 ****
--- 65,74 ----
  }
  
+ PyDoc_STRVAR(lookup__doc__,
+ "lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer)\n\
+ \n\
+ Looks up a codec tuple in the Python codec registry and returns\n\
+ a tuple of functions.");
+ 
  static
  PyObject *codeclookup(PyObject *self, PyObject *args)
***************
*** 709,712 ****
--- 722,734 ----
  /* --- Error handler registry --------------------------------------------- */
  
+ PyDoc_STRVAR(register_error__doc__,
+ "register_error(errors, handler)\n\
+ \n\
+ Register the specified error handler under the name\n\
+ errors. handler must be a callable object, that\n\
+ will be called with an exception instance containing\n\
+ information about the location of the encoding/decoding\n\
+ error and must return a (replacement, new position) tuple.");
+ 
  static PyObject *register_error(PyObject *self, PyObject *args)
  {
***************
*** 723,726 ****
--- 745,754 ----
  }
  
+ PyDoc_STRVAR(lookup_error__doc__,
+ "lookup_error(errors) -> handler\n\
+ \n\
+ Return the error handler for the specified error handling name\n\
+ or raise a LookupError, if no handler exists under this name.");
+ 
  static PyObject *lookup_error(PyObject *self, PyObject *args)
  {
***************
*** 736,741 ****
  
  static PyMethodDef _codecs_functions[] = {
!     {"register",		codecregister,			METH_VARARGS},
!     {"lookup",			codeclookup, 			METH_VARARGS},
      {"escape_encode",		escape_encode,			METH_VARARGS},
      {"escape_decode",		escape_decode,			METH_VARARGS},
--- 764,771 ----
  
  static PyMethodDef _codecs_functions[] = {
!     {"register",		codecregister,			METH_VARARGS,
!         register__doc__},
!     {"lookup",			codeclookup, 			METH_VARARGS,
!         lookup__doc__},
      {"escape_encode",		escape_encode,			METH_VARARGS},
      {"escape_decode",		escape_decode,			METH_VARARGS},
***************
*** 771,776 ****
  #endif
  #endif /* Py_USING_UNICODE */
!     {"register_error", 		register_error,			METH_VARARGS},
!     {"lookup_error", 		lookup_error,			METH_VARARGS},
      {NULL, NULL}		/* sentinel */
  };
--- 801,808 ----
  #endif
  #endif /* Py_USING_UNICODE */
!     {"register_error", 		register_error,			METH_VARARGS,
!         register_error__doc__},
!     {"lookup_error", 		lookup_error,			METH_VARARGS,
!         lookup_error__doc__},
      {NULL, NULL}		/* sentinel */
  };





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4