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

closed stdout causes error on stderr when the interpreter unconditionally flushes on shutdown #57653

Closed
RonnyPfannschmidt mannequin opened this issue Nov 21, 2011 · 5 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@RonnyPfannschmidt
Copy link
Mannequin

RonnyPfannschmidt mannequin commented Nov 21, 2011

BPO 13444
Nosy @birkenfeld, @terryjreedy, @pitrou, @RonnyPfannschmidt, @vadmium, @jleedev

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 = <Date 2014-11-12.05:49:16.963>
created_at = <Date 2011-11-21.15:18:19.942>
labels = ['interpreter-core', 'type-bug']
title = 'closed stdout causes error on stderr when the interpreter unconditionally flushes on shutdown'
updated_at = <Date 2014-11-12.05:49:16.962>
user = 'https://github.com/RonnyPfannschmidt'

bugs.python.org fields:

activity = <Date 2014-11-12.05:49:16.962>
actor = 'berker.peksag'
assignee = 'none'
closed = True
closed_date = <Date 2014-11-12.05:49:16.963>
closer = 'berker.peksag'
components = ['Interpreter Core']
creation = <Date 2011-11-21.15:18:19.942>
creator = 'Ronny.Pfannschmidt'
dependencies = []
files = []
hgrepos = []
issue_num = 13444
keywords = []
message_count = 5.0
messages = ['148055', '148155', '148198', '148422', '231062']
nosy_count = 9.0
nosy_names = ['georg.brandl', 'terry.reedy', 'mkc', 'pitrou', 'Arfrever', 'python-dev', 'Ronny.Pfannschmidt', 'martin.panter', 'jleedev']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue13444'
versions = ['Python 3.2', 'Python 3.3']

@RonnyPfannschmidt
Copy link
Mannequin Author

RonnyPfannschmidt mannequin commented Nov 21, 2011

not sure if this is to be considered a bug,
but python3.2 tries to flush sys.stdout on shutdown, even if its closed

$ python3.2 -c 'import sys;sys.stdout.close()'
Exception ValueError: 'I/O operation on closed file.' in <_io.TextIOWrapper name='<stdout>' mode='w' encoding='ANSI_X3.4-1968'> ignored

its related to how Issue bpo-5319 was fixed

@RonnyPfannschmidt RonnyPfannschmidt mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Nov 21, 2011
@pitrou
Copy link
Member

pitrou commented Nov 22, 2011

I think closing stdout is a legitimate desire so, yes, I would consider it a bug if we print an error in that case.
A patch could either first check the "closed" attribute, or silence the ValueError.

@pitrou pitrou added the type-bug An unexpected behavior, bug, or error label Nov 22, 2011
@RonnyPfannschmidt
Copy link
Mannequin Author

RonnyPfannschmidt mannequin commented Nov 23, 2011

i think checking for closed is the correct solution

@python-dev
Copy link
Mannequin

python-dev mannequin commented Nov 26, 2011

New changeset 150e096095e5 by Antoine Pitrou in branch '3.2':
Issue bpo-13444: When stdout has been closed explicitly, we should not attempt to flush it at shutdown and print an error.
http://hg.python.org/cpython/rev/150e096095e5

New changeset 37300a1df7d7 by Antoine Pitrou in branch 'default':
Issue bpo-13444: When stdout has been closed explicitly, we should not attempt to flush it at shutdown and print an error.
http://hg.python.org/cpython/rev/37300a1df7d7

@vadmium
Copy link
Member

vadmium commented Nov 12, 2014

Shouldn’t this issue be marked closed and fixed?

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants