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
35ee948f
Kaydet (Commit)
35ee948f
authored
Eyl 13, 2016
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
restructure fp_setreadl so as to avoid refleaks (closes #27981)
üst
7927e757
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
tokenizer.c
Parser/tokenizer.c
+17
-15
No files found.
Parser/tokenizer.c
Dosyayı görüntüle @
35ee948f
...
...
@@ -497,16 +497,12 @@ error:
static
int
fp_setreadl
(
struct
tok_state
*
tok
,
const
char
*
enc
)
{
PyObject
*
readline
=
NULL
,
*
stream
=
NULL
,
*
io
=
NULL
;
PyObject
*
readline
,
*
io
,
*
stream
;
_Py_IDENTIFIER
(
open
);
_Py_IDENTIFIER
(
readline
);
int
fd
;
long
pos
;
io
=
PyImport_ImportModuleNoBlock
(
"io"
);
if
(
io
==
NULL
)
goto
cleanup
;
fd
=
fileno
(
tok
->
fp
);
/* Due to buffering the file offset for fd can be different from the file
* position of tok->fp. If tok->fp was opened in text mode on Windows,
...
...
@@ -517,27 +513,33 @@ fp_setreadl(struct tok_state *tok, const char* enc)
if
(
pos
==
-
1
||
lseek
(
fd
,
(
off_t
)(
pos
>
0
?
pos
-
1
:
pos
),
SEEK_SET
)
==
(
off_t
)
-
1
)
{
PyErr_SetFromErrnoWithFilename
(
PyExc_OSError
,
NULL
);
goto
cleanup
;
return
0
;
}
io
=
PyImport_ImportModuleNoBlock
(
"io"
);
if
(
io
==
NULL
)
return
0
;
stream
=
_PyObject_CallMethodId
(
io
,
&
PyId_open
,
"isisOOO"
,
fd
,
"r"
,
-
1
,
enc
,
Py_None
,
Py_None
,
Py_False
);
Py_DECREF
(
io
);
if
(
stream
==
NULL
)
goto
cleanup
;
return
0
;
readline
=
_PyObject_GetAttrId
(
stream
,
&
PyId_readline
);
Py_DECREF
(
stream
);
if
(
readline
==
NULL
)
return
0
;
Py_XSETREF
(
tok
->
decoding_readline
,
readline
);
if
(
pos
>
0
)
{
if
(
PyObject_CallObject
(
readline
,
NULL
)
==
NULL
)
{
readline
=
NULL
;
goto
cleanup
;
}
PyObject
*
bufobj
=
PyObject_CallObject
(
readline
,
NULL
);
if
(
bufobj
==
NULL
)
return
0
;
Py_DECREF
(
bufobj
);
}
cleanup:
Py_XDECREF
(
stream
);
Py_XDECREF
(
io
);
return
readline
!=
NULL
;
return
1
;
}
/* Fetch the next byte from TOK. */
...
...
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