[issue44687] io.BufferedReader:peek() closes underlying file, breaking peek/read expectations

2021-09-19 Thread Jun De
Change by Jun De : -- keywords: +patch nosy: +AngstyDuck nosy_count: 1.0 -> 2.0 pull_requests: +26859 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28457 ___ Python tracker <https://bugs.python.org/i

[issue44687] io.BufferedReader:peek() closes underlying file, breaking peek/read expectations

2021-09-24 Thread Jun De
Jun De added the comment: Yeap Steve, I was thinking the same thing. I've taken the buffered data into consideration when checking if the file is closed in my fix, feel free to take a look and let me know what you think :) -- ___ Python tracker

[issue44687] io.BufferedReader:peek() closes underlying file, breaking peek/read expectations

2021-09-24 Thread Jun De
Jun De added the comment: Awesome! To be honest I was very inclined to add test cases for this edge case, but while some existing test cases use native objects like io.BytesIO, the one that our edge case uses is HTTPResponse from `urllib3.response.py`. Should I still go ahead with writing