[Python-checkins] CVS: python/dist/src/Modules timemodule.c,2.77,2.78

Guido van Rossum guido@cnri.reston.va.us
Wed, 12 Jan 2000 11:38:23 -0500 (EST)


Update of /projects/cvsroot/python/dist/src/Modules
In directory eric:/projects/python/develop/guido/src/Modules

Modified Files:
	timemodule.c 
Log Message:
The functions asctime() and mktime() are documented to take a 9-tuple
only.  Through some mysterious interaction, they would take 9 separate
arguments as well.  This misfeature is now disabled (to end a
difference with JPython).


Index: timemodule.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Modules/timemodule.c,v
retrieving revision 2.77
retrieving revision 2.78
diff -C2 -r2.77 -r2.78
*** timemodule.c	1999/11/08 15:32:27	2.77
--- timemodule.c	2000/01/12 16:38:20	2.78
***************
*** 453,460 ****
  	PyObject *args;
  {
  	struct tm buf;
  	char *p;
! 	if (!gettmarg(args, &buf))
  		return NULL;
  	p = asctime(&buf);
  	if (p[24] == '\n')
--- 453,463 ----
  	PyObject *args;
  {
+ 	PyObject *tup;
  	struct tm buf;
  	char *p;
! 	if (!PyArg_ParseTuple(args, "O", &tup))
  		return NULL;
+ 	if (!gettmarg(tup, &buf))
+ 		return NULL;
  	p = asctime(&buf);
  	if (p[24] == '\n')
***************
*** 501,509 ****
  	PyObject *args;
  {
  	struct tm buf;
  	time_t tt;
  	tt = time(&tt);
  	buf = *localtime(&tt);
! 	if (!gettmarg(args, &buf))
  		return NULL;
  	tt = mktime(&buf);
--- 504,515 ----
  	PyObject *args;
  {
+ 	PyObject *tup;
  	struct tm buf;
  	time_t tt;
+ 	if (!PyArg_ParseTuple(args, "O", &tup))
+ 		return NULL;
  	tt = time(&tt);
  	buf = *localtime(&tt);
! 	if (!gettmarg(tup, &buf))
  		return NULL;
  	tt = mktime(&buf);
***************
*** 530,537 ****
  	{"gmtime",	time_gmtime, 0, gmtime_doc},
  	{"localtime",	time_localtime, 0, localtime_doc},
! 	{"asctime",	time_asctime, 0, asctime_doc},
  	{"ctime",	time_ctime, 0, ctime_doc},
  #ifdef HAVE_MKTIME
! 	{"mktime",	time_mktime, 0, mktime_doc},
  #endif
  #ifdef HAVE_STRFTIME
--- 536,543 ----
  	{"gmtime",	time_gmtime, 0, gmtime_doc},
  	{"localtime",	time_localtime, 0, localtime_doc},
! 	{"asctime",	time_asctime, 1, asctime_doc},
  	{"ctime",	time_ctime, 0, ctime_doc},
  #ifdef HAVE_MKTIME
! 	{"mktime",	time_mktime, 1, mktime_doc},
  #endif
  #ifdef HAVE_STRFTIME