The code should speak for itself:
$ python
Python 3.3.0 (default, Dec 22 2012, 21:02:07)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> '{}'.format(np.bytes_(b'Hello'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: maximum recursion depth exceeded while calling a Python object
>>> np.version.version
'1.7.0'
Both str
and repr
return "b'Hello'"
on np.bytes_(b'Hello')
, and I can print(np.bytes_(b'Hello'))
just fine, but in a format string it falls into a recursion loop.
Am I being stupid or is it indeed what it appears to be, i.e. a problem in numpy
? Even if it is, I don't quite understand what is happening. Can someone please explain?
I haven't reproduced it with Python 2.