]> granicus.if.org Git - python/commitdiff
Remove support for --without-universal-newlines (see PEP 11).
authorSkip Montanaro <skip@pobox.com>
Sat, 7 Feb 2004 13:53:46 +0000 (13:53 +0000)
committerSkip Montanaro <skip@pobox.com>
Sat, 7 Feb 2004 13:53:46 +0000 (13:53 +0000)
Include/fileobject.h
Misc/NEWS
Modules/bz2module.c
Objects/fileobject.c
PC/os2emx/pyconfig.h
PC/pyconfig.h
Parser/pgenmain.c
RISCOS/pyconfig.h
configure
configure.in
pyconfig.h.in

index 2ec4b24a2b819381b1cecadeefbc284317d2ee68..35b2c3dffcc638c086f76933c07a767720ff72e2 100644 (file)
@@ -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
index f7f6ffbb02cc2b29e2892491d32c45028e2d3e30..939ce6625188a60e18d7baea6b2f47eb15eeee02 100644 (file)
--- 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
index 408c736ab6de3a85f83a7ad4927af004b0aaa036..82d35ae32ba219fc49029ce48b4ffd52edbd87e6 100644 (file)
@@ -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 = {
index 66e5f2865f6d314eae8d904e56e4125add2fe989..05c9f4a9b257bc0d68f2daef32475eaf23eb7c61 100644 (file)
 #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
index 044c0001ecc2863c6c88b098833cc734689655d0..a0817f8df7da0b15d7f8d2cdab1d442a0b2d92a6 100644 (file)
@@ -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
 
index e8b65c76a05a17cf63c1da34162e023d03bf574a..54c98d18d082eaa3e15621d718c127198d573a1d 100644 (file)
@@ -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 */
 
index f217053f0a62996e4432c34d3c81fb43850e6fa3..64485eb9dfe5e84b69cb080c13c6c6d6585a31d4 100644 (file)
@@ -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>
index 9836b45beb99368106f31c6ef6e17ea6f1625052..9d59e83d1640eb09d5ab645eac2cbe0579e568e7 100644 (file)
    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
 
index 6fac192ee689215c20acef1c3ac3faa54f279ba5..a5ffac8ed391ce6e250a0474deef176ed1c1722b 100755 (executable)
--- 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
index f05aed4ec04fb37baef64ed63e12d89b8d65734d..44a0390b0e46afc1330be4aae1c9bf2031dfcd34 100644 (file)
@@ -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,
index 1cb2281d7525ab45ed2b701b75752e61922b6e92..6d422df05e04c17add81412070f48bc48ea10116 100644 (file)
 /* 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