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.

Author vstinner
Recipients pitrou, serhiy.storchaka, vstinner
Date 2017-05-02.12:17:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1493727473.11.0.059505577548.issue30229@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-05-02 12:17:53vstinnersetrecipients: + vstinner, pitrou, serhiy.storchaka
2017-05-02 12:17:53vstinnersetmessageid: <1493727473.11.0.059505577548.issue30229@psf.upfronthosting.co.za>
2017-05-02 12:17:53vstinnerlinkissue30229 messages
2017-05-02 12:17:53vstinnercreate