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
c9a59e6e
Kaydet (Commit)
c9a59e6e
authored
Nis 15, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #26764: Fixed SystemError in bytes.__rmod__.
üst
cda80940
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
32 deletions
+15
-32
test_bytes.py
Lib/test/test_bytes.py
+11
-26
bytesobject.c
Objects/bytesobject.c
+4
-6
No files found.
Lib/test/test_bytes.py
Dosyayı görüntüle @
c9a59e6e
...
@@ -483,26 +483,33 @@ class BaseBytesTest:
...
@@ -483,26 +483,33 @@ class BaseBytesTest:
self
.
assertRaises
(
ValueError
,
b
.
rindex
,
w
,
1
,
3
)
self
.
assertRaises
(
ValueError
,
b
.
rindex
,
w
,
1
,
3
)
def
test_mod
(
self
):
def
test_mod
(
self
):
b
=
b
'hello,
%
b!'
b
=
self
.
type2test
(
b
'hello,
%
b!'
)
orig
=
b
orig
=
b
b
=
b
%
b
'world'
b
=
b
%
b
'world'
self
.
assertEqual
(
b
,
b
'hello, world!'
)
self
.
assertEqual
(
b
,
b
'hello, world!'
)
self
.
assertEqual
(
orig
,
b
'hello,
%
b!'
)
self
.
assertEqual
(
orig
,
b
'hello,
%
b!'
)
self
.
assertFalse
(
b
is
orig
)
self
.
assertFalse
(
b
is
orig
)
b
=
b
'
%
s / 100 =
%
d
%%
'
b
=
self
.
type2test
(
b
'
%
s / 100 =
%
d
%%
'
)
a
=
b
%
(
b
'seventy-nine'
,
79
)
a
=
b
%
(
b
'seventy-nine'
,
79
)
self
.
assertEqual
(
a
,
b
'seventy-nine / 100 = 79
%
'
)
self
.
assertEqual
(
a
,
b
'seventy-nine / 100 = 79
%
'
)
self
.
assertIs
(
type
(
a
),
bytes
)
def
test_imod
(
self
):
def
test_imod
(
self
):
b
=
b
'hello,
%
b!'
b
=
self
.
type2test
(
b
'hello,
%
b!'
)
orig
=
b
orig
=
b
b
%=
b
'world'
b
%=
b
'world'
self
.
assertEqual
(
b
,
b
'hello, world!'
)
self
.
assertEqual
(
b
,
b
'hello, world!'
)
self
.
assertEqual
(
orig
,
b
'hello,
%
b!'
)
self
.
assertEqual
(
orig
,
b
'hello,
%
b!'
)
self
.
assertFalse
(
b
is
orig
)
self
.
assertFalse
(
b
is
orig
)
b
=
b
'
%
s / 100 =
%
d
%%
'
b
=
self
.
type2test
(
b
'
%
s / 100 =
%
d
%%
'
)
b
%=
(
b
'seventy-nine'
,
79
)
b
%=
(
b
'seventy-nine'
,
79
)
self
.
assertEqual
(
b
,
b
'seventy-nine / 100 = 79
%
'
)
self
.
assertEqual
(
b
,
b
'seventy-nine / 100 = 79
%
'
)
self
.
assertIs
(
type
(
b
),
bytes
)
def
test_rmod
(
self
):
with
self
.
assertRaises
(
TypeError
):
object
()
%
self
.
type2test
(
b
'abc'
)
self
.
assertIs
(
self
.
type2test
(
b
'abc'
)
.
__rmod__
(
'
%
r'
),
NotImplemented
)
def
test_replace
(
self
):
def
test_replace
(
self
):
b
=
self
.
type2test
(
b
'mississippi'
)
b
=
self
.
type2test
(
b
'mississippi'
)
...
@@ -1064,28 +1071,6 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
...
@@ -1064,28 +1071,6 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
b
[
8
:]
=
b
b
[
8
:]
=
b
self
.
assertEqual
(
b
,
bytearray
(
list
(
range
(
8
))
+
list
(
range
(
256
))))
self
.
assertEqual
(
b
,
bytearray
(
list
(
range
(
8
))
+
list
(
range
(
256
))))
def
test_mod
(
self
):
b
=
bytearray
(
b
'hello,
%
b!'
)
orig
=
b
b
=
b
%
b
'world'
self
.
assertEqual
(
b
,
b
'hello, world!'
)
self
.
assertEqual
(
orig
,
bytearray
(
b
'hello,
%
b!'
))
self
.
assertFalse
(
b
is
orig
)
b
=
bytearray
(
b
'
%
s / 100 =
%
d
%%
'
)
a
=
b
%
(
b
'seventy-nine'
,
79
)
self
.
assertEqual
(
a
,
bytearray
(
b
'seventy-nine / 100 = 79
%
'
))
def
test_imod
(
self
):
b
=
bytearray
(
b
'hello,
%
b!'
)
orig
=
b
b
%=
b
'world'
self
.
assertEqual
(
b
,
b
'hello, world!'
)
self
.
assertEqual
(
orig
,
bytearray
(
b
'hello,
%
b!'
))
self
.
assertFalse
(
b
is
orig
)
b
=
bytearray
(
b
'
%
s / 100 =
%
d
%%
'
)
b
%=
(
b
'seventy-nine'
,
79
)
self
.
assertEqual
(
b
,
bytearray
(
b
'seventy-nine / 100 = 79
%
'
))
def
test_iconcat
(
self
):
def
test_iconcat
(
self
):
b
=
bytearray
(
b
"abc"
)
b
=
bytearray
(
b
"abc"
)
b1
=
b
b1
=
b
...
...
Objects/bytesobject.c
Dosyayı görüntüle @
c9a59e6e
...
@@ -3282,15 +3282,13 @@ bytes_methods[] = {
...
@@ -3282,15 +3282,13 @@ bytes_methods[] = {
};
};
static
PyObject
*
static
PyObject
*
bytes_mod
(
PyObject
*
self
,
PyObject
*
arg
s
)
bytes_mod
(
PyObject
*
self
,
PyObject
*
arg
)
{
{
if
(
self
==
NULL
||
!
PyBytes_Check
(
self
))
{
if
(
!
PyBytes_Check
(
self
))
{
PyErr_BadInternalCall
();
Py_RETURN_NOTIMPLEMENTED
;
return
NULL
;
}
}
return
_PyBytes_FormatEx
(
PyBytes_AS_STRING
(
self
),
PyBytes_GET_SIZE
(
self
),
return
_PyBytes_FormatEx
(
PyBytes_AS_STRING
(
self
),
PyBytes_GET_SIZE
(
self
),
arg
s
,
0
);
arg
,
0
);
}
}
static
PyNumberMethods
bytes_as_number
=
{
static
PyNumberMethods
bytes_as_number
=
{
...
...
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