Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bd048769
Commit
bd048769
authored
Jun 21, 2014
by
Giampaolo Rodola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#6916: raise a deprecation warning if using asynchat.fifo
parent
892051af
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
Lib/asynchat.py
Lib/asynchat.py
+3
-0
Lib/test/test_asynchat.py
Lib/test/test_asynchat.py
+7
-2
No files found.
Lib/asynchat.py
View file @
bd048769
...
@@ -275,6 +275,9 @@ class simple_producer:
...
@@ -275,6 +275,9 @@ class simple_producer:
class
fifo
:
class
fifo
:
def
__init__
(
self
,
list
=
None
):
def
__init__
(
self
,
list
=
None
):
import
warnings
warnings
.
warn
(
'fifo class will be removed in Python 3.6'
,
DeprecationWarning
,
stacklevel
=
2
)
if
not
list
:
if
not
list
:
self
.
list
=
deque
()
self
.
list
=
deque
()
else
:
else
:
...
...
Lib/test/test_asynchat.py
View file @
bd048769
...
@@ -8,6 +8,7 @@ thread = support.import_module('_thread')
...
@@ -8,6 +8,7 @@ thread = support.import_module('_thread')
import
asyncore
,
asynchat
,
socket
,
time
import
asyncore
,
asynchat
,
socket
,
time
import
unittest
import
unittest
import
sys
import
sys
import
warnings
try
:
try
:
import
threading
import
threading
except
ImportError
:
except
ImportError
:
...
@@ -260,7 +261,9 @@ class TestHelperFunctions(unittest.TestCase):
...
@@ -260,7 +261,9 @@ class TestHelperFunctions(unittest.TestCase):
class
TestFifo
(
unittest
.
TestCase
):
class
TestFifo
(
unittest
.
TestCase
):
def
test_basic
(
self
):
def
test_basic
(
self
):
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
f
=
asynchat
.
fifo
()
f
=
asynchat
.
fifo
()
assert
issubclass
(
w
[
0
].
category
,
DeprecationWarning
)
f
.
push
(
7
)
f
.
push
(
7
)
f
.
push
(
b'a'
)
f
.
push
(
b'a'
)
self
.
assertEqual
(
len
(
f
),
2
)
self
.
assertEqual
(
len
(
f
),
2
)
...
@@ -275,7 +278,9 @@ class TestFifo(unittest.TestCase):
...
@@ -275,7 +278,9 @@ class TestFifo(unittest.TestCase):
self
.
assertEqual
(
f
.
pop
(),
(
0
,
None
))
self
.
assertEqual
(
f
.
pop
(),
(
0
,
None
))
def
test_given_list
(
self
):
def
test_given_list
(
self
):
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
f
=
asynchat
.
fifo
([
b'x'
,
17
,
3
])
f
=
asynchat
.
fifo
([
b'x'
,
17
,
3
])
assert
issubclass
(
w
[
0
].
category
,
DeprecationWarning
)
self
.
assertEqual
(
len
(
f
),
3
)
self
.
assertEqual
(
len
(
f
),
3
)
self
.
assertEqual
(
f
.
pop
(),
(
1
,
b'x'
))
self
.
assertEqual
(
f
.
pop
(),
(
1
,
b'x'
))
self
.
assertEqual
(
f
.
pop
(),
(
1
,
17
))
self
.
assertEqual
(
f
.
pop
(),
(
1
,
17
))
...
...
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