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
8c481b62
Kaydet (Commit)
8c481b62
authored
Kas 05, 2011
tarafından
Petri Lehtinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Fix Maildir initialization so that maildir contents are read correctly.
Closes #13254.
üst
f16a350b
8c482ee9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
mailbox.py
Lib/mailbox.py
+3
-5
test_mailbox.py
Lib/test/test_mailbox.py
+21
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/mailbox.py
Dosyayı görüntüle @
8c481b62
...
@@ -273,11 +273,9 @@ class Maildir(Mailbox):
...
@@ -273,11 +273,9 @@ class Maildir(Mailbox):
else
:
else
:
raise
NoSuchMailboxError
(
self
.
_path
)
raise
NoSuchMailboxError
(
self
.
_path
)
self
.
_toc
=
{}
self
.
_toc
=
{}
self
.
_toc_mtimes
=
{}
self
.
_toc_mtimes
=
{
'cur'
:
0
,
'new'
:
0
}
for
subdir
in
(
'cur'
,
'new'
):
self
.
_last_read
=
0
# Records last time we read cur/new
self
.
_toc_mtimes
[
subdir
]
=
os
.
path
.
getmtime
(
self
.
_paths
[
subdir
])
self
.
_skewfactor
=
0.1
# Adjust if os/fs clocks are skewing
self
.
_last_read
=
time
.
time
()
# Records last time we read cur/new
self
.
_skewfactor
=
0.1
# Adjust if os/fs clocks are skewing
def
add
(
self
,
message
):
def
add
(
self
,
message
):
"""Add message and return assigned key."""
"""Add message and return assigned key."""
...
...
Lib/test/test_mailbox.py
Dosyayı görüntüle @
8c481b62
...
@@ -801,6 +801,25 @@ class TestMaildir(TestMailbox):
...
@@ -801,6 +801,25 @@ class TestMaildir(TestMailbox):
key1
:
os
.
path
.
join
(
'new'
,
key1
),
key1
:
os
.
path
.
join
(
'new'
,
key1
),
key2
:
os
.
path
.
join
(
'new'
,
key2
)})
key2
:
os
.
path
.
join
(
'new'
,
key2
)})
def
test_refresh_after_safety_period
(
self
):
# Issue #13254: Call _refresh after the "file system safety
# period" of 2 seconds has passed; _toc should still be
# updated because this is the first call to _refresh.
key0
=
self
.
_box
.
add
(
self
.
_template
%
0
)
key1
=
self
.
_box
.
add
(
self
.
_template
%
1
)
self
.
_box
=
self
.
_factory
(
self
.
_path
)
self
.
assertEqual
(
self
.
_box
.
_toc
,
{})
# Emulate sleeping. Instead of sleeping for 2 seconds, use the
# skew factor to make _refresh think that the filesystem
# safety period has passed and re-reading the _toc is only
# required if mtimes differ.
self
.
_box
.
_skewfactor
=
-
2
self
.
_box
.
_refresh
()
self
.
assertEqual
(
sorted
(
self
.
_box
.
_toc
.
keys
()),
sorted
([
key0
,
key1
]))
def
test_lookup
(
self
):
def
test_lookup
(
self
):
# Look up message subpaths in the TOC
# Look up message subpaths in the TOC
self
.
assertRaises
(
KeyError
,
lambda
:
self
.
_box
.
_lookup
(
'foo'
))
self
.
assertRaises
(
KeyError
,
lambda
:
self
.
_box
.
_lookup
(
'foo'
))
...
@@ -876,6 +895,8 @@ class TestMaildir(TestMailbox):
...
@@ -876,6 +895,8 @@ class TestMaildir(TestMailbox):
self
.
assertFalse
((
perms
&
0
o111
))
# Execute bits should all be off.
self
.
assertFalse
((
perms
&
0
o111
))
# Execute bits should all be off.
def
test_reread
(
self
):
def
test_reread
(
self
):
# Do an initial unconditional refresh
self
.
_box
.
_refresh
()
# Put the last modified times more than two seconds into the past
# Put the last modified times more than two seconds into the past
# (because mtime may have a two second granularity)
# (because mtime may have a two second granularity)
...
...
Misc/NEWS
Dosyayı görüntüle @
8c481b62
...
@@ -354,6 +354,9 @@ Core and Builtins
...
@@ -354,6 +354,9 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
13254
:
Fix
Maildir
initialization
so
that
maildir
contents
are
read
correctly
.
-
Issue
#
3067
:
locale
.
setlocale
()
now
raises
TypeError
if
the
second
-
Issue
#
3067
:
locale
.
setlocale
()
now
raises
TypeError
if
the
second
argument
is
an
invalid
iterable
.
Initial
patch
by
Jyrki
Pulliainen
.
argument
is
an
invalid
iterable
.
Initial
patch
by
Jyrki
Pulliainen
.
...
...
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