Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
db608050
Commit
db608050
authored
Feb 07, 2004
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove support for --without-universal-newlines (see PEP 11).
parent
f1afe668
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
7 additions
and
128 deletions
+7
-128
Include/fileobject.h
Include/fileobject.h
+1
-9
Misc/NEWS
Misc/NEWS
+5
-0
Modules/bz2module.c
Modules/bz2module.c
+0
-22
Objects/fileobject.c
Objects/fileobject.c
+0
-35
PC/os2emx/pyconfig.h
PC/os2emx/pyconfig.h
+0
-3
PC/pyconfig.h
PC/pyconfig.h
+0
-3
Parser/pgenmain.c
Parser/pgenmain.c
+0
-2
RISCOS/pyconfig.h
RISCOS/pyconfig.h
+0
-3
configure
configure
+1
-30
configure.in
configure.in
+0
-18
pyconfig.h.in
pyconfig.h.in
+0
-3
No files found.
Include/fileobject.h
View file @
db608050
...
@@ -20,11 +20,9 @@ typedef struct {
...
@@ -20,11 +20,9 @@ typedef struct {
char
*
f_bufend
;
/* Points after last occupied position */
char
*
f_bufend
;
/* Points after last occupied position */
char
*
f_bufptr
;
/* Current buffer position */
char
*
f_bufptr
;
/* Current buffer position */
char
*
f_setbuf
;
/* Buffer for setbuf(3) and setvbuf(3) */
char
*
f_setbuf
;
/* Buffer for setbuf(3) and setvbuf(3) */
#ifdef WITH_UNIVERSAL_NEWLINES
int
f_univ_newline
;
/* Handle any newline convention */
int
f_univ_newline
;
/* Handle any newline convention */
int
f_newlinetypes
;
/* Types of newlines seen */
int
f_newlinetypes
;
/* Types of newlines seen */
int
f_skipnextlf
;
/* Skip next \n */
int
f_skipnextlf
;
/* Skip next \n */
#endif
PyObject
*
f_encoding
;
PyObject
*
f_encoding
;
}
PyFileObject
;
}
PyFileObject
;
...
@@ -51,19 +49,13 @@ PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
...
@@ -51,19 +49,13 @@ PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
*/
*/
PyAPI_DATA
(
const
char
*
)
Py_FileSystemDefaultEncoding
;
PyAPI_DATA
(
const
char
*
)
Py_FileSystemDefaultEncoding
;
#ifdef WITH_UNIVERSAL_NEWLINES
/* Routines to replace fread() and fgets() which accept any of \r, \n
/* Routines to replace fread() and fgets() which accept any of \r, \n
or \r\n as line terminators.
or \r\n as line terminators.
*/
*/
#define PY_STDIOTEXTMODE "b"
#define PY_STDIOTEXTMODE "b"
char
*
Py_UniversalNewlineFgets
(
char
*
,
int
,
FILE
*
,
PyObject
*
);
char
*
Py_UniversalNewlineFgets
(
char
*
,
int
,
FILE
*
,
PyObject
*
);
size_t
Py_UniversalNewlineFread
(
char
*
,
size_t
,
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
#ifdef __cplusplus
}
}
#endif
#endif
...
...
Misc/NEWS
View file @
db608050
...
@@ -330,6 +330,11 @@ Tools/Demos
...
@@ -330,6 +330,11 @@ Tools/Demos
Build
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 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
- Support for systems requiring --with-dl-dld or --with-sgi-dl was removed
...
...
Modules/bz2module.c
View file @
db608050
...
@@ -73,13 +73,11 @@ static char __author__[] =
...
@@ -73,13 +73,11 @@ static char __author__[] =
#define RELEASE_LOCK(obj)
#define RELEASE_LOCK(obj)
#endif
#endif
#ifdef WITH_UNIVERSAL_NEWLINES
/* Bits in f_newlinetypes */
/* Bits in f_newlinetypes */
#define NEWLINE_UNKNOWN 0
/* No newline seen, yet */
#define NEWLINE_UNKNOWN 0
/* No newline seen, yet */
#define NEWLINE_CR 1
/* \r newline seen */
#define NEWLINE_CR 1
/* \r newline seen */
#define NEWLINE_LF 2
/* \n newline seen */
#define NEWLINE_LF 2
/* \n newline seen */
#define NEWLINE_CRLF 4
/* \r\n newline seen */
#define NEWLINE_CRLF 4
/* \r\n newline seen */
#endif
/* ===================================================================== */
/* ===================================================================== */
/* Structure definitions. */
/* Structure definitions. */
...
@@ -94,11 +92,9 @@ typedef struct {
...
@@ -94,11 +92,9 @@ typedef struct {
int
f_softspace
;
/* Flag used by 'print' command */
int
f_softspace
;
/* Flag used by 'print' command */
#ifdef WITH_UNIVERSAL_NEWLINES
int
f_univ_newline
;
/* Handle any newline convention */
int
f_univ_newline
;
/* Handle any newline convention */
int
f_newlinetypes
;
/* Types of newlines seen */
int
f_newlinetypes
;
/* Types of newlines seen */
int
f_skipnextlf
;
/* Skip next \n */
int
f_skipnextlf
;
/* Skip next \n */
#endif
BZFILE
*
fp
;
BZFILE
*
fp
;
int
mode
;
int
mode
;
...
@@ -227,11 +223,9 @@ Util_GetLine(BZ2FileObject *f, int n)
...
@@ -227,11 +223,9 @@ Util_GetLine(BZ2FileObject *f, int n)
size_t
increment
;
/* amount to increment the buffer */
size_t
increment
;
/* amount to increment the buffer */
PyObject
*
v
;
PyObject
*
v
;
int
bzerror
;
int
bzerror
;
#ifdef WITH_UNIVERSAL_NEWLINES
int
newlinetypes
=
f
->
f_newlinetypes
;
int
newlinetypes
=
f
->
f_newlinetypes
;
int
skipnextlf
=
f
->
f_skipnextlf
;
int
skipnextlf
=
f
->
f_skipnextlf
;
int
univ_newline
=
f
->
f_univ_newline
;
int
univ_newline
=
f
->
f_univ_newline
;
#endif
total_v_size
=
n
>
0
?
n
:
100
;
total_v_size
=
n
>
0
?
n
:
100
;
v
=
PyString_FromStringAndSize
((
char
*
)
NULL
,
total_v_size
);
v
=
PyString_FromStringAndSize
((
char
*
)
NULL
,
total_v_size
);
...
@@ -243,7 +237,6 @@ Util_GetLine(BZ2FileObject *f, int n)
...
@@ -243,7 +237,6 @@ Util_GetLine(BZ2FileObject *f, int n)
for
(;;)
{
for
(;;)
{
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
#ifdef WITH_UNIVERSAL_NEWLINES
if
(
univ_newline
)
{
if
(
univ_newline
)
{
while
(
1
)
{
while
(
1
)
{
BZ2_bzRead
(
&
bzerror
,
f
->
fp
,
&
c
,
1
);
BZ2_bzRead
(
&
bzerror
,
f
->
fp
,
&
c
,
1
);
...
@@ -277,17 +270,14 @@ Util_GetLine(BZ2FileObject *f, int n)
...
@@ -277,17 +270,14 @@ Util_GetLine(BZ2FileObject *f, int n)
if
(
bzerror
==
BZ_STREAM_END
&&
skipnextlf
)
if
(
bzerror
==
BZ_STREAM_END
&&
skipnextlf
)
newlinetypes
|=
NEWLINE_CR
;
newlinetypes
|=
NEWLINE_CR
;
}
else
/* If not universal newlines use the normal loop */
}
else
/* If not universal newlines use the normal loop */
#endif
do
{
do
{
BZ2_bzRead
(
&
bzerror
,
f
->
fp
,
&
c
,
1
);
BZ2_bzRead
(
&
bzerror
,
f
->
fp
,
&
c
,
1
);
f
->
pos
++
;
f
->
pos
++
;
*
buf
++
=
c
;
*
buf
++
=
c
;
}
while
(
bzerror
==
BZ_OK
&&
c
!=
'\n'
&&
buf
!=
end
);
}
while
(
bzerror
==
BZ_OK
&&
c
!=
'\n'
&&
buf
!=
end
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
#ifdef WITH_UNIVERSAL_NEWLINES
f
->
f_newlinetypes
=
newlinetypes
;
f
->
f_newlinetypes
=
newlinetypes
;
f
->
f_skipnextlf
=
skipnextlf
;
f
->
f_skipnextlf
=
skipnextlf
;
#endif
if
(
bzerror
==
BZ_STREAM_END
)
{
if
(
bzerror
==
BZ_STREAM_END
)
{
f
->
size
=
f
->
pos
;
f
->
size
=
f
->
pos
;
f
->
mode
=
MODE_READ_EOF
;
f
->
mode
=
MODE_READ_EOF
;
...
@@ -323,9 +313,6 @@ Util_GetLine(BZ2FileObject *f, int n)
...
@@ -323,9 +313,6 @@ Util_GetLine(BZ2FileObject *f, int n)
return
v
;
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
/* This is a hacked version of Python's
* fileobject.c:Py_UniversalNewlineFread(). */
* fileobject.c:Py_UniversalNewlineFread(). */
size_t
size_t
...
@@ -393,7 +380,6 @@ Util_UnivNewlineRead(int *bzerror, BZFILE *stream,
...
@@ -393,7 +380,6 @@ Util_UnivNewlineRead(int *bzerror, BZFILE *stream,
f
->
f_skipnextlf
=
skipnextlf
;
f
->
f_skipnextlf
=
skipnextlf
;
return
dst
-
buf
;
return
dst
-
buf
;
}
}
#endif
/* This is a hacked version of Python's fileobject.c:drop_readahead(). */
/* This is a hacked version of Python's fileobject.c:drop_readahead(). */
static
void
static
void
...
@@ -1190,7 +1176,6 @@ static PyMethodDef BZ2File_methods[] = {
...
@@ -1190,7 +1176,6 @@ static PyMethodDef BZ2File_methods[] = {
/* ===================================================================== */
/* ===================================================================== */
/* Getters and setters of BZ2File. */
/* Getters and setters of BZ2File. */
#ifdef WITH_UNIVERSAL_NEWLINES
/* This is a hacked version of Python's fileobject.c:get_newlines(). */
/* This is a hacked version of Python's fileobject.c:get_newlines(). */
static
PyObject
*
static
PyObject
*
BZ2File_get_newlines
(
BZ2FileObject
*
self
,
void
*
closure
)
BZ2File_get_newlines
(
BZ2FileObject
*
self
,
void
*
closure
)
...
@@ -1220,7 +1205,6 @@ BZ2File_get_newlines(BZ2FileObject *self, void *closure)
...
@@ -1220,7 +1205,6 @@ BZ2File_get_newlines(BZ2FileObject *self, void *closure)
return
NULL
;
return
NULL
;
}
}
}
}
#endif
static
PyObject
*
static
PyObject
*
BZ2File_get_closed
(
BZ2FileObject
*
self
,
void
*
closure
)
BZ2File_get_closed
(
BZ2FileObject
*
self
,
void
*
closure
)
...
@@ -1243,10 +1227,8 @@ BZ2File_get_name(BZ2FileObject *self, void *closure)
...
@@ -1243,10 +1227,8 @@ BZ2File_get_name(BZ2FileObject *self, void *closure)
static
PyGetSetDef
BZ2File_getset
[]
=
{
static
PyGetSetDef
BZ2File_getset
[]
=
{
{
"closed"
,
(
getter
)
BZ2File_get_closed
,
NULL
,
{
"closed"
,
(
getter
)
BZ2File_get_closed
,
NULL
,
"True if the file is closed"
},
"True if the file is closed"
},
#ifdef WITH_UNIVERSAL_NEWLINES
{
"newlines"
,
(
getter
)
BZ2File_get_newlines
,
NULL
,
{
"newlines"
,
(
getter
)
BZ2File_get_newlines
,
NULL
,
"end-of-line convention used in this file"
},
"end-of-line convention used in this file"
},
#endif
{
"mode"
,
(
getter
)
BZ2File_get_mode
,
NULL
,
{
"mode"
,
(
getter
)
BZ2File_get_mode
,
NULL
,
"file mode ('r', 'w', or 'U')"
},
"file mode ('r', 'w', or 'U')"
},
{
"name"
,
(
getter
)
BZ2File_get_name
,
NULL
,
{
"name"
,
(
getter
)
BZ2File_get_name
,
NULL
,
...
@@ -1309,9 +1291,7 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
...
@@ -1309,9 +1291,7 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
break
;
break
;
case
'U'
:
case
'U'
:
#ifdef WITH_UNIVERSAL_NEWLINES
self
->
f_univ_newline
=
1
;
self
->
f_univ_newline
=
1
;
#endif
break
;
break
;
default:
default:
...
@@ -1441,7 +1421,6 @@ exist, and truncated otherwise. If the buffering argument is given, 0 means\n\
...
@@ -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
\
unbuffered, and larger numbers specify the buffer size. If compresslevel
\n
\
is given, must be a number between 1 and 9.
\n
\
is given, must be a number between 1 and 9.
\n
\
"
)
"
)
#ifdef WITH_UNIVERSAL_NEWLINES
PyDoc_STR
(
PyDoc_STR
(
"
\n
\
"
\n
\
Add a 'U' to mode to open the file for input with universal newline
\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\
...
@@ -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
\
'
\\
r
\\
n' or a tuple containing all the newline types seen. Universal
\n
\
newlines are available only when reading.
\n
\
newlines are available only when reading.
\n
\
"
)
"
)
#endif
;
;
static
PyTypeObject
BZ2File_Type
=
{
static
PyTypeObject
BZ2File_Type
=
{
...
...
Objects/fileobject.c
View file @
db608050
...
@@ -41,13 +41,11 @@
...
@@ -41,13 +41,11 @@
#define FUNLOCKFILE(f)
#define FUNLOCKFILE(f)
#endif
#endif
#ifdef WITH_UNIVERSAL_NEWLINES
/* Bits in f_newlinetypes */
/* Bits in f_newlinetypes */
#define NEWLINE_UNKNOWN 0
/* No newline seen, yet */
#define NEWLINE_UNKNOWN 0
/* No newline seen, yet */
#define NEWLINE_CR 1
/* \r newline seen */
#define NEWLINE_CR 1
/* \r newline seen */
#define NEWLINE_LF 2
/* \n newline seen */
#define NEWLINE_LF 2
/* \n newline seen */
#define NEWLINE_CRLF 4
/* \r\n newline seen */
#define NEWLINE_CRLF 4
/* \r\n newline seen */
#endif
FILE
*
FILE
*
PyFile_AsFile
(
PyObject
*
f
)
PyFile_AsFile
(
PyObject
*
f
)
...
@@ -119,11 +117,9 @@ fill_file_fields(PyFileObject *f, FILE *fp, char *name, char *mode,
...
@@ -119,11 +117,9 @@ fill_file_fields(PyFileObject *f, FILE *fp, char *name, char *mode,
f
->
f_softspace
=
0
;
f
->
f_softspace
=
0
;
f
->
f_binary
=
strchr
(
mode
,
'b'
)
!=
NULL
;
f
->
f_binary
=
strchr
(
mode
,
'b'
)
!=
NULL
;
f
->
f_buf
=
NULL
;
f
->
f_buf
=
NULL
;
#ifdef WITH_UNIVERSAL_NEWLINES
f
->
f_univ_newline
=
(
strchr
(
mode
,
'U'
)
!=
NULL
);
f
->
f_univ_newline
=
(
strchr
(
mode
,
'U'
)
!=
NULL
);
f
->
f_newlinetypes
=
NEWLINE_UNKNOWN
;
f
->
f_newlinetypes
=
NEWLINE_UNKNOWN
;
f
->
f_skipnextlf
=
0
;
f
->
f_skipnextlf
=
0
;
#endif
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
f
->
f_encoding
=
Py_None
;
f
->
f_encoding
=
Py_None
;
...
@@ -165,17 +161,8 @@ open_the_file(PyFileObject *f, char *name, char *mode)
...
@@ -165,17 +161,8 @@ open_the_file(PyFileObject *f, char *name, char *mode)
else
else
#endif
#endif
{
{
#ifdef WITH_UNIVERSAL_NEWLINES
if
(
strcmp
(
mode
,
"U"
)
==
0
||
strcmp
(
mode
,
"rU"
)
==
0
)
if
(
strcmp
(
mode
,
"U"
)
==
0
||
strcmp
(
mode
,
"rU"
)
==
0
)
mode
=
"rb"
;
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
#ifdef MS_WINDOWS
if
(
PyUnicode_Check
(
f
->
f_name
))
{
if
(
PyUnicode_Check
(
f
->
f_name
))
{
PyObject
*
wmode
;
PyObject
*
wmode
;
...
@@ -494,9 +481,7 @@ file_seek(PyFileObject *f, PyObject *args)
...
@@ -494,9 +481,7 @@ file_seek(PyFileObject *f, PyObject *args)
clearerr
(
f
->
f_fp
);
clearerr
(
f
->
f_fp
);
return
NULL
;
return
NULL
;
}
}
#ifdef WITH_UNIVERSAL_NEWLINES
f
->
f_skipnextlf
=
0
;
f
->
f_skipnextlf
=
0
;
#endif
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
}
}
...
@@ -629,7 +614,6 @@ file_tell(PyFileObject *f)
...
@@ -629,7 +614,6 @@ file_tell(PyFileObject *f)
clearerr
(
f
->
f_fp
);
clearerr
(
f
->
f_fp
);
return
NULL
;
return
NULL
;
}
}
#ifdef WITH_UNIVERSAL_NEWLINES
if
(
f
->
f_skipnextlf
)
{
if
(
f
->
f_skipnextlf
)
{
int
c
;
int
c
;
c
=
GETC
(
f
->
f_fp
);
c
=
GETC
(
f
->
f_fp
);
...
@@ -638,7 +622,6 @@ file_tell(PyFileObject *f)
...
@@ -638,7 +622,6 @@ file_tell(PyFileObject *f)
f
->
f_skipnextlf
=
0
;
f
->
f_skipnextlf
=
0
;
}
else
if
(
c
!=
EOF
)
ungetc
(
c
,
f
->
f_fp
);
}
else
if
(
c
!=
EOF
)
ungetc
(
c
,
f
->
f_fp
);
}
}
#endif
#if !defined(HAVE_LARGEFILE_SUPPORT)
#if !defined(HAVE_LARGEFILE_SUPPORT)
return
PyInt_FromLong
(
pos
);
return
PyInt_FromLong
(
pos
);
#else
#else
...
@@ -1070,18 +1053,12 @@ get_line(PyFileObject *f, int n)
...
@@ -1070,18 +1053,12 @@ get_line(PyFileObject *f, int n)
size_t
used_v_size
;
/* # used slots in buffer */
size_t
used_v_size
;
/* # used slots in buffer */
size_t
increment
;
/* amount to increment the buffer */
size_t
increment
;
/* amount to increment the buffer */
PyObject
*
v
;
PyObject
*
v
;
#ifdef WITH_UNIVERSAL_NEWLINES
int
newlinetypes
=
f
->
f_newlinetypes
;
int
newlinetypes
=
f
->
f_newlinetypes
;
int
skipnextlf
=
f
->
f_skipnextlf
;
int
skipnextlf
=
f
->
f_skipnextlf
;
int
univ_newline
=
f
->
f_univ_newline
;
int
univ_newline
=
f
->
f_univ_newline
;
#endif
#if defined(USE_FGETS_IN_GETLINE)
#if defined(USE_FGETS_IN_GETLINE)
#ifdef WITH_UNIVERSAL_NEWLINES
if
(
n
<=
0
&&
!
univ_newline
)
if
(
n
<=
0
&&
!
univ_newline
)
#else
if
(
n
<=
0
)
#endif
return
getline_via_fgets
(
fp
);
return
getline_via_fgets
(
fp
);
#endif
#endif
total_v_size
=
n
>
0
?
n
:
100
;
total_v_size
=
n
>
0
?
n
:
100
;
...
@@ -1094,7 +1071,6 @@ get_line(PyFileObject *f, int n)
...
@@ -1094,7 +1071,6 @@ get_line(PyFileObject *f, int n)
for
(;;)
{
for
(;;)
{
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
FLOCKFILE
(
fp
);
FLOCKFILE
(
fp
);
#ifdef WITH_UNIVERSAL_NEWLINES
if
(
univ_newline
)
{
if
(
univ_newline
)
{
c
=
'x'
;
/* Shut up gcc warning */
c
=
'x'
;
/* Shut up gcc warning */
while
(
buf
!=
end
&&
(
c
=
GETC
(
fp
))
!=
EOF
)
{
while
(
buf
!=
end
&&
(
c
=
GETC
(
fp
))
!=
EOF
)
{
...
@@ -1123,17 +1099,14 @@ get_line(PyFileObject *f, int n)
...
@@ -1123,17 +1099,14 @@ get_line(PyFileObject *f, int n)
if
(
c
==
EOF
&&
skipnextlf
)
if
(
c
==
EOF
&&
skipnextlf
)
newlinetypes
|=
NEWLINE_CR
;
newlinetypes
|=
NEWLINE_CR
;
}
else
/* If not universal newlines use the normal loop */
}
else
/* If not universal newlines use the normal loop */
#endif
while
((
c
=
GETC
(
fp
))
!=
EOF
&&
while
((
c
=
GETC
(
fp
))
!=
EOF
&&
(
*
buf
++
=
c
)
!=
'\n'
&&
(
*
buf
++
=
c
)
!=
'\n'
&&
buf
!=
end
)
buf
!=
end
)
;
;
FUNLOCKFILE
(
fp
);
FUNLOCKFILE
(
fp
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
#ifdef WITH_UNIVERSAL_NEWLINES
f
->
f_newlinetypes
=
newlinetypes
;
f
->
f_newlinetypes
=
newlinetypes
;
f
->
f_skipnextlf
=
skipnextlf
;
f
->
f_skipnextlf
=
skipnextlf
;
#endif
if
(
c
==
'\n'
)
if
(
c
==
'\n'
)
break
;
break
;
if
(
c
==
EOF
)
{
if
(
c
==
EOF
)
{
...
@@ -1677,7 +1650,6 @@ get_closed(PyFileObject *f, void *closure)
...
@@ -1677,7 +1650,6 @@ get_closed(PyFileObject *f, void *closure)
{
{
return
PyBool_FromLong
((
long
)(
f
->
f_fp
==
0
));
return
PyBool_FromLong
((
long
)(
f
->
f_fp
==
0
));
}
}
#ifdef WITH_UNIVERSAL_NEWLINES
static
PyObject
*
static
PyObject
*
get_newlines
(
PyFileObject
*
f
,
void
*
closure
)
get_newlines
(
PyFileObject
*
f
,
void
*
closure
)
{
{
...
@@ -1706,14 +1678,11 @@ get_newlines(PyFileObject *f, void *closure)
...
@@ -1706,14 +1678,11 @@ get_newlines(PyFileObject *f, void *closure)
return
NULL
;
return
NULL
;
}
}
}
}
#endif
static
PyGetSetDef
file_getsetlist
[]
=
{
static
PyGetSetDef
file_getsetlist
[]
=
{
{
"closed"
,
(
getter
)
get_closed
,
NULL
,
"True if the file is closed"
},
{
"closed"
,
(
getter
)
get_closed
,
NULL
,
"True if the file is closed"
},
#ifdef WITH_UNIVERSAL_NEWLINES
{
"newlines"
,
(
getter
)
get_newlines
,
NULL
,
{
"newlines"
,
(
getter
)
get_newlines
,
NULL
,
"end-of-line convention used in this file"
},
"end-of-line convention used in this file"
},
#endif
{
0
},
{
0
},
};
};
...
@@ -1931,7 +1900,6 @@ PyDoc_STR(
...
@@ -1931,7 +1900,6 @@ PyDoc_STR(
"If the buffering argument is given, 0 means unbuffered, 1 means line
\n
"
"If the buffering argument is given, 0 means unbuffered, 1 means line
\n
"
"buffered, and larger numbers specify the buffer size.
\n
"
"buffered, and larger numbers specify the buffer size.
\n
"
)
)
#ifdef WITH_UNIVERSAL_NEWLINES
PyDoc_STR
(
PyDoc_STR
(
"Add a 'U' to mode to open the file for input with universal newline
\n
"
"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
"
"support. Any line ending in the input file will be seen as a '
\\
n'
\n
"
...
@@ -1941,7 +1909,6 @@ PyDoc_STR(
...
@@ -1941,7 +1909,6 @@ PyDoc_STR(
"
\n
"
"
\n
"
"'U' cannot be combined with 'w' or '+' mode.
\n
"
"'U' cannot be combined with 'w' or '+' mode.
\n
"
)
)
#endif
/* WITH_UNIVERSAL_NEWLINES */
PyDoc_STR
(
PyDoc_STR
(
"
\n
"
"
\n
"
"Note: open() is an alias for file()."
"Note: open() is an alias for file()."
...
@@ -2181,7 +2148,6 @@ int PyObject_AsFileDescriptor(PyObject *o)
...
@@ -2181,7 +2148,6 @@ int PyObject_AsFileDescriptor(PyObject *o)
return
fd
;
return
fd
;
}
}
#ifdef WITH_UNIVERSAL_NEWLINES
/* From here on we need access to the real fgets and fread */
/* From here on we need access to the real fgets and fread */
#undef fgets
#undef fgets
#undef fread
#undef fread
...
@@ -2359,4 +2325,3 @@ Py_UniversalNewlineFread(char *buf, size_t n,
...
@@ -2359,4 +2325,3 @@ Py_UniversalNewlineFread(char *buf, size_t n,
f
->
f_skipnextlf
=
skipnextlf
;
f
->
f_skipnextlf
=
skipnextlf
;
return
dst
-
buf
;
return
dst
-
buf
;
}
}
#endif
PC/os2emx/pyconfig.h
View file @
db608050
...
@@ -53,9 +53,6 @@
...
@@ -53,9 +53,6 @@
/* enable the GC module */
/* enable the GC module */
#define WITH_CYCLE_GC 1
#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 if you want documentation strings in extension modules */
#define WITH_DOC_STRINGS 1
#define WITH_DOC_STRINGS 1
...
...
PC/pyconfig.h
View file @
db608050
...
@@ -397,9 +397,6 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
...
@@ -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. */
/* Use Python's own small-block memory-allocator. */
#define WITH_PYMALLOC 1
#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 if you have clock. */
/* #define HAVE_CLOCK */
/* #define HAVE_CLOCK */
...
...
Parser/pgenmain.c
View file @
db608050
...
@@ -145,14 +145,12 @@ PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
...
@@ -145,14 +145,12 @@ PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
return
PyMem_REALLOC
(
p
,
n
+
1
);
return
PyMem_REALLOC
(
p
,
n
+
1
);
}
}
#ifdef WITH_UNIVERSAL_NEWLINES
/* No-nonsense fgets */
/* No-nonsense fgets */
char
*
char
*
Py_UniversalNewlineFgets
(
char
*
buf
,
int
n
,
FILE
*
stream
,
PyObject
*
fobj
)
Py_UniversalNewlineFgets
(
char
*
buf
,
int
n
,
FILE
*
stream
,
PyObject
*
fobj
)
{
{
return
fgets
(
buf
,
n
,
stream
);
return
fgets
(
buf
,
n
,
stream
);
}
}
#endif
#include <stdarg.h>
#include <stdarg.h>
...
...
RISCOS/pyconfig.h
View file @
db608050
...
@@ -226,9 +226,6 @@
...
@@ -226,9 +226,6 @@
one supplied by Python itself. (see Include/unicodectype.h). */
one supplied by Python itself. (see Include/unicodectype.h). */
#undef WANT_WCTYPE_FUNCTIONS
#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 if you want documentation strings in extension modules */
#define WITH_DOC_STRINGS 1
#define WITH_DOC_STRINGS 1
...
...
configure
View file @
db608050
#! /bin/sh
#! /bin/sh
# From configure.in Revision: 1.4
49
.
# From configure.in Revision: 1.4
50
.
# Guess values for system-dependent variables and create Makefiles.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57 for python 2.4.
# Generated by GNU Autoconf 2.57 for python 2.4.
#
#
...
@@ -866,8 +866,6 @@ Optional Packages:
...
@@ -866,8 +866,6 @@ Optional Packages:
--with(out)-thread[=DIRECTORY]
--with(out)-thread[=DIRECTORY]
deprecated; use --with(out)-threads
deprecated; use --with(out)-threads
--with-pth use GNU pth threading libraries
--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)-doc-strings disable/enable documentation strings
--with(out)-pymalloc disable/enable specialized mallocs
--with(out)-pymalloc disable/enable specialized mallocs
--with-wctype-functions use wctype.h functions
--with-wctype-functions use wctype.h functions
...
@@ -11961,33 +11959,6 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
...
@@ -11961,33 +11959,6 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
fi
fi
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
# Check for --with-doc-strings
echo
"
$as_me
:
$LINENO
: checking for --with-doc-strings"
>
&5
echo
"
$as_me
:
$LINENO
: checking for --with-doc-strings"
>
&5
echo
$ECHO_N
"checking for --with-doc-strings...
$ECHO_C
"
>
&6
echo
$ECHO_N
"checking for --with-doc-strings...
$ECHO_C
"
>
&6
...
...
configure.in
View file @
db608050
...
@@ -1885,24 +1885,6 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
...
@@ -1885,24 +1885,6 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
fi
fi
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
# Check for --with-doc-strings
AC_MSG_CHECKING(for --with-doc-strings)
AC_MSG_CHECKING(for --with-doc-strings)
AC_ARG_WITH(doc-strings,
AC_ARG_WITH(doc-strings,
...
...
pyconfig.h.in
View file @
db608050
...
@@ -792,9 +792,6 @@
...
@@ -792,9 +792,6 @@
/* Define if you want to compile in rudimentary thread support */
/* Define if you want to compile in rudimentary thread support */
#undef WITH_THREAD
#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
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
#undef WORDS_BIGENDIAN
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment