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
33cd058f
Kaydet (Commit)
33cd058f
authored
Haz 12, 2018
tarafından
Cheryl Sabella
Kaydeden (comit)
Łukasz Langa
Haz 12, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32108: Don't clear configparser values if key is assigned to itself (GH-7588)
üst
c3f55be7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
configparser.py
Lib/configparser.py
+2
-1
test_configparser.py
Lib/test/test_configparser.py
+6
-0
2018-06-10-12-15-26.bpo-32108.iEkvh0.rst
...S.d/next/Library/2018-06-10-12-15-26.bpo-32108.iEkvh0.rst
+1
-0
No files found.
Lib/configparser.py
Dosyayı görüntüle @
33cd058f
...
...
@@ -963,7 +963,8 @@ class RawConfigParser(MutableMapping):
def
__setitem__
(
self
,
key
,
value
):
# To conform with the mapping protocol, overwrites existing values in
# the section.
if
key
in
self
and
self
[
key
]
is
value
:
return
# XXX this is not atomic if read_dict fails at any point. Then again,
# no update method in configparser is atomic in this implementation.
if
key
==
self
.
default_section
:
...
...
Lib/test/test_configparser.py
Dosyayı görüntüle @
33cd058f
...
...
@@ -850,12 +850,18 @@ boolean {0[0]} NO
self
.
assertEqual
(
set
(
cf
[
'section3'
]
.
keys
()),
{
'named'
})
self
.
assertNotIn
(
'name3'
,
cf
[
'section3'
])
self
.
assertEqual
(
cf
.
sections
(),
[
'section1'
,
'section2'
,
'section3'
])
# For bpo-32108, assigning default_section to itself.
cf
[
self
.
default_section
]
=
cf
[
self
.
default_section
]
self
.
assertNotEqual
(
set
(
cf
[
self
.
default_section
]
.
keys
()),
set
())
cf
[
self
.
default_section
]
=
{}
self
.
assertEqual
(
set
(
cf
[
self
.
default_section
]
.
keys
()),
set
())
self
.
assertEqual
(
set
(
cf
[
'section1'
]
.
keys
()),
{
'name1'
})
self
.
assertEqual
(
set
(
cf
[
'section2'
]
.
keys
()),
{
'name22'
})
self
.
assertEqual
(
set
(
cf
[
'section3'
]
.
keys
()),
set
())
self
.
assertEqual
(
cf
.
sections
(),
[
'section1'
,
'section2'
,
'section3'
])
# For bpo-32108, assigning section to itself.
cf
[
'section2'
]
=
cf
[
'section2'
]
self
.
assertEqual
(
set
(
cf
[
'section2'
]
.
keys
()),
{
'name22'
})
def
test_invalid_multiline_value
(
self
):
if
self
.
allow_no_value
:
...
...
Misc/NEWS.d/next/Library/2018-06-10-12-15-26.bpo-32108.iEkvh0.rst
0 → 100644
Dosyayı görüntüle @
33cd058f
In configparser, don't clear section when it is assigned to itself.
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