Minor bug with Mat3 to-string/printout in Python

Minor bug: when printing a Mat3 object, it wrongly shows as LMatrix4f, but should show as LMatrix3f.

To reproduce (panda3d 1.10.16, python 3.14, Windows 11):

mat_token = Mat3()
mat_token
LMatrix4f(1, 0, 0, 0, 1, 0, 0, 0, 1)

should be: LMatrix3f(1, 0, 0, 0, 1, 0, 0, 0, 1)

It doesn’t correspond to reality.

from panda3d.core import Mat3
mat_token = Mat3()
print(type(mat_token))
<class 'panda3d.core.LMatrix3f'>

Ah, you’re right. Thanks for catching this! We’ll fix this in the next release, Panda 1.11.0.

They’re not talking about the string-representation of the Mat3 type-object, but rather of the string-representation of the object itself. That is, what you get when you simply print a Mat3 instance.

1 Like

Hmm, I have this result. :man_shrugging:

from panda3d.core import Mat3

print(Mat3())
print(str(Mat3()))

print(Mat3)
print(str(Mat3))
1 0 0
0 1 0
0 0 1

1 0 0
0 1 0
0 0 1

<class 'panda3d.core.LMatrix3f'>
<class 'panda3d.core.LMatrix3f'>

They’re talking about repr(mat3), which does exhibit the bug. This is different from str(mat3).

2 Likes

There are legal subtleties in programming that I need to know… You sound like a lawyer in programmer.

Aah, right–I’d honestly missed that there was a difference between “repr” and “str” output!