[issue41382] print() unpredictable behaviour

n-io report at bugs.python.org
Fri Jul 24 09:56:19 EDT 2020


New submission from n-io <stawi78 at hotmail.com>:

There seems to be a behavioural issue with the print() function. Using python3.8 and the following line:

>>> print("\t".join(['arith_int_512-cuda.sfeat', '__hipsyclkernel$wrapped_kernelname$MicroBenchArithmeticKernel_512_1', '578', '65', '5', '64', '4', '1025', '128', '1', '1', '512', '1']))

arith_int_512-cuda.sfeat    __hipsyclkernel$wrapped_kernelname$MicroBenchArithmeticKernel_512_1    578    65    5    64    4    1025    128    512    1

Notice the missing numbers between 128 and 512. If I do random modifications the either of the first two string, some of the missing numbers may appear. For instance:

>>> print("\t".join(['arith_int_512-cuda', '__hipsycl_kernel_$wrapped_kernel_name_$MicroBenchArithmeticKernel_512_1', '578', '65', '5', '64', '4', '1025', '128', '1', '1', '512', '1']))

arith_int_512-cuda	__hipsycl_kernel_$wrapped_kernel_name_$MicroBenchArithmeticKernel_512_1	578	65	5	64	4	1025	128	1	512	1

Notice that one of the two missing numbers has appeared. There appears nothing wrong with the value used to invoke print.

The error appears to be linked to joining on the "\t" character and does not appear to occur when joining on other whitespace characters such as " ".join(...) or "\n".join(...)

----------
components: IO
messages: 374176
nosy: n-io
priority: normal
severity: normal
status: open
title: print() unpredictable behaviour
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41382>
_______________________________________


More information about the Python-bugs-list mailing list