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
e3737540
Kaydet (Commit)
e3737540
authored
Agu 24, 2014
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
don't segfault when trying to fdopen() a fd for a dir (closes #22259)
Patch from Brian Kearns.
üst
d3ea0653
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
test_posix.py
Lib/test/test_posix.py
+12
-0
NEWS
Misc/NEWS
+3
-0
posixmodule.c
Modules/posixmodule.c
+1
-1
No files found.
Lib/test/test_posix.py
Dosyayı görüntüle @
e3737540
...
...
@@ -194,6 +194,18 @@ class PosixTester(unittest.TestCase):
self
.
fdopen_helper
(
'r'
)
self
.
fdopen_helper
(
'r'
,
100
)
@unittest.skipUnless
(
hasattr
(
posix
,
'fdopen'
),
'test needs posix.fdopen()'
)
def
test_fdopen_directory
(
self
):
try
:
fd
=
os
.
open
(
'.'
,
os
.
O_RDONLY
)
except
OSError
as
e
:
self
.
assertEqual
(
e
.
errno
,
errno
.
EACCES
)
self
.
skipTest
(
"system cannot open directories"
)
with
self
.
assertRaises
(
IOError
)
as
cm
:
os
.
fdopen
(
fd
,
'r'
)
self
.
assertEqual
(
cm
.
exception
.
errno
,
errno
.
EISDIR
)
@unittest.skipUnless
(
hasattr
(
posix
,
'fdopen'
)
and
not
sys
.
platform
.
startswith
(
"sunos"
),
'test needs posix.fdopen()'
)
...
...
Misc/NEWS
Dosyayı görüntüle @
e3737540
...
...
@@ -19,6 +19,9 @@ Core and Builtins
Library
-------
- Issue #22259: Fix segfault when attempting to fopen a file descriptor
corresponding to a directory.
- Issue #22236: Fixed Tkinter images copying operations in NoDefaultRoot mode.
- Issue #22191: Fixed warnings.__all__.
...
...
Modules/posixmodule.c
Dosyayı görüntüle @
e3737540
...
...
@@ -6861,7 +6861,7 @@ posix_fdopen(PyObject *self, PyObject *args)
if
(
fstat
(
fd
,
&
buf
)
==
0
&&
S_ISDIR
(
buf
.
st_mode
))
{
PyMem_FREE
(
mode
);
msg
=
strerror
(
EISDIR
);
exc
=
PyObject_CallFunction
(
PyExc_IOError
,
"(is
O
)"
,
exc
=
PyObject_CallFunction
(
PyExc_IOError
,
"(is
s
)"
,
EISDIR
,
msg
,
"<fdopen>"
);
if
(
exc
)
{
PyErr_SetObject
(
PyExc_IOError
,
exc
);
...
...
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