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
abb34fe9
Kaydet (Commit)
abb34fe9
authored
May 29, 2008
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
UserString.MutableString has been removed in Python 3.0.
Works on issue #2877. Thanks Quentin Gallet-Gilles for the patch.
üst
5ec330cb
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
1 deletion
+21
-1
userdict.rst
Doc/library/userdict.rst
+3
-0
UserString.py
Lib/UserString.py
+3
-0
test_py3kwarn.py
Lib/test/test_py3kwarn.py
+8
-0
test_userstring.py
Lib/test/test_userstring.py
+4
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/userdict.rst
Dosyayı görüntüle @
abb34fe9
...
...
@@ -178,6 +178,9 @@ The :mod:`UserString` module defines the following classes:
mutable object as dictionary key, which would be otherwise very error prone and
hard to track down.
.. deprecated:: 2.6
The :class:`MutableString` class has been removed in Python 3.0.
In addition to supporting the methods and operations of string and Unicode
objects (see section :ref:`string-methods`), :class:`UserString` instances
provide the following attribute:
...
...
Lib/UserString.py
Dosyayı görüntüle @
abb34fe9
...
...
@@ -146,6 +146,9 @@ class MutableString(UserString, collections.MutableSequence):
A faster and better solution is to rewrite your program using lists."""
def
__init__
(
self
,
string
=
""
):
from
warnings
import
warnpy3k
warnpy3k
(
'the class UserString.MutableString has been removed in '
'Python 3.0'
,
stacklevel
=
2
)
self
.
data
=
string
def
__hash__
(
self
):
raise
TypeError
,
"unhashable type (it is mutable)"
...
...
Lib/test/test_py3kwarn.py
Dosyayı görüntüle @
abb34fe9
...
...
@@ -219,6 +219,14 @@ class TestStdlibRemovals(unittest.TestCase):
func
=
getattr
(
commands
,
name
)
self
.
assertRaises
(
DeprecationWarning
,
func
,
*
([
None
]
*
arg_count
))
def
test_mutablestring_removal
(
self
):
# UserString.MutableString has been removed in 3.0.
import
UserString
with
catch_warning
(
record
=
False
):
warnings
.
filterwarnings
(
"error"
,
".*MutableString"
,
DeprecationWarning
)
self
.
assertRaises
(
DeprecationWarning
,
UserString
.
MutableString
)
def
test_main
():
with
catch_warning
(
record
=
True
):
...
...
Lib/test/test_userstring.py
Dosyayı görüntüle @
abb34fe9
...
...
@@ -4,8 +4,8 @@
import
string
from
test
import
test_support
,
string_tests
from
UserString
import
UserString
,
MutableString
import
warnings
class
UserStringTest
(
string_tests
.
CommonTest
,
...
...
@@ -135,6 +135,9 @@ class MutableStringTest(UserStringTest):
self
.
assertEqual
(
s
,
""
)
def
test_main
():
with
test_support
.
catch_warning
(
record
=
False
):
warnings
.
filterwarnings
(
"ignore"
,
".*MutableString"
,
DeprecationWarning
)
test_support
.
run_unittest
(
UserStringTest
,
MutableStringTest
)
if
__name__
==
"__main__"
:
...
...
Misc/NEWS
Dosyayı görüntüle @
abb34fe9
...
...
@@ -63,6 +63,9 @@ Extension Modules
Library
-------
Issue #2877 - The UserString.MutableString class has been removed in
Python 3.0.
- Do not close external file objects passed to tarfile.open(mode='w:bz2')
when the TarFile is closed.
...
...
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