You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That each character with the '\0' notation is handled as a separate character. As in e.g. Python.
I.e. '\0\0' is two chars of the same code point.
'\0A' should be the same as "\0"+"A", which it isn't currently.
Python
> [ ord(c) for c in "\0\0"]
[0, 0]
KCL
> [ ord(c) for c in "\0\0"]
[0, 48]
3. What did you see instead (Required)
That '\0\0' equals to "\00".
"\0A" equals to "\0"
4. What is your KCL components version? (Required)
> kcl --version
kcl version 0.11.0
Same with 0.11.1
system:
> uname -a
Darwin 24.3.0 Darwin Kernel Version 24.3.0 ... arm64
The text was updated successfully, but these errors were encountered:
Additional test cases to showcase the issue.
All these tests fails currently.
test_null0 = lambda {
assert 'aa' == ("a" + "a") # Works as expected
assert '\0\0' == ("\0" + "\0")
}
test_null1 = lambda {
n = '\0\0'
res = [ord(i) for i in n]
assert res == [0, 0]
# actual [0, 48]
}
test_null2 = lambda {
n = '\0\0\0\0'
res = [ord(i) for i in n]
assert res == [0, 0, 0, 0]
# actual [0, 48, 0, 48]
}
test_null3 = lambda {
assert "\0A" != "\0"
}
test_null4 = lambda {
n = 'A\0A'
res = [ord(i) for i in n]
assert res == [65, 0, 65]
#actual [65, 0]
}
test_null5 = lambda {
n = '\t\0\t'
res = [ord(i) for i in n]
assert res == [9, 0, 9]
#actual [9, 0, 116]
}
Bug Report
Not sure what the reason is. It seems it handles the token after '\0' a bit odd. However, the
'\x00
notation seems to work as expected.1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
That each character with the
'\0'
notation is handled as a separate character. As in e.g. Python.I.e.
'\0\0'
is two chars of the same code point.'\0A' should be the same as "\0"+"A", which it isn't currently.
Python
KCL
3. What did you see instead (Required)
That '\0\0' equals to "\00".
"\0A" equals to "\0"
4. What is your KCL components version? (Required)
Same with
0.11.1
system:
The text was updated successfully, but these errors were encountered: