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
c9490e2f
Kaydet (Commit)
c9490e2f
authored
Haz 04, 2007
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Backport of r55752: make time.strptime() behave better when whitespace is in
the format arguments.
üst
2413e038
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
_strptime.py
Lib/_strptime.py
+1
-1
test_strptime.py
Lib/test/test_strptime.py
+9
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/_strptime.py
Dosyayı görüntüle @
c9490e2f
...
...
@@ -253,7 +253,7 @@ class TimeRE(dict):
regex_chars
=
re_compile
(
r"([\\.^$*+?\(\){}\[\]|])"
)
format
=
regex_chars
.
sub
(
r"\\\1"
,
format
)
whitespace_replacement
=
re_compile
(
'
\
s+'
)
format
=
whitespace_replacement
.
sub
(
'
\
s
*
'
,
format
)
format
=
whitespace_replacement
.
sub
(
'
\
s
+
'
,
format
)
while
'
%
'
in
format
:
directive_index
=
format
.
index
(
'
%
'
)
+
1
processed_format
=
"
%
s
%
s
%
s"
%
(
processed_format
,
...
...
Lib/test/test_strptime.py
Dosyayı görüntüle @
c9490e2f
...
...
@@ -190,6 +190,15 @@ class TimeRETests(unittest.TestCase):
"locale data that contains regex metacharacters is not"
" properly escaped"
)
def
test_whitespace_substitution
(
self
):
# When pattern contains whitespace, make sure it is taken into account
# so as to not allow to subpatterns to end up next to each other and
# "steal" characters from each other.
pattern
=
self
.
time_re
.
pattern
(
'
%
j
%
H'
)
self
.
failUnless
(
not
re
.
match
(
pattern
,
"180"
))
self
.
failUnless
(
re
.
match
(
pattern
,
"18 0"
))
class
StrptimeTests
(
unittest
.
TestCase
):
"""Tests for _strptime.strptime."""
...
...
Misc/NEWS
Dosyayı görüntüle @
c9490e2f
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.5.2c1?
Library
-------
- Bug #1730389: Have time.strptime() match spaces in a format argument with
``\s+`` instead of ``\s*``.
- SF 1668596/1720897: distutils now copies data files
even if package_dir is empty.
...
...
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