[Python-checkins] python/dist/src/Modules _localemodule.c, 2.40.4.2, 2.40.4.3

perky at users.sourceforge.net perky at users.sourceforge.net
Sun Mar 21 14:54:02 EST 2004


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9690/Modules

Modified Files:
      Tag: release23-maint
	_localemodule.c 
Log Message:
Backport checkin:
[Bug #920575] Add a workaround for GNU libc nl_langinfo()'s returning NULL.


Index: _localemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v
retrieving revision 2.40.4.2
retrieving revision 2.40.4.3
diff -C2 -d -r2.40.4.2 -r2.40.4.3
*** _localemodule.c	4 Sep 2003 18:26:07 -0000	2.40.4.2
--- _localemodule.c	21 Mar 2004 19:53:59 -0000	2.40.4.3
***************
*** 593,598 ****
  #endif
      for (i = 0; langinfo_constants[i].name; i++)
! 	    if (langinfo_constants[i].value == item)
! 		    return PyString_FromString(nl_langinfo(item));
      PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant");
      return NULL;
--- 593,602 ----
  #endif
      for (i = 0; langinfo_constants[i].name; i++)
!         if (langinfo_constants[i].value == item) {
!             /* Check NULL as a workaround for GNU libc's returning NULL
!                instead of an empty string for nl_langinfo(ERA).  */
!             const char *result = nl_langinfo(item);
!             return PyString_FromString(result != NULL ? result : "");
!         }
      PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant");
      return NULL;




More information about the Python-checkins mailing list