Fixing strange behavior of user property generation with Python

Problem was that integers are converted to "long long"
in Python, which creates Variants rendering "#l1" as
parsable strings. These are marked as invalid by the
Syntax highlighter of the user properties editor.

This patch fixes the user properties editor syntax
highlighter to cover all Variant variants and
uses "long" type for Variant if possible.
This commit is contained in:
Matthias Koefferlein
2026-08-10 00:09:42 +02:00
parent 877e1856b0
commit f8b83357e1
6 changed files with 57 additions and 4 deletions
+20
View File
@@ -3165,6 +3165,26 @@ class Basic_TestClass < TestBase
end
def test_variant_formation
assert_equal(RBA::A::var2s(1.5), "##1.5")
assert_equal(RBA::A::var2s(-17), "#-17")
assert_equal(RBA::A::var2s("abc"), "'abc'")
assert_equal(RBA::A::var2s(nil), "nil")
assert_equal(RBA::A::var2s(true), "true")
assert_equal(RBA::A::var2s(false), "false")
assert_equal(RBA::A::var2s(RBA::DBox::new(0, 0, 10, 20)), "[dbox:(0,0;10,20)]")
assert_equal(RBA::A::var2s([ 0.5, "hello" ]), "(##0.5,'hello')")
assert_equal(RBA::A::var2s([ 0.5, [ 1, 2 ] ]), "(##0.5,(#1,#2))")
assert_equal(RBA::A::var2s({ 1 => 'one', 'two' => 17 }), "{#1=>'one','two'=>#17}")
if RBA::A::ll_size == 4
assert_equal(RBA::A::var2s(100000000000), "#l100000000000")
else
assert_equal(RBA::A::var2s(100000000000), "#100000000000")
end
end
def test_optional
if RBA::B.respond_to?(:int_to_optional)