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

stderr "refs" output does not respect PYTHONIOENCODING #59853

Closed
cjerdonek opened this issue Aug 14, 2012 · 2 comments
Closed

stderr "refs" output does not respect PYTHONIOENCODING #59853

cjerdonek opened this issue Aug 14, 2012 · 2 comments

Comments

@cjerdonek
Copy link
Member

BPO 15648
Nosy @birkenfeld, @cjerdonek

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 2013-10-14.14:19:30.556>
created_at = <Date 2012-08-14.11:40:28.084>
labels = []
title = 'stderr "refs" output does not respect PYTHONIOENCODING'
updated_at = <Date 2013-10-14.14:19:30.554>
user = 'https://github.com/cjerdonek'

bugs.python.org fields:

activity = <Date 2013-10-14.14:19:30.554>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = <Date 2013-10-14.14:19:30.556>
closer = 'georg.brandl'
components = []
creation = <Date 2012-08-14.11:40:28.084>
creator = 'chris.jerdonek'
dependencies = []
files = []
hgrepos = []
issue_num = 15648
keywords = []
message_count = 2.0
messages = ['168192', '199894']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'chris.jerdonek']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue15648'
versions = ['Python 3.3']

@cjerdonek
Copy link
Member Author

The --help documentation for the python executable says--

PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.

However, PYTHONIOENCODING doesn't seem to be respected for the python executable's "refs" output to stderr. For example, this--

args = [sys.executable, '-c', "print('[100 refs]')"]

env = {'PYTHONIOENCODING': 'utf-8'}
popen = Popen(args, universal_newlines=False, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env)
print(repr(popen.communicate()))

env = {'PYTHONIOENCODING': 'utf-16'}
popen = Popen(args, universal_newlines=False, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env)
print(repr(popen.communicate()))

yields--

(b'[10 refs]\n', b'[41761 refs]\n')
(b'[\x001\x000\x00 \x00r\x00e\x00f\x00s\x00]\x00\n\x00', b'[42367 refs]\n')

@birkenfeld
Copy link
Member

The "refs" output is only active in debug mode, and only for debugging. It is printed directly to stderr using C fprintf(), I don't think it's worth the complication.

@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
None yet
Projects
None yet
Development

No branches or pull requests

2 participants