Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush file after warning is written #85223

Open
manueljacob mannequin opened this issue Jun 20, 2020 · 1 comment
Open

Flush file after warning is written #85223

manueljacob mannequin opened this issue Jun 20, 2020 · 1 comment
Labels
3.13 bugs and security fixes topic-IO type-feature A feature request or enhancement

Comments

@manueljacob
Copy link
Mannequin

manueljacob mannequin commented Jun 20, 2020

BPO 41051
Nosy @manueljacob
PRs
  • gh-85223: Flush file after warning is written #21000
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2020-06-20.12:34:37.631>
    labels = ['type-bug', 'expert-IO']
    title = 'Flush file after warning is written'
    updated_at = <Date 2020-09-27.00:06:07.034>
    user = 'https://github.com/manueljacob'

    bugs.python.org fields:

    activity = <Date 2020-09-27.00:06:07.034>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['IO']
    creation = <Date 2020-06-20.12:34:37.631>
    creator = 'mjacob'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41051
    keywords = ['patch']
    message_count = 1.0
    messages = ['371934']
    nosy_count = 1.0
    nosy_names = ['mjacob']
    pr_nums = ['21000']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue41051'
    versions = []

    @manueljacob
    Copy link
    Mannequin Author

    manueljacob mannequin commented Jun 20, 2020

    Calling warnings.warn() will write to a file, but not flush it. On Python 3.9+, it won’t usually be a problem because the file is most likely stderr, which is always line-buffered. However, on older Python versions or if a different file is used, the current behavior unnecessarily delays the output of the warning. This is especially problematic if the warning is about buffering behavior itself, as e.g. caused by open('/tmp/test', 'wb', buffering=1).

    @iritkatriel iritkatriel added topic-IO type-bug An unexpected behavior, bug, or error labels Sep 27, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @iritkatriel iritkatriel added type-feature A feature request or enhancement 3.12 bugs and security fixes and removed type-bug An unexpected behavior, bug, or error labels Apr 7, 2023
    @erlend-aasland erlend-aasland added 3.13 bugs and security fixes and removed 3.12 bugs and security fixes labels Jan 5, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.13 bugs and security fixes topic-IO type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants