Fix Python gotcha with module globals, and missing 'cond' in lslextrafuncs.

The previous commit didn't work as expected. "from module import var" freezes the value at load time; changing it later has no effect. A reference to the module needs to be used.

Fix that and the similar problem with LSO. Also revert some "from lslcommon import *" introduced earlier.

That also revealed another bug about missing 'cond' in the import list of lslextrafuncs. This should fix all functions that return values on null key input.
This commit is contained in:
Sei Lisa 2016-12-21 00:22:49 +01:00
parent 7c2c09188d
commit 991e811f2d
4 changed files with 12 additions and 10 deletions

View file

@ -475,7 +475,7 @@ def InternalUTF8toString(s):
# NOTE: Without the above line, the following one hits a bug in
# python-coverage. It IS executed but not detected.
continue
if LSO:
if lslcommon.LSO:
raise ELSONotSupported(u"Byte strings not supported")
ret += u'?' * len(partialchar)
partialchar = b''
@ -484,14 +484,14 @@ def InternalUTF8toString(s):
partialchar = c
pending = 1 if o < 0xE0 else 2 if o < 0xF0 else 3
elif o >= 0x80:
if LSO:
if lslcommon.LSO:
raise ELSONotSupported(u"Byte strings not supported")
ret += u'?'
else:
ret += c.decode('utf8')
if partialchar:
if LSO:
if lslcommon.LSO:
raise ELSONotSupported(u"Byte strings not supported")
ret += u'?' * len(partialchar)