Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
1e3bdf6c
Kaydet (Commit)
1e3bdf6c
authored
Eyl 04, 2003
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #788249: Pass an explicit buffer to setvbuf in PyFile_SetBufSize().
Fixes #603724. Will backport to 2.3.
üst
fa3bdea0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
fileobject.h
Include/fileobject.h
+1
-0
fileobject.c
Objects/fileobject.c
+19
-5
No files found.
Include/fileobject.h
Dosyayı görüntüle @
1e3bdf6c
...
@@ -19,6 +19,7 @@ typedef struct {
...
@@ -19,6 +19,7 @@ typedef struct {
char
*
f_buf
;
/* Allocated readahead buffer */
char
*
f_buf
;
/* Allocated readahead buffer */
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) */
#ifdef WITH_UNIVERSAL_NEWLINES
#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 */
...
...
Objects/fileobject.c
Dosyayı görüntüle @
1e3bdf6c
...
@@ -283,25 +283,37 @@ PyFile_FromString(char *name, char *mode)
...
@@ -283,25 +283,37 @@ PyFile_FromString(char *name, char *mode)
void
void
PyFile_SetBufSize
(
PyObject
*
f
,
int
bufsize
)
PyFile_SetBufSize
(
PyObject
*
f
,
int
bufsize
)
{
{
PyFileObject
*
file
=
(
PyFileObject
*
)
f
;
if
(
bufsize
>=
0
)
{
if
(
bufsize
>=
0
)
{
#ifdef HAVE_SETVBUF
int
type
;
int
type
;
switch
(
bufsize
)
{
switch
(
bufsize
)
{
case
0
:
case
0
:
type
=
_IONBF
;
type
=
_IONBF
;
break
;
break
;
#ifdef HAVE_SETVBUF
case
1
:
case
1
:
type
=
_IOLBF
;
type
=
_IOLBF
;
bufsize
=
BUFSIZ
;
bufsize
=
BUFSIZ
;
break
;
break
;
#endif
default:
default:
type
=
_IOFBF
;
type
=
_IOFBF
;
#ifndef HAVE_SETVBUF
bufsize
=
BUFSIZ
;
#endif
break
;
}
fflush
(
file
->
f_fp
);
if
(
type
==
_IONBF
)
{
PyMem_Free
(
file
->
f_setbuf
);
file
->
f_setbuf
=
NULL
;
}
else
{
file
->
f_setbuf
=
PyMem_Realloc
(
file
->
f_setbuf
,
bufsize
);
}
}
setvbuf
(((
PyFileObject
*
)
f
)
->
f_fp
,
(
char
*
)
NULL
,
#ifdef HAVE_SETVBUF
type
,
bufsize
);
setvbuf
(
file
->
f_fp
,
file
->
f_setbuf
,
type
,
bufsize
);
#else
/* !HAVE_SETVBUF */
#else
/* !HAVE_SETVBUF */
if
(
bufsize
<=
1
)
setbuf
(
file
->
f_fp
,
file
->
f_setbuf
);
setbuf
(((
PyFileObject
*
)
f
)
->
f_fp
,
(
char
*
)
NULL
);
#endif
/* !HAVE_SETVBUF */
#endif
/* !HAVE_SETVBUF */
}
}
}
}
...
@@ -376,6 +388,7 @@ static PyObject *
...
@@ -376,6 +388,7 @@ static PyObject *
file_close
(
PyFileObject
*
f
)
file_close
(
PyFileObject
*
f
)
{
{
int
sts
=
0
;
int
sts
=
0
;
PyMem_Free
(
f
->
f_setbuf
);
if
(
f
->
f_fp
!=
NULL
)
{
if
(
f
->
f_fp
!=
NULL
)
{
if
(
f
->
f_close
!=
NULL
)
{
if
(
f
->
f_close
!=
NULL
)
{
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
...
@@ -1928,6 +1941,7 @@ file_init(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -1928,6 +1941,7 @@ file_init(PyObject *self, PyObject *args, PyObject *kwds)
}
}
if
(
open_the_file
(
foself
,
name
,
mode
)
==
NULL
)
if
(
open_the_file
(
foself
,
name
,
mode
)
==
NULL
)
goto
Error
;
goto
Error
;
foself
->
f_setbuf
=
NULL
;
PyFile_SetBufSize
(
self
,
bufsize
);
PyFile_SetBufSize
(
self
,
bufsize
);
goto
Done
;
goto
Done
;
...
...
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