New submission from STINNER Victor:

Given the following snippet:

    with open("x", "w+", encoding="utf-8") as fp:
        pass

Creating the TextIOWrapper object requires many syscall: see the issue #30228.

But I also noticed that *closing* such object also requires multiple lseek() 
syscalls, whereas the snippet doesn't read nor write anything.

Attached PR avoids lseek() if read and write buffers are empty.

----------
components: IO
messages: 292749
nosy: haypo, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Closing a BufferedRandom calls lseek() mutliple times
type: performance
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30229>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to