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
26d95c3d
Kaydet (Commit)
26d95c3d
authored
Agu 27, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More str/bytes fixes.
üst
e22905a0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
pickle.py
Lib/pickle.py
+6
-6
pickletools.py
Lib/pickletools.py
+4
-4
test_os.py
Lib/test/test_os.py
+2
-2
No files found.
Lib/pickle.py
Dosyayı görüntüle @
26d95c3d
...
@@ -843,7 +843,7 @@ class Unpickler:
...
@@ -843,7 +843,7 @@ class Unpickler:
def
load_proto
(
self
):
def
load_proto
(
self
):
proto
=
ord
(
self
.
read
(
1
))
proto
=
ord
(
self
.
read
(
1
))
if
not
0
<=
proto
<=
2
:
if
not
0
<=
proto
<=
2
:
raise
ValueError
,
"unsupported pickle protocol:
%
d"
%
proto
raise
ValueError
(
"unsupported pickle protocol:
%
d"
%
proto
)
dispatch
[
PROTO
[
0
]]
=
load_proto
dispatch
[
PROTO
[
0
]]
=
load_proto
def
load_persid
(
self
):
def
load_persid
(
self
):
...
@@ -920,14 +920,14 @@ class Unpickler:
...
@@ -920,14 +920,14 @@ class Unpickler:
def
load_string
(
self
):
def
load_string
(
self
):
rep
=
self
.
readline
()[:
-
1
]
rep
=
self
.
readline
()[:
-
1
]
for
q
in
"
\"
'"
:
# double or single quote
for
q
in
(
b
'"'
,
b
"'"
)
:
# double or single quote
if
rep
.
startswith
(
q
):
if
rep
.
startswith
(
q
):
if
not
rep
.
endswith
(
q
):
if
not
rep
.
endswith
(
q
):
raise
ValueError
,
"insecure string pickle"
raise
ValueError
(
"insecure string pickle"
)
rep
=
rep
[
len
(
q
):
-
len
(
q
)]
rep
=
rep
[
len
(
q
):
-
len
(
q
)]
break
break
else
:
else
:
raise
ValueError
,
"insecure string pickle"
raise
ValueError
(
"insecure string pickle"
)
self
.
append
(
str
(
codecs
.
escape_decode
(
rep
)[
0
],
"latin-1"
))
self
.
append
(
str
(
codecs
.
escape_decode
(
rep
)[
0
],
"latin-1"
))
dispatch
[
STRING
[
0
]]
=
load_string
dispatch
[
STRING
[
0
]]
=
load_string
...
@@ -1014,8 +1014,8 @@ class Unpickler:
...
@@ -1014,8 +1014,8 @@ class Unpickler:
try
:
try
:
value
=
klass
(
*
args
)
value
=
klass
(
*
args
)
except
TypeError
as
err
:
except
TypeError
as
err
:
raise
TypeError
,
"in constructor for
%
s:
%
s"
%
(
raise
TypeError
(
"in constructor for
%
s:
%
s"
%
klass
.
__name__
,
str
(
err
)),
sys
.
exc_info
()[
2
]
(
klass
.
__name__
,
str
(
err
)),
sys
.
exc_info
()[
2
])
self
.
append
(
value
)
self
.
append
(
value
)
def
load_inst
(
self
):
def
load_inst
(
self
):
...
...
Lib/pickletools.py
Dosyayı görüntüle @
26d95c3d
...
@@ -291,12 +291,12 @@ def read_stringnl(f, decode=True, stripquotes=True):
...
@@ -291,12 +291,12 @@ def read_stringnl(f, decode=True, stripquotes=True):
"""
"""
data
=
f
.
readline
()
data
=
f
.
readline
()
if
not
data
.
endswith
(
'
\n
'
):
if
not
data
.
endswith
(
b
'
\n
'
):
raise
ValueError
(
"no newline found when trying to read stringnl"
)
raise
ValueError
(
"no newline found when trying to read stringnl"
)
data
=
data
[:
-
1
]
# lose the newline
data
=
data
[:
-
1
]
# lose the newline
if
stripquotes
:
if
stripquotes
:
for
q
in
"'
\"
"
:
for
q
in
(
b
'"'
,
b
"'"
)
:
if
data
.
startswith
(
q
):
if
data
.
startswith
(
q
):
if
not
data
.
endswith
(
q
):
if
not
data
.
endswith
(
q
):
raise
ValueError
(
"strinq quote
%
r not found at both "
raise
ValueError
(
"strinq quote
%
r not found at both "
...
@@ -427,7 +427,7 @@ def read_unicodestringnl(f):
...
@@ -427,7 +427,7 @@ def read_unicodestringnl(f):
"""
"""
data
=
f
.
readline
()
data
=
f
.
readline
()
if
not
data
.
endswith
(
'
\n
'
):
if
not
data
.
endswith
(
b
'
\n
'
):
raise
ValueError
(
"no newline found when trying to read "
raise
ValueError
(
"no newline found when trying to read "
"unicodestringnl"
)
"unicodestringnl"
)
data
=
data
[:
-
1
]
# lose the newline
data
=
data
[:
-
1
]
# lose the newline
...
@@ -497,7 +497,7 @@ def read_decimalnl_short(f):
...
@@ -497,7 +497,7 @@ def read_decimalnl_short(f):
"""
"""
s
=
read_stringnl
(
f
,
decode
=
False
,
stripquotes
=
False
)
s
=
read_stringnl
(
f
,
decode
=
False
,
stripquotes
=
False
)
if
s
.
endswith
(
"L"
):
if
s
.
endswith
(
b
"L"
):
raise
ValueError
(
"trailing 'L' not allowed in
%
r"
%
s
)
raise
ValueError
(
"trailing 'L' not allowed in
%
r"
%
s
)
# It's not necessarily true that the result fits in a Python short int:
# It's not necessarily true that the result fits in a Python short int:
...
...
Lib/test/test_os.py
Dosyayı görüntüle @
26d95c3d
...
@@ -60,7 +60,7 @@ class TemporaryFileTests(unittest.TestCase):
...
@@ -60,7 +60,7 @@ class TemporaryFileTests(unittest.TestCase):
if
not
hasattr
(
os
,
"tmpfile"
):
if
not
hasattr
(
os
,
"tmpfile"
):
return
return
fp
=
os
.
tmpfile
()
fp
=
os
.
tmpfile
()
fp
.
write
(
"foobar"
)
fp
.
write
(
b
"foobar"
)
fp
.
seek
(
0
)
fp
.
seek
(
0
)
s
=
fp
.
read
()
s
=
fp
.
read
()
fp
.
close
()
fp
.
close
()
...
@@ -100,7 +100,7 @@ class StatAttributeTests(unittest.TestCase):
...
@@ -100,7 +100,7 @@ class StatAttributeTests(unittest.TestCase):
os
.
mkdir
(
test_support
.
TESTFN
)
os
.
mkdir
(
test_support
.
TESTFN
)
self
.
fname
=
os
.
path
.
join
(
test_support
.
TESTFN
,
"f1"
)
self
.
fname
=
os
.
path
.
join
(
test_support
.
TESTFN
,
"f1"
)
f
=
open
(
self
.
fname
,
'wb'
)
f
=
open
(
self
.
fname
,
'wb'
)
f
.
write
(
"ABC"
)
f
.
write
(
b
"ABC"
)
f
.
close
()
f
.
close
()
def
tearDown
(
self
):
def
tearDown
(
self
):
...
...
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