[Python-checkins] python/dist/src/Objects fileobject.c,2.186,2.187

montanaro at users.sourceforge.net montanaro at users.sourceforge.net
Sat Feb 7 08:53:48 EST 2004


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

Modified Files:
	fileobject.c 
Log Message:
Remove support for --without-universal-newlines (see PEP 11).


Index: fileobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v
retrieving revision 2.186
retrieving revision 2.187
diff -C2 -d -r2.186 -r2.187
*** fileobject.c	19 Nov 2003 22:52:23 -0000	2.186
--- fileobject.c	7 Feb 2004 13:53:46 -0000	2.187
***************
*** 42,46 ****
  #endif
  
- #ifdef WITH_UNIVERSAL_NEWLINES
  /* Bits in f_newlinetypes */
  #define NEWLINE_UNKNOWN	0	/* No newline seen, yet */
--- 42,45 ----
***************
*** 48,52 ****
  #define NEWLINE_LF 2		/* \n newline seen */
  #define NEWLINE_CRLF 4		/* \r\n newline seen */
- #endif
  
  FILE *
--- 47,50 ----
***************
*** 120,128 ****
  	f->f_binary = strchr(mode,'b') != NULL;
  	f->f_buf = NULL;
- #ifdef WITH_UNIVERSAL_NEWLINES
  	f->f_univ_newline = (strchr(mode, 'U') != NULL);
  	f->f_newlinetypes = NEWLINE_UNKNOWN;
  	f->f_skipnextlf = 0;
- #endif
  	Py_INCREF(Py_None);
  	f->f_encoding = Py_None;
--- 118,124 ----
***************
*** 166,180 ****
  #endif
  	{
- #ifdef WITH_UNIVERSAL_NEWLINES
  		if (strcmp(mode, "U") == 0 || strcmp(mode, "rU") == 0)
  			mode = "rb";
- #else
- 		/* Compatibility: specifying U in a Python without universal
- 		** newlines is allowed, and the file is opened as a normal text
- 		** file.
- 		*/
- 		if (strcmp(mode, "U") == 0 || strcmp(mode, "rU") == 0)
- 			mode = "r";
- #endif
  #ifdef MS_WINDOWS
  		if (PyUnicode_Check(f->f_name)) {
--- 162,167 ----
***************
*** 495,501 ****
  		return NULL;
  	}
- #ifdef WITH_UNIVERSAL_NEWLINES
  	f->f_skipnextlf = 0;
- #endif
  	Py_INCREF(Py_None);
  	return Py_None;
--- 482,486 ----
***************
*** 630,634 ****
  		return NULL;
  	}
- #ifdef WITH_UNIVERSAL_NEWLINES
  	if (f->f_skipnextlf) {
  		int c;
--- 615,618 ----
***************
*** 639,643 ****
  		} else if (c != EOF) ungetc(c, f->f_fp);
  	}
- #endif
  #if !defined(HAVE_LARGEFILE_SUPPORT)
  	return PyInt_FromLong(pos);
--- 623,626 ----
***************
*** 1071,1086 ****
  	size_t increment;       /* amount to increment the buffer */
  	PyObject *v;
- #ifdef WITH_UNIVERSAL_NEWLINES
  	int newlinetypes = f->f_newlinetypes;
  	int skipnextlf = f->f_skipnextlf;
  	int univ_newline = f->f_univ_newline;
- #endif
  
  #if defined(USE_FGETS_IN_GETLINE)
- #ifdef WITH_UNIVERSAL_NEWLINES
  	if (n <= 0 && !univ_newline )
- #else
- 	if (n <= 0)
- #endif
  		return getline_via_fgets(fp);
  #endif
--- 1054,1063 ----
***************
*** 1095,1099 ****
  		Py_BEGIN_ALLOW_THREADS
  		FLOCKFILE(fp);
- #ifdef WITH_UNIVERSAL_NEWLINES
  		if (univ_newline) {
  			c = 'x'; /* Shut up gcc warning */
--- 1072,1075 ----
***************
*** 1124,1128 ****
  				newlinetypes |= NEWLINE_CR;
  		} else /* If not universal newlines use the normal loop */
- #endif
  		while ((c = GETC(fp)) != EOF &&
  		       (*buf++ = c) != '\n' &&
--- 1100,1103 ----
***************
*** 1131,1138 ****
  		FUNLOCKFILE(fp);
  		Py_END_ALLOW_THREADS
- #ifdef WITH_UNIVERSAL_NEWLINES
  		f->f_newlinetypes = newlinetypes;
  		f->f_skipnextlf = skipnextlf;
- #endif
  		if (c == '\n')
  			break;
--- 1106,1111 ----
***************
*** 1678,1682 ****
  	return PyBool_FromLong((long)(f->f_fp == 0));
  }
- #ifdef WITH_UNIVERSAL_NEWLINES
  static PyObject *
  get_newlines(PyFileObject *f, void *closure)
--- 1651,1654 ----
***************
*** 1707,1718 ****
  	}
  }
- #endif
  
  static PyGetSetDef file_getsetlist[] = {
  	{"closed", (getter)get_closed, NULL, "True if the file is closed"},
- #ifdef WITH_UNIVERSAL_NEWLINES
  	{"newlines", (getter)get_newlines, NULL,
  	 "end-of-line convention used in this file"},
- #endif
  	{0},
  };
--- 1679,1687 ----
***************
*** 1932,1936 ****
  "buffered, and larger numbers specify the buffer size.\n"
  )
- #ifdef WITH_UNIVERSAL_NEWLINES
  PyDoc_STR(
  "Add a 'U' to mode to open the file for input with universal newline\n"
--- 1901,1904 ----
***************
*** 1942,1946 ****
  "'U' cannot be combined with 'w' or '+' mode.\n"
  )
- #endif /* WITH_UNIVERSAL_NEWLINES */
  PyDoc_STR(
  "\n"
--- 1910,1913 ----
***************
*** 2182,2186 ****
  }
  
- #ifdef WITH_UNIVERSAL_NEWLINES
  /* From here on we need access to the real fgets and fread */
  #undef fgets
--- 2149,2152 ----
***************
*** 2360,2362 ****
  	return dst - buf;
  }
- #endif
--- 2326,2327 ----




More information about the Python-checkins mailing list