robotpy / mostrobotpy

Official Repository of python implementation of WPILib components
https://robotpy.github.io
Other
9 stars 10 forks source link

TrapezoidProfile signature includes default object repr for State #23

Open auscompgeek opened 3 years ago

auscompgeek commented 3 years ago

despite having a __repr__ implementation in the template_inline_code.

virtuald commented 2 years ago

Yeah, this is really interesting. On Linux:

from wpimath._controls._controls.trajectory import TrapezoidProfile

print(repr(TrapezoidProfile.State()))

Gives me:

LLVM ERROR: out of memory
Aborted (core dumped)

When I don't capture the clsName this goes away and the repr works fine, but it doesn't work correctly. Presumably because the repr isn't registered until after the default arguments are processed?

auscompgeek commented 2 years ago

Oh, hmm. It does seem like the repr was quite broken. Could've sworn it worked last year. On macOS:


>>> from wpimath.trajectory import TrapezoidProfile
>>> TrapezoidProfile.State()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa9 in position 0: invalid start byte
auscompgeek commented 2 years ago

Presumably because the repr isn't registered until after the default arguments are processed?

I think this is what's happening, yeah. Need a way to add some code before all the methods are registered.