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
349fd521
Kaydet (Commit)
349fd521
authored
Nis 23, 2010
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #8468: bz2.BZ2File() accepts str with surrogates and bytes filenames
üst
13daf12b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
NEWS
Misc/NEWS
+2
-0
bz2module.c
Modules/bz2module.c
+8
-2
No files found.
Misc/NEWS
Dosyayı görüntüle @
349fd521
...
@@ -329,6 +329,8 @@ C-API
...
@@ -329,6 +329,8 @@ C-API
Library
Library
-------
-------
- Issue #8468: bz2.BZ2File() accepts str with surrogates and bytes filenames
- Issue #8451: Syslog module now uses basename(sys.argv[0]) instead of
- Issue #8451: Syslog module now uses basename(sys.argv[0]) instead of
the string "python" as the *ident*. openlog() arguments are all optional
the string "python" as the *ident*. openlog() arguments are all optional
and keywords.
and keywords.
...
...
Modules/bz2module.c
Dosyayı görüntüle @
349fd521
...
@@ -1162,6 +1162,7 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
...
@@ -1162,6 +1162,7 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
{
{
static
char
*
kwlist
[]
=
{
"filename"
,
"mode"
,
"buffering"
,
static
char
*
kwlist
[]
=
{
"filename"
,
"mode"
,
"buffering"
,
"compresslevel"
,
0
};
"compresslevel"
,
0
};
PyObject
*
name_obj
=
NULL
;
char
*
name
;
char
*
name
;
char
*
mode
=
"r"
;
char
*
mode
=
"r"
;
int
buffering
=
-
1
;
int
buffering
=
-
1
;
...
@@ -1171,14 +1172,17 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
...
@@ -1171,14 +1172,17 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
self
->
size
=
-
1
;
self
->
size
=
-
1
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"s|sii:BZ2File"
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O&|sii:BZ2File"
,
kwlist
,
&
name
,
&
mode
,
&
buffering
,
kwlist
,
PyUnicode_FSConverter
,
&
name_obj
,
&
mode
,
&
buffering
,
&
compresslevel
))
&
compresslevel
))
return
-
1
;
return
-
1
;
name
=
PyBytes_AsString
(
name_obj
);
if
(
compresslevel
<
1
||
compresslevel
>
9
)
{
if
(
compresslevel
<
1
||
compresslevel
>
9
)
{
PyErr_SetString
(
PyExc_ValueError
,
PyErr_SetString
(
PyExc_ValueError
,
"compresslevel must be between 1 and 9"
);
"compresslevel must be between 1 and 9"
);
Py_DECREF
(
name_obj
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1202,6 +1206,7 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
...
@@ -1202,6 +1206,7 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
if
(
error
)
{
if
(
error
)
{
PyErr_Format
(
PyExc_ValueError
,
PyErr_Format
(
PyExc_ValueError
,
"invalid mode char %c"
,
*
mode
);
"invalid mode char %c"
,
*
mode
);
Py_DECREF
(
name_obj
);
return
-
1
;
return
-
1
;
}
}
mode
++
;
mode
++
;
...
@@ -1216,6 +1221,7 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
...
@@ -1216,6 +1221,7 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
mode
=
(
mode_char
==
'r'
)
?
"rb"
:
"wb"
;
mode
=
(
mode_char
==
'r'
)
?
"rb"
:
"wb"
;
self
->
rawfp
=
fopen
(
name
,
mode
);
self
->
rawfp
=
fopen
(
name
,
mode
);
Py_DECREF
(
name_obj
);
if
(
self
->
rawfp
==
NULL
)
{
if
(
self
->
rawfp
==
NULL
)
{
PyErr_SetFromErrno
(
PyExc_IOError
);
PyErr_SetFromErrno
(
PyExc_IOError
);
return
-
1
;
return
-
1
;
...
...
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