This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: DeprecationWarning in test_asyncio.test_pep492.StreamReaderTests.test_readline
Type: behavior Stage: resolved
Components: asyncio Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, miss-islington, xtreak, yselivanov
Priority: normal Keywords: patch

Created on 2019-05-11 07:05 by xtreak, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13243 merged xtreak, 2019-05-11 07:56
Messages (4)
msg342170 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-05-11 07:05
It seems there was a deprecation warning added in ad4ed872415d00fcdfaa52a08108ec752b115000 that causes error when test_asyncio.test_pep492.StreamReaderTests.test_readline is ran with -Werror.


➜  cpython git:(master) ./python.exe -Werror -m unittest -v test.test_asyncio.test_pep492.StreamReaderTests.test_readline
test_readline (test.test_asyncio.test_pep492.StreamReaderTests) ... ERROR

======================================================================
ERROR: test_readline (test.test_asyncio.test_pep492.StreamReaderTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_pep492.py", line 97, in test_readline
    stream = asyncio.StreamReader(loop=self.loop)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/asyncio/streams.py", line 446, in __init__
    warnings.warn(f"{self.__class__} should be instaniated "
DeprecationWarning: <class 'asyncio.streams.StreamReader'> should be instaniated by asyncio internals only, please avoid its creation from user code

----------------------------------------------------------------------
Ran 1 test in 0.003s

FAILED (errors=1)

# Before commit

➜  cpython git:(master) git checkout ad4ed872415d00fcdfaa52a08108ec752b115000~1 Lib/asyncio
➜  cpython git:(master) ✗ ./python.exe -Werror -m unittest -v test.test_asyncio.test_pep492.StreamReaderTests.test_readline
test_readline (test.test_asyncio.test_pep492.StreamReaderTests) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.004s

OK
msg342175 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-05-11 07:58
Looking at the commit where similar tests were fixed I think passing _asyncio_internal=True fixes the issue so I have created a PR with the same.
msg342176 - (view) Author: miss-islington (miss-islington) Date: 2019-05-11 08:45
New changeset 79972f1fad5247ade34ef98ad987162a9a78401d by Miss Islington (bot) (Xtreak) in branch 'master':
bpo-36884: Fix DeprecationWarning in test_asyncio StreamReader instantiation (GH-13243)
https://github.com/python/cpython/commit/79972f1fad5247ade34ef98ad987162a9a78401d
msg342177 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2019-05-11 08:46
Nice catch!
History
Date User Action Args
2022-04-11 14:59:15adminsetgithub: 81065
2019-05-11 08:46:31asvetlovsetstatus: open -> closed
resolution: fixed
messages: + msg342177

stage: resolved
2019-05-11 08:45:31miss-islingtonsetnosy: + miss-islington
messages: + msg342176
2019-05-11 07:58:19xtreaksetmessages: + msg342175
stage: patch review -> (no value)
2019-05-11 07:56:31xtreaksetkeywords: + patch
stage: patch review
pull_requests: + pull_request13155
2019-05-11 07:05:13xtreakcreate