Fix regression introduced with the latest changes to loadlib

In Python 2, function type names from buiiltins.txt were entered into the tables as Unicode, causing the output module to promote strings to Unicode, and causing trouble further down the line.

Entering them as str fixes the issue.

Thanks a lot to @PeterStindberg for reporting the issue and providing a script that reproduces it.

Fixes #21
This commit is contained in:
Sei Lisa 2023-01-09 11:03:41 +01:00
parent 642f8e995d
commit e3c1634724
3 changed files with 19 additions and 2 deletions

View file

@ -104,7 +104,7 @@ def LoadLibrary(builtins = None, fndata = None):
% (ubuiltins, linenum, argtyp))
bad = True
break
args.append(argtyp)
args.append(u2str(argtyp))
if bad:
continue
name = match.group(2)
@ -123,7 +123,8 @@ def LoadLibrary(builtins = None, fndata = None):
u" in %s, overwriting: %s"
% (linenum, ubuiltins, name))
fn = getattr(lslfuncs, name, None)
functions[name] = {'Kind':'f', 'Type':typ, 'uns':True,
styp = None if typ is None else u2str(typ)
functions[name] = {'Kind':'f', 'Type':styp, 'uns':True,
'ParamTypes':args, 'NeedsData':True}
if fn is not None:
functions[name]['Fn'] = fn

View file

@ -0,0 +1,8 @@
default
{
state_entry()
{
llOwnerSay(llList2Key(llGetObjectDetails("", [1]),0));
llOwnerSay(llChar(0xA1));
}
}

View file

@ -0,0 +1,8 @@
default
{
state_entry()
{
llOwnerSay((key)((string)llGetObjectDetails("", (list)1)));
llOwnerSay("¡");
}
}