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
5f1a5187
Kaydet (Commit)
5f1a5187
authored
Eyl 11, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use sequence repetition instead of bytes constructor with integer argument.
üst
ab874005
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
20 additions
and
20 deletions
+20
-20
base64.py
Lib/base64.py
+1
-1
gzip.py
Lib/gzip.py
+2
-2
hmac.py
Lib/hmac.py
+1
-1
pickletools.py
Lib/pickletools.py
+1
-1
test_bufio.py
Lib/test/test_bufio.py
+1
-1
test_bz2.py
Lib/test/test_bz2.py
+2
-2
test_gzip.py
Lib/test/test_gzip.py
+2
-2
test_io.py
Lib/test/test_io.py
+1
-1
test_ipaddress.py
Lib/test/test_ipaddress.py
+5
-5
test_lzma.py
Lib/test/test_lzma.py
+2
-2
test_socketserver.py
Lib/test/test_socketserver.py
+1
-1
test_wsgiref.py
Lib/test/test_wsgiref.py
+1
-1
No files found.
Lib/base64.py
Dosyayı görüntüle @
5f1a5187
...
@@ -155,7 +155,7 @@ def b32encode(s):
...
@@ -155,7 +155,7 @@ def b32encode(s):
leftover
=
len
(
s
)
%
5
leftover
=
len
(
s
)
%
5
# Pad the last quantum with zero bits if necessary
# Pad the last quantum with zero bits if necessary
if
leftover
:
if
leftover
:
s
=
s
+
b
ytes
(
5
-
leftover
)
# Don't use += !
s
=
s
+
b
'
\0
'
*
(
5
-
leftover
)
# Don't use += !
encoded
=
bytearray
()
encoded
=
bytearray
()
from_bytes
=
int
.
from_bytes
from_bytes
=
int
.
from_bytes
b32tab2
=
_b32tab2
b32tab2
=
_b32tab2
...
...
Lib/gzip.py
Dosyayı görüntüle @
5f1a5187
...
@@ -357,10 +357,10 @@ class GzipFile(_compression.BaseStream):
...
@@ -357,10 +357,10 @@ class GzipFile(_compression.BaseStream):
if
offset
<
self
.
offset
:
if
offset
<
self
.
offset
:
raise
OSError
(
'Negative seek in write mode'
)
raise
OSError
(
'Negative seek in write mode'
)
count
=
offset
-
self
.
offset
count
=
offset
-
self
.
offset
chunk
=
b
ytes
(
1024
)
chunk
=
b
'
\0
'
*
1024
for
i
in
range
(
count
//
1024
):
for
i
in
range
(
count
//
1024
):
self
.
write
(
chunk
)
self
.
write
(
chunk
)
self
.
write
(
b
ytes
(
count
%
1024
))
self
.
write
(
b
'
\0
'
*
(
count
%
1024
))
elif
self
.
mode
==
READ
:
elif
self
.
mode
==
READ
:
self
.
_check_not_closed
()
self
.
_check_not_closed
()
return
self
.
_buffer
.
seek
(
offset
,
whence
)
return
self
.
_buffer
.
seek
(
offset
,
whence
)
...
...
Lib/hmac.py
Dosyayı görüntüle @
5f1a5187
...
@@ -77,7 +77,7 @@ class HMAC:
...
@@ -77,7 +77,7 @@ class HMAC:
if
len
(
key
)
>
blocksize
:
if
len
(
key
)
>
blocksize
:
key
=
self
.
digest_cons
(
key
)
.
digest
()
key
=
self
.
digest_cons
(
key
)
.
digest
()
key
=
key
+
bytes
(
blocksize
-
len
(
key
)
)
key
=
key
.
ljust
(
blocksize
,
b
'
\0
'
)
self
.
outer
.
update
(
key
.
translate
(
trans_5C
))
self
.
outer
.
update
(
key
.
translate
(
trans_5C
))
self
.
inner
.
update
(
key
.
translate
(
trans_36
))
self
.
inner
.
update
(
key
.
translate
(
trans_36
))
if
msg
is
not
None
:
if
msg
is
not
None
:
...
...
Lib/pickletools.py
Dosyayı görüntüle @
5f1a5187
...
@@ -707,7 +707,7 @@ def read_unicodestring8(f):
...
@@ -707,7 +707,7 @@ def read_unicodestring8(f):
>>> enc = s.encode('utf-8')
>>> enc = s.encode('utf-8')
>>> enc
>>> enc
b'abcd\xea\xaf\x8d'
b'abcd\xea\xaf\x8d'
>>> n = bytes([len(enc)]) + b
ytes(7)
# little-endian 8-byte length
>>> n = bytes([len(enc)]) + b
'\0' * 7
# little-endian 8-byte length
>>> t = read_unicodestring8(io.BytesIO(n + enc + b'junk'))
>>> t = read_unicodestring8(io.BytesIO(n + enc + b'junk'))
>>> s == t
>>> s == t
True
True
...
...
Lib/test/test_bufio.py
Dosyayı görüntüle @
5f1a5187
...
@@ -59,7 +59,7 @@ class BufferSizeTest:
...
@@ -59,7 +59,7 @@ class BufferSizeTest:
self
.
drive_one
(
b
"1234567890
\00\01\02\03\04\05\06
"
)
self
.
drive_one
(
b
"1234567890
\00\01\02\03\04\05\06
"
)
def
test_nullpat
(
self
):
def
test_nullpat
(
self
):
self
.
drive_one
(
b
ytes
(
1000
)
)
self
.
drive_one
(
b
'
\0
'
*
1000
)
class
CBufferSizeTest
(
BufferSizeTest
,
unittest
.
TestCase
):
class
CBufferSizeTest
(
BufferSizeTest
,
unittest
.
TestCase
):
...
...
Lib/test/test_bz2.py
Dosyayı görüntüle @
5f1a5187
...
@@ -562,11 +562,11 @@ class BZ2FileTest(BaseTest):
...
@@ -562,11 +562,11 @@ class BZ2FileTest(BaseTest):
def
testDecompressLimited
(
self
):
def
testDecompressLimited
(
self
):
"""Decompressed data buffering should be limited"""
"""Decompressed data buffering should be limited"""
bomb
=
bz2
.
compress
(
b
ytes
(
int
(
2e6
)
),
compresslevel
=
9
)
bomb
=
bz2
.
compress
(
b
'
\0
'
*
int
(
2e6
),
compresslevel
=
9
)
self
.
assertLess
(
len
(
bomb
),
_compression
.
BUFFER_SIZE
)
self
.
assertLess
(
len
(
bomb
),
_compression
.
BUFFER_SIZE
)
decomp
=
BZ2File
(
BytesIO
(
bomb
))
decomp
=
BZ2File
(
BytesIO
(
bomb
))
self
.
assertEqual
(
bytes
(
1
),
decomp
.
read
(
1
)
)
self
.
assertEqual
(
decomp
.
read
(
1
),
b
'
\0
'
)
max_decomp
=
1
+
DEFAULT_BUFFER_SIZE
max_decomp
=
1
+
DEFAULT_BUFFER_SIZE
self
.
assertLessEqual
(
decomp
.
_buffer
.
raw
.
tell
(),
max_decomp
,
self
.
assertLessEqual
(
decomp
.
_buffer
.
raw
.
tell
(),
max_decomp
,
"Excessive amount of data was decompressed"
)
"Excessive amount of data was decompressed"
)
...
...
Lib/test/test_gzip.py
Dosyayı görüntüle @
5f1a5187
...
@@ -434,12 +434,12 @@ class TestGzip(BaseTest):
...
@@ -434,12 +434,12 @@ class TestGzip(BaseTest):
def
test_decompress_limited
(
self
):
def
test_decompress_limited
(
self
):
"""Decompressed data buffering should be limited"""
"""Decompressed data buffering should be limited"""
bomb
=
gzip
.
compress
(
b
ytes
(
int
(
2e6
)
),
compresslevel
=
9
)
bomb
=
gzip
.
compress
(
b
'
\0
'
*
int
(
2e6
),
compresslevel
=
9
)
self
.
assertLess
(
len
(
bomb
),
io
.
DEFAULT_BUFFER_SIZE
)
self
.
assertLess
(
len
(
bomb
),
io
.
DEFAULT_BUFFER_SIZE
)
bomb
=
io
.
BytesIO
(
bomb
)
bomb
=
io
.
BytesIO
(
bomb
)
decomp
=
gzip
.
GzipFile
(
fileobj
=
bomb
)
decomp
=
gzip
.
GzipFile
(
fileobj
=
bomb
)
self
.
assertEqual
(
bytes
(
1
),
decomp
.
read
(
1
)
)
self
.
assertEqual
(
decomp
.
read
(
1
),
b
'
\0
'
)
max_decomp
=
1
+
io
.
DEFAULT_BUFFER_SIZE
max_decomp
=
1
+
io
.
DEFAULT_BUFFER_SIZE
self
.
assertLessEqual
(
decomp
.
_buffer
.
raw
.
tell
(),
max_decomp
,
self
.
assertLessEqual
(
decomp
.
_buffer
.
raw
.
tell
(),
max_decomp
,
"Excessive amount of data was decompressed"
)
"Excessive amount of data was decompressed"
)
...
...
Lib/test/test_io.py
Dosyayı görüntüle @
5f1a5187
...
@@ -1812,7 +1812,7 @@ class BufferedRWPairTest(unittest.TestCase):
...
@@ -1812,7 +1812,7 @@ class BufferedRWPairTest(unittest.TestCase):
with
self
.
subTest
(
method
):
with
self
.
subTest
(
method
):
pair
=
self
.
tp
(
self
.
BytesIO
(
b
"abcdef"
),
self
.
MockRawIO
())
pair
=
self
.
tp
(
self
.
BytesIO
(
b
"abcdef"
),
self
.
MockRawIO
())
data
=
byteslike
(
5
)
data
=
byteslike
(
b
'
\0
'
*
5
)
self
.
assertEqual
(
getattr
(
pair
,
method
)(
data
),
5
)
self
.
assertEqual
(
getattr
(
pair
,
method
)(
data
),
5
)
self
.
assertEqual
(
bytes
(
data
),
b
"abcde"
)
self
.
assertEqual
(
bytes
(
data
),
b
"abcde"
)
...
...
Lib/test/test_ipaddress.py
Dosyayı görüntüle @
5f1a5187
...
@@ -119,7 +119,7 @@ class CommonTestMixin_v4(CommonTestMixin):
...
@@ -119,7 +119,7 @@ class CommonTestMixin_v4(CommonTestMixin):
def
test_bad_packed_length
(
self
):
def
test_bad_packed_length
(
self
):
def
assertBadLength
(
length
):
def
assertBadLength
(
length
):
addr
=
b
ytes
(
length
)
addr
=
b
'
\0
'
*
length
msg
=
"
%
r (len
%
d != 4) is not permitted as an IPv4 address"
msg
=
"
%
r (len
%
d != 4) is not permitted as an IPv4 address"
with
self
.
assertAddressError
(
re
.
escape
(
msg
%
(
addr
,
length
))):
with
self
.
assertAddressError
(
re
.
escape
(
msg
%
(
addr
,
length
))):
self
.
factory
(
addr
)
self
.
factory
(
addr
)
...
@@ -139,11 +139,11 @@ class CommonTestMixin_v6(CommonTestMixin):
...
@@ -139,11 +139,11 @@ class CommonTestMixin_v6(CommonTestMixin):
self
.
assertInstancesEqual
(
3232235521
,
"::c0a8:1"
)
self
.
assertInstancesEqual
(
3232235521
,
"::c0a8:1"
)
def
test_packed
(
self
):
def
test_packed
(
self
):
addr
=
b
ytes
(
12
)
+
bytes
.
fromhex
(
"00000000"
)
addr
=
b
'
\0
'
*
12
+
bytes
.
fromhex
(
"00000000"
)
self
.
assertInstancesEqual
(
addr
,
"::"
)
self
.
assertInstancesEqual
(
addr
,
"::"
)
addr
=
b
ytes
(
12
)
+
bytes
.
fromhex
(
"c0a80001"
)
addr
=
b
'
\0
'
*
12
+
bytes
.
fromhex
(
"c0a80001"
)
self
.
assertInstancesEqual
(
addr
,
"::c0a8:1"
)
self
.
assertInstancesEqual
(
addr
,
"::c0a8:1"
)
addr
=
bytes
.
fromhex
(
"c0a80001"
)
+
b
ytes
(
12
)
addr
=
bytes
.
fromhex
(
"c0a80001"
)
+
b
'
\0
'
*
12
self
.
assertInstancesEqual
(
addr
,
"c0a8:1::"
)
self
.
assertInstancesEqual
(
addr
,
"c0a8:1::"
)
def
test_negative_ints_rejected
(
self
):
def
test_negative_ints_rejected
(
self
):
...
@@ -158,7 +158,7 @@ class CommonTestMixin_v6(CommonTestMixin):
...
@@ -158,7 +158,7 @@ class CommonTestMixin_v6(CommonTestMixin):
def
test_bad_packed_length
(
self
):
def
test_bad_packed_length
(
self
):
def
assertBadLength
(
length
):
def
assertBadLength
(
length
):
addr
=
b
ytes
(
length
)
addr
=
b
'
\0
'
*
length
msg
=
"
%
r (len
%
d != 16) is not permitted as an IPv6 address"
msg
=
"
%
r (len
%
d != 16) is not permitted as an IPv6 address"
with
self
.
assertAddressError
(
re
.
escape
(
msg
%
(
addr
,
length
))):
with
self
.
assertAddressError
(
re
.
escape
(
msg
%
(
addr
,
length
))):
self
.
factory
(
addr
)
self
.
factory
(
addr
)
...
...
Lib/test/test_lzma.py
Dosyayı görüntüle @
5f1a5187
...
@@ -928,11 +928,11 @@ class FileTestCase(unittest.TestCase):
...
@@ -928,11 +928,11 @@ class FileTestCase(unittest.TestCase):
def
test_decompress_limited
(
self
):
def
test_decompress_limited
(
self
):
"""Decompressed data buffering should be limited"""
"""Decompressed data buffering should be limited"""
bomb
=
lzma
.
compress
(
b
ytes
(
int
(
2e6
)
),
preset
=
6
)
bomb
=
lzma
.
compress
(
b
'
\0
'
*
int
(
2e6
),
preset
=
6
)
self
.
assertLess
(
len
(
bomb
),
_compression
.
BUFFER_SIZE
)
self
.
assertLess
(
len
(
bomb
),
_compression
.
BUFFER_SIZE
)
decomp
=
LZMAFile
(
BytesIO
(
bomb
))
decomp
=
LZMAFile
(
BytesIO
(
bomb
))
self
.
assertEqual
(
bytes
(
1
),
decomp
.
read
(
1
)
)
self
.
assertEqual
(
decomp
.
read
(
1
),
b
'
\0
'
)
max_decomp
=
1
+
DEFAULT_BUFFER_SIZE
max_decomp
=
1
+
DEFAULT_BUFFER_SIZE
self
.
assertLessEqual
(
decomp
.
_buffer
.
raw
.
tell
(),
max_decomp
,
self
.
assertLessEqual
(
decomp
.
_buffer
.
raw
.
tell
(),
max_decomp
,
"Excessive amount of data was decompressed"
)
"Excessive amount of data was decompressed"
)
...
...
Lib/test/test_socketserver.py
Dosyayı görüntüle @
5f1a5187
...
@@ -406,7 +406,7 @@ class SocketWriterTest(unittest.TestCase):
...
@@ -406,7 +406,7 @@ class SocketWriterTest(unittest.TestCase):
self
.
server
.
sent1
=
self
.
wfile
.
write
(
b
'write data
\n
'
)
self
.
server
.
sent1
=
self
.
wfile
.
write
(
b
'write data
\n
'
)
# Should be sent immediately, without requiring flush()
# Should be sent immediately, without requiring flush()
self
.
server
.
received
=
self
.
rfile
.
readline
()
self
.
server
.
received
=
self
.
rfile
.
readline
()
big_chunk
=
b
ytes
(
test
.
support
.
SOCK_MAX_SIZE
)
big_chunk
=
b
'
\0
'
*
test
.
support
.
SOCK_MAX_SIZE
self
.
server
.
sent2
=
self
.
wfile
.
write
(
big_chunk
)
self
.
server
.
sent2
=
self
.
wfile
.
write
(
big_chunk
)
server
=
socketserver
.
TCPServer
((
HOST
,
0
),
Handler
)
server
=
socketserver
.
TCPServer
((
HOST
,
0
),
Handler
)
...
...
Lib/test/test_wsgiref.py
Dosyayı görüntüle @
5f1a5187
...
@@ -258,7 +258,7 @@ class IntegrationTests(TestCase):
...
@@ -258,7 +258,7 @@ class IntegrationTests(TestCase):
def
app
(
environ
,
start_response
):
def
app
(
environ
,
start_response
):
start_response
(
"200 OK"
,
[])
start_response
(
"200 OK"
,
[])
return
[
b
ytes
(
support
.
SOCK_MAX_SIZE
)
]
return
[
b
'
\0
'
*
support
.
SOCK_MAX_SIZE
]
class
WsgiHandler
(
NoLogRequestHandler
,
WSGIRequestHandler
):
class
WsgiHandler
(
NoLogRequestHandler
,
WSGIRequestHandler
):
pass
pass
...
...
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