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
cdac302a
Kaydet (Commit)
cdac302a
authored
Kas 24, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #19545: Avoid chained exceptions while passing stray % to
time.strptime(). Initial patch by Claudiu Popa.
üst
44d2429a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
1 deletion
+12
-1
_strptime.py
Lib/_strptime.py
+1
-1
test_strptime.py
Lib/test/test_strptime.py
+4
-0
test_time.py
Lib/test/test_time.py
+4
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/_strptime.py
Dosyayı görüntüle @
cdac302a
...
...
@@ -329,7 +329,7 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
(
bad_directive
,
format
))
from
None
# IndexError only occurs when the format string is "%"
except
IndexError
:
raise
ValueError
(
"stray
%%
in format '
%
s'"
%
format
)
raise
ValueError
(
"stray
%%
in format '
%
s'"
%
format
)
from
None
_regex_cache
[
format
]
=
format_regex
found
=
format_regex
.
match
(
data_string
)
if
not
found
:
...
...
Lib/test/test_strptime.py
Dosyayı görüntüle @
cdac302a
...
...
@@ -223,6 +223,10 @@ class StrptimeTests(unittest.TestCase):
with
self
.
assertRaises
(
ValueError
)
as
e
:
_strptime
.
_strptime_time
(
''
,
'
%
D'
)
self
.
assertIs
(
e
.
exception
.
__suppress_context__
,
True
)
# additional check for IndexError branch (issue #19545)
with
self
.
assertRaises
(
ValueError
)
as
e
:
_strptime
.
_strptime_time
(
'19'
,
'
%
Y
%
'
)
self
.
assertIs
(
e
.
exception
.
__suppress_context__
,
True
)
def
test_unconverteddata
(
self
):
# Check ValueError is raised when there is unconverted data
...
...
Lib/test/test_time.py
Dosyayı görüntüle @
cdac302a
...
...
@@ -198,6 +198,10 @@ class TimeTestCase(unittest.TestCase):
with
self
.
assertRaises
(
ValueError
)
as
e
:
time
.
strptime
(
''
,
'
%
D'
)
self
.
assertIs
(
e
.
exception
.
__suppress_context__
,
True
)
# additional check for IndexError branch (issue #19545)
with
self
.
assertRaises
(
ValueError
)
as
e
:
time
.
strptime
(
'19'
,
'
%
Y
%
'
)
self
.
assertIs
(
e
.
exception
.
__suppress_context__
,
True
)
def
test_asctime
(
self
):
time
.
asctime
(
time
.
gmtime
(
self
.
t
))
...
...
Misc/NEWS
Dosyayı görüntüle @
cdac302a
...
...
@@ -13,6 +13,9 @@ Core and Builtins
Library
-------
- Issue #19545: Avoid chained exceptions while passing stray % to
time.strptime(). Initial patch by Claudiu Popa.
- Issue #19633: Fixed writing not compressed 16- and 32-bit wave files on
big-endian platforms.
...
...
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