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
a1e627d6
Kaydet (Commit)
a1e627d6
authored
Eyl 03, 2010
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix output from RawConfigParser.write and ConfigParser.write for None
values (
http://bugs.python.org/issue7005
)
üst
5cd2d8c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
1 deletion
+32
-1
ConfigParser.py
Lib/ConfigParser.py
+1
-1
test_cfgparser.py
Lib/test/test_cfgparser.py
+28
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/ConfigParser.py
Dosyayı görüntüle @
a1e627d6
...
...
@@ -400,7 +400,7 @@ class RawConfigParser:
for
(
key
,
value
)
in
self
.
_sections
[
section
]
.
items
():
if
key
==
"__name__"
:
continue
if
value
is
not
None
:
if
(
value
is
not
None
)
or
(
self
.
_optcre
==
self
.
OPTCRE
)
:
key
=
" = "
.
join
((
key
,
str
(
value
)
.
replace
(
'
\n
'
,
'
\n\t
'
)))
fp
.
write
(
"
%
s
\n
"
%
(
key
))
fp
.
write
(
"
\n
"
)
...
...
Lib/test/test_cfgparser.py
Dosyayı görüntüle @
a1e627d6
...
...
@@ -530,6 +530,33 @@ class SafeConfigParserTestCaseNoValue(SafeConfigParserTestCase):
allow_no_value
=
True
class
Issue7005TestCase
(
unittest
.
TestCase
):
"""Test output when None is set() as a value and allow_no_value == False.
http://bugs.python.org/issue7005
"""
expected_output
=
"[section]
\n
option = None
\n\n
"
def
prepare
(
self
,
config_class
):
# This is the default, but that's the point.
cp
=
config_class
(
allow_no_value
=
False
)
cp
.
add_section
(
"section"
)
cp
.
set
(
"section"
,
"option"
,
None
)
sio
=
StringIO
.
StringIO
()
cp
.
write
(
sio
)
return
sio
.
getvalue
()
def
test_none_as_value_stringified
(
self
):
output
=
self
.
prepare
(
ConfigParser
.
ConfigParser
)
self
.
assertEqual
(
output
,
self
.
expected_output
)
def
test_none_as_value_stringified_raw
(
self
):
output
=
self
.
prepare
(
ConfigParser
.
RawConfigParser
)
self
.
assertEqual
(
output
,
self
.
expected_output
)
class
SortedTestCase
(
RawConfigParserTestCase
):
def
newconfig
(
self
,
defaults
=
None
):
self
.
cf
=
self
.
config_class
(
defaults
=
defaults
,
dict_type
=
SortedDict
)
...
...
@@ -563,6 +590,7 @@ def test_main():
SafeConfigParserTestCase
,
SafeConfigParserTestCaseNoValue
,
SortedTestCase
,
Issue7005TestCase
,
)
...
...
Misc/NEWS
Dosyayı görüntüle @
a1e627d6
...
...
@@ -36,6 +36,9 @@ Core and Builtins
Library
-------
- Issue #7005: Fixed output of None values for RawConfigParser.write and
ConfigParser.write.
- Issue #808164: Fixed socket.close to avoid references to globals, to
avoid issues when socket.close is called from a __del__ method.
...
...
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