summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2004-02-07 13:53:46 (GMT)
committerSkip Montanaro <skip@pobox.com>2004-02-07 13:53:46 (GMT)
commitdb6080507d7b507cfe9aa524d012a96b5dfefc2d (patch)
tree593e10c5f3aa003380b0a31a923dc0c181ae1298
parentf1afe6682c34044547c13e4e6f1f848bada236d6 (diff)
downloadcpython-db6080507d7b507cfe9aa524d012a96b5dfefc2d.zip
cpython-db6080507d7b507cfe9aa524d012a96b5dfefc2d.tar.gz
cpython-db6080507d7b507cfe9aa524d012a96b5dfefc2d.tar.bz2
Remove support for --without-universal-newlines (see PEP 11).
-rw-r--r--Include/fileobject.h10
-rw-r--r--Misc/NEWS5
-rw-r--r--Modules/bz2module.c22
-rw-r--r--Objects/fileobject.c35
-rw-r--r--PC/os2emx/pyconfig.h3
-rw-r--r--PC/pyconfig.h3
-rw-r--r--Parser/pgenmain.c2
-rw-r--r--RISCOS/pyconfig.h3
-rwxr-xr-xconfigure31
-rw-r--r--configure.in18
-rw-r--r--pyconfig.h.in3
11 files changed, 7 insertions, 128 deletions
diff --git a/Include/fileobject.h b/Include/fileobject.h
index 2ec4b24..35b2c3df 100644
--- a/Include/fileobject.h
+++ b/Include/fileobject.h
@@ -20,11 +20,9 @@ typedef struct {
char* f_bufend; /* Points after last occupied position */
char* f_bufptr; /* Current buffer position */
char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */
-#ifdef WITH_UNIVERSAL_NEWLINES
int f_univ_newline; /* Handle any newline convention */
int f_newlinetypes; /* Types of newlines seen */
int f_skipnextlf; /* Skip next \n */
-#endif
PyObject *f_encoding;
} PyFileObject;
@@ -51,19 +49,13 @@ PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
*/
PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
-#ifdef WITH_UNIVERSAL_NEWLINES
/* Routines to replace fread() and fgets() which accept any of \r, \n
or \r\n as line terminators.
*/
#define PY_STDIOTEXTMODE "b"
char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *);
-#else
-#define PY_STDIOTEXTMODE ""
-#define Py_UniversalNewlineFgets(buf, len, fp, obj) fgets((buf), (len), (fp))
-#define Py_UniversalNewlineFread(buf, len, fp, obj) \
- fread((buf), 1, (len), (fp))
-#endif /* WITH_UNIVERSAL_NEWLINES */
+
#ifdef __cplusplus
}
#endif
diff --git a/Misc/NEWS b/Misc/NEWS
index f7f6ffb..939ce66 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -330,6 +330,11 @@ Tools/Demos
Build
-----
+- Systems requiring the D4, D6 or D7 variants of pthreads are no longer
+ supported (see PEP 11).
+
+- Universal newline support can no longer be disabled (see PEP 11).
+
- Support for DGUX, SunOS 4, IRIX 4 and Minix was removed (see PEP 11).
- Support for systems requiring --with-dl-dld or --with-sgi-dl was removed
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
index 408c736..82d35ae 100644
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -73,13 +73,11 @@ static char __author__[] =
#define RELEASE_LOCK(obj)
#endif
-#ifdef WITH_UNIVERSAL_NEWLINES
/* Bits in f_newlinetypes */
#define NEWLINE_UNKNOWN 0 /* No newline seen, yet */
#define NEWLINE_CR 1 /* \r newline seen */
#define NEWLINE_LF 2 /* \n newline seen */
#define NEWLINE_CRLF 4 /* \r\n newline seen */
-#endif
/* ===================================================================== */
/* Structure definitions. */
@@ -94,11 +92,9 @@ typedef struct {
int f_softspace; /* Flag used by 'print' command */
-#ifdef WITH_UNIVERSAL_NEWLINES
int f_univ_newline; /* Handle any newline convention */
int f_newlinetypes; /* Types of newlines seen */
int f_skipnextlf; /* Skip next \n */
-#endif
BZFILE *fp;
int mode;
@@ -227,11 +223,9 @@ Util_GetLine(BZ2FileObject *f, int n)
size_t increment; /* amount to increment the buffer */
PyObject *v;
int bzerror;
-#ifdef WITH_UNIVERSAL_NEWLINES
int newlinetypes = f->f_newlinetypes;
int skipnextlf = f->f_skipnextlf;
int univ_newline = f->f_univ_newline;
-#endif
total_v_size = n > 0 ? n : 100;
v = PyString_FromStringAndSize((char *)NULL, total_v_size);
@@ -243,7 +237,6 @@ Util_GetLine(BZ2FileObject *f, int n)
for (;;) {
Py_BEGIN_ALLOW_THREADS
-#ifdef WITH_UNIVERSAL_NEWLINES
if (univ_newline) {
while (1) {
BZ2_bzRead(&bzerror, f->fp, &c, 1);
@@ -277,17 +270,14 @@ Util_GetLine(BZ2FileObject *f, int n)
if (bzerror == BZ_STREAM_END && skipnextlf)
newlinetypes |= NEWLINE_CR;
} else /* If not universal newlines use the normal loop */
-#endif
do {
BZ2_bzRead(&bzerror, f->fp, &c, 1);
f->pos++;
*buf++ = c;
} while (bzerror == BZ_OK && c != '\n' && buf != end);
Py_END_ALLOW_THREADS
-#ifdef WITH_UNIVERSAL_NEWLINES
f->f_newlinetypes = newlinetypes;
f->f_skipnextlf = skipnextlf;
-#endif
if (bzerror == BZ_STREAM_END) {
f->size = f->pos;
f->mode = MODE_READ_EOF;
@@ -323,9 +313,6 @@ Util_GetLine(BZ2FileObject *f, int n)
return v;
}
-#ifndef WITH_UNIVERSAL_NEWLINES
-#define Util_UnivNewlineRead(a,b,c,d,e) BZ2_bzRead(a,b,c,d)
-#else
/* This is a hacked version of Python's
* fileobject.c:Py_UniversalNewlineFread(). */
size_t
@@ -393,7 +380,6 @@ Util_UnivNewlineRead(int *bzerror, BZFILE *stream,
f->f_skipnextlf = skipnextlf;
return dst - buf;
}
-#endif
/* This is a hacked version of Python's fileobject.c:drop_readahead(). */
static void
@@ -1190,7 +1176,6 @@ static PyMethodDef BZ2File_methods[] = {
/* ===================================================================== */
/* Getters and setters of BZ2File. */
-#ifdef WITH_UNIVERSAL_NEWLINES
/* This is a hacked version of Python's fileobject.c:get_newlines(). */
static PyObject *
BZ2File_get_newlines(BZ2FileObject *self, void *closure)
@@ -1220,7 +1205,6 @@ BZ2File_get_newlines(BZ2FileObject *self, void *closure)
return NULL;
}
}
-#endif
static PyObject *
BZ2File_get_closed(BZ2FileObject *self, void *closure)
@@ -1243,10 +1227,8 @@ BZ2File_get_name(BZ2FileObject *self, void *closure)
static PyGetSetDef BZ2File_getset[] = {
{"closed", (getter)BZ2File_get_closed, NULL,
"True if the file is closed"},
-#ifdef WITH_UNIVERSAL_NEWLINES
{"newlines", (getter)BZ2File_get_newlines, NULL,
"end-of-line convention used in this file"},
-#endif
{"mode", (getter)BZ2File_get_mode, NULL,
"file mode ('r', 'w', or 'U')"},
{"name", (getter)BZ2File_get_name, NULL,
@@ -1309,9 +1291,7 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
break;
case 'U':
-#ifdef WITH_UNIVERSAL_NEWLINES
self->f_univ_newline = 1;
-#endif
break;
default:
@@ -1441,7 +1421,6 @@ exist, and truncated otherwise. If the buffering argument is given, 0 means\n\
unbuffered, and larger numbers specify the buffer size. If compresslevel\n\
is given, must be a number between 1 and 9.\n\
")
-#ifdef WITH_UNIVERSAL_NEWLINES
PyDoc_STR(
"\n\
Add a 'U' to mode to open the file for input with universal newline\n\
@@ -1451,7 +1430,6 @@ for this attribute is one of None (no newline read yet), '\\r', '\\n',\n\
'\\r\\n' or a tuple containing all the newline types seen. Universal\n\
newlines are available only when reading.\n\
")
-#endif
;
static PyTypeObject BZ2File_Type = {
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 66e5f28..05c9f4a 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -41,13 +41,11 @@
#define FUNLOCKFILE(f)
#endif
-#ifdef WITH_UNIVERSAL_NEWLINES
/* Bits in f_newlinetypes */
#define NEWLINE_UNKNOWN 0 /* No newline seen, yet */
#define NEWLINE_CR 1 /* \r newline seen */
#define NEWLINE_LF 2 /* \n newline seen */
#define NEWLINE_CRLF 4 /* \r\n newline seen */
-#endif
FILE *
PyFile_AsFile(PyObject *f)
@@ -119,11 +117,9 @@ fill_file_fields(PyFileObject *f, FILE *fp, char *name, char *mode,
f->f_softspace = 0;
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;
@@ -165,17 +161,8 @@ open_the_file(PyFileObject *f, char *name, char *mode)
else
#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)) {
PyObject *wmode;
@@ -494,9 +481,7 @@ file_seek(PyFileObject *f, PyObject *args)
clearerr(f->f_fp);
return NULL;
}
-#ifdef WITH_UNIVERSAL_NEWLINES
f->f_skipnextlf = 0;
-#endif
Py_INCREF(Py_None);
return Py_None;
}
@@ -629,7 +614,6 @@ file_tell(PyFileObject *f)
clearerr(f->f_fp);
return NULL;
}
-#ifdef WITH_UNIVERSAL_NEWLINES
if (f->f_skipnextlf) {
int c;
c = GETC(f->f_fp);
@@ -638,7 +622,6 @@ file_tell(PyFileObject *f)
f->f_skipnextlf = 0;
} else if (c != EOF) ungetc(c, f->f_fp);
}
-#endif
#if !defined(HAVE_LARGEFILE_SUPPORT)
return PyInt_FromLong(pos);
#else
@@ -1070,18 +1053,12 @@ get_line(PyFileObject *f, int n)
size_t used_v_size; /* # used slots in buffer */
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
total_v_size = n > 0 ? n : 100;
@@ -1094,7 +1071,6 @@ get_line(PyFileObject *f, int n)
for (;;) {
Py_BEGIN_ALLOW_THREADS
FLOCKFILE(fp);
-#ifdef WITH_UNIVERSAL_NEWLINES
if (univ_newline) {
c = 'x'; /* Shut up gcc warning */
while ( buf != end && (c = GETC(fp)) != EOF ) {
@@ -1123,17 +1099,14 @@ get_line(PyFileObject *f, int n)
if ( c == EOF && skipnextlf )
newlinetypes |= NEWLINE_CR;
} else /* If not universal newlines use the normal loop */
-#endif
while ((c = GETC(fp)) != EOF &&
(*buf++ = c) != '\n' &&
buf != end)
;
FUNLOCKFILE(fp);
Py_END_ALLOW_THREADS
-#ifdef WITH_UNIVERSAL_NEWLINES
f->f_newlinetypes = newlinetypes;
f->f_skipnextlf = skipnextlf;
-#endif
if (c == '\n')
break;
if (c == EOF) {
@@ -1677,7 +1650,6 @@ get_closed(PyFileObject *f, void *closure)
{
return PyBool_FromLong((long)(f->f_fp == 0));
}
-#ifdef WITH_UNIVERSAL_NEWLINES
static PyObject *
get_newlines(PyFileObject *f, void *closure)
{
@@ -1706,14 +1678,11 @@ get_newlines(PyFileObject *f, void *closure)
return NULL;
}
}
-#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},
};
@@ -1931,7 +1900,6 @@ PyDoc_STR(
"If the buffering argument is given, 0 means unbuffered, 1 means line\n"
"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"
"support. Any line ending in the input file will be seen as a '\\n'\n"
@@ -1941,7 +1909,6 @@ PyDoc_STR(
"\n"
"'U' cannot be combined with 'w' or '+' mode.\n"
)
-#endif /* WITH_UNIVERSAL_NEWLINES */
PyDoc_STR(
"\n"
"Note: open() is an alias for file()."
@@ -2181,7 +2148,6 @@ int PyObject_AsFileDescriptor(PyObject *o)
return fd;
}
-#ifdef WITH_UNIVERSAL_NEWLINES
/* From here on we need access to the real fgets and fread */
#undef fgets
#undef fread
@@ -2359,4 +2325,3 @@ Py_UniversalNewlineFread(char *buf, size_t n,
f->f_skipnextlf = skipnextlf;
return dst - buf;
}
-#endif
diff --git a/PC/os2emx/pyconfig.h b/PC/os2emx/pyconfig.h
index 044c000..a0817f8 100644
--- a/PC/os2emx/pyconfig.h
+++ b/PC/os2emx/pyconfig.h
@@ -53,9 +53,6 @@
/* enable the GC module */
#define WITH_CYCLE_GC 1
-/* Define if you want to read files with foreign newlines. */
-#define WITH_UNIVERSAL_NEWLINES 1
-
/* Define if you want documentation strings in extension modules */
#define WITH_DOC_STRINGS 1
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
index e8b65c7..54c98d1 100644
--- a/PC/pyconfig.h
+++ b/PC/pyconfig.h
@@ -397,9 +397,6 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* Use Python's own small-block memory-allocator. */
#define WITH_PYMALLOC 1
-/* Enable \n, \r, \r\n line ends on import; also the 'U' mode flag for open. */
-#define WITH_UNIVERSAL_NEWLINES 1
-
/* Define if you have clock. */
/* #define HAVE_CLOCK */
diff --git a/Parser/pgenmain.c b/Parser/pgenmain.c
index f217053..64485eb 100644
--- a/Parser/pgenmain.c
+++ b/Parser/pgenmain.c
@@ -145,14 +145,12 @@ PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
return PyMem_REALLOC(p, n+1);
}
-#ifdef WITH_UNIVERSAL_NEWLINES
/* No-nonsense fgets */
char *
Py_UniversalNewlineFgets(char *buf, int n, FILE *stream, PyObject *fobj)
{
return fgets(buf, n, stream);
}
-#endif
#include <stdarg.h>
diff --git a/RISCOS/pyconfig.h b/RISCOS/pyconfig.h
index 9836b45..9d59e83 100644
--- a/RISCOS/pyconfig.h
+++ b/RISCOS/pyconfig.h
@@ -226,9 +226,6 @@
one supplied by Python itself. (see Include/unicodectype.h). */
#undef WANT_WCTYPE_FUNCTIONS
-/* Define if you want to read files with foreign newlines. */
-#define WITH_UNIVERSAL_NEWLINES 1
-
/* Define if you want documentation strings in extension modules */
#define WITH_DOC_STRINGS 1
diff --git a/configure b/configure
index 6fac192..a5ffac8 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 1.449 .
+# From configure.in Revision: 1.450 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57 for python 2.4.
#
@@ -866,8 +866,6 @@ Optional Packages:
--with(out)-thread[=DIRECTORY]
deprecated; use --with(out)-threads
--with-pth use GNU pth threading libraries
- --with(out)-universal-newlines
- disable/enable foreign newlines
--with(out)-doc-strings disable/enable documentation strings
--with(out)-pymalloc disable/enable specialized mallocs
--with-wctype-functions use wctype.h functions
@@ -11961,33 +11959,6 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
fi
fi
-# Check for universal newline support
-echo "$as_me:$LINENO: checking for --with-universal-newlines" >&5
-echo $ECHO_N "checking for --with-universal-newlines... $ECHO_C" >&6
-
-# Check whether --with-universal-newlines or --without-universal-newlines was given.
-if test "${with_universal_newlines+set}" = set; then
- withval="$with_universal_newlines"
-
-fi;
-
-if test -z "$with_universal_newlines"
-then with_universal_newlines="yes"
-fi
-if test "$with_universal_newlines" = "no"
-then
- echo --without-universal-newlines is unsupported, see README
- exit 1
-else
-
-cat >>confdefs.h <<\_ACEOF
-#define WITH_UNIVERSAL_NEWLINES 1
-_ACEOF
-
-fi
-echo "$as_me:$LINENO: result: $with_universal_newlines" >&5
-echo "${ECHO_T}$with_universal_newlines" >&6
-
# Check for --with-doc-strings
echo "$as_me:$LINENO: checking for --with-doc-strings" >&5
echo $ECHO_N "checking for --with-doc-strings... $ECHO_C" >&6
diff --git a/configure.in b/configure.in
index f05aed4..44a0390 100644
--- a/configure.in
+++ b/configure.in
@@ -1885,24 +1885,6 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
fi
fi
-# Check for universal newline support
-AC_MSG_CHECKING(for --with-universal-newlines)
-AC_ARG_WITH(universal-newlines,
- AC_HELP_STRING(--with(out)-universal-newlines, disable/enable foreign newlines))
-
-if test -z "$with_universal_newlines"
-then with_universal_newlines="yes"
-fi
-if test "$with_universal_newlines" = "no"
-then
- echo --without-universal-newlines is unsupported, see README
- exit 1
-else
- AC_DEFINE(WITH_UNIVERSAL_NEWLINES, 1,
- [Define if you want to read files with foreign newlines.])
-fi
-AC_MSG_RESULT($with_universal_newlines)
-
# Check for --with-doc-strings
AC_MSG_CHECKING(for --with-doc-strings)
AC_ARG_WITH(doc-strings,
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 1cb2281..6d422df 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -792,9 +792,6 @@
/* Define if you want to compile in rudimentary thread support */
#undef WITH_THREAD
-/* Define if you want to read files with foreign newlines. */
-#undef WITH_UNIVERSAL_NEWLINES
-
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN