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
97d15b1e
Commit
97d15b1e
authored
Jun 27, 2019
by
Andrew Svetlov
Committed by
GitHub
Jun 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace deprecation warning with RuntimeError (GH-14397)
parent
667eaffb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
Lib/asyncio/streams.py
Lib/asyncio/streams.py
+2
-4
Lib/test/test_asyncio/test_streams.py
Lib/test/test_asyncio/test_streams.py
+6
-0
No files found.
Lib/asyncio/streams.py
View file @
97d15b1e
...
...
@@ -1293,10 +1293,8 @@ class Stream:
is_server_side
=
False
,
_asyncio_internal
=
False
):
if
not
_asyncio_internal
:
warnings
.
warn
(
f"
{
self
.
__class__
}
should be instaniated "
"by asyncio internals only, "
"please avoid its creation from user code"
,
DeprecationWarning
)
raise
RuntimeError
(
f"
{
self
.
__class__
}
should be instantiated "
"by asyncio internals only"
)
self
.
_mode
=
mode
self
.
_transport
=
transport
self
.
_protocol
=
protocol
...
...
Lib/test/test_asyncio/test_streams.py
View file @
97d15b1e
...
...
@@ -1779,6 +1779,12 @@ os.close(fd)
self.loop.run_until_complete(test())
def test_stream_ctor_forbidden(self):
with self.assertRaisesRegex(RuntimeError,
"
should
be
instantiated
"
"
by
asyncio
internals
only
"):
asyncio.Stream(asyncio.StreamMode.READWRITE)
if __name__ == '__main__':
unittest.main()
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