Page MenuHome

Unhandled Exceptions when introducing invalid parameters for transformations
Open, Needs Triage by DeveloperPublic


System Information
Operating system: Linux-4.15.0-58-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.26

Blender Version
Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: rBf6cb5f54494e

Exact steps for others to reproduce the error

  • Select the default cube
  • Press G to move it
  • Press "=" to enter custom values
  • Write some nonsense like "h" or "1mmm"
  • The console prints two kinds of unhandled exceptions: NameError and SyntaxError, respectively

I discovered this issue when trying to use the builtin function bpy.utils.units.to_value(). The same thing happens here when the string argument has some invalid data.
Because the exceptions happen inside the function, I'm unable to catch them properly.
When the data is invalid, that function raises ValueError properly, which I can catch, but then NameError and SyntaxError continue to leak.



Event Timeline

I can reproduce. This issue produces a lot of console spam when you transform with functions (shearing by 1/tan(radians(60)), for example), since it throws a syntax error for each character you type. I'm not sure how hacky of a fix is appropriate here.

Found another misbehaviour with bpy.utils.units.to_value()
When using the Imperial unit system, if the input string is empty, it doesn't produce the expected result which should be 0.0
Specifically, it fails when converting from Metric to Imperial, when performing the division x/0.3048
This of course doesn't happen when using the Metric unit system.

I believe this functions needs a full review.