Classes loading using script console cause isinstance to return False

We have upgraded from 8.1.10 to 8.1.17 and we are see a difference in the way the script console is loading files/classes.

Here is an example

image

image

It appears that the testClass.TestClass is getting loaded twice with two different ids. Once when the console starts and then again when I access the property on TestClass2 which references TestClass.

Any help on this would be great. This does not seem to be a problem when running the code in a client only a problem in the script console.

Any ideas on this? It would really be nice to use the console to do quick code tests rather than having to go over to the client. We are now on 8.1.18 and this problem still exists.

Bump.

I have a module in my project script library built around Python's unittest. For the time being, I intend to run the tests manually, for a semi-automated approach to testing.

The way the modules are loaded cause unittest.TestCase.assertIsInstance() to return False unexpectedly. I even validated that the assert is doing what you would think... see jython/jython/lib-python/2.7/unittest/case.py.

I've provided what I believe to be the smallest reproduceable test. It's not much different from what OP provided 18mo ago.

# --- moduleA -----------------------------------------------------------------
def run():
	
	print isinstance(tmp.moduleB.getClassC(), tmp.moduleC.C)
	# False ?
	
	print(isinstance(tmp.moduleC.C(), tmp.moduleC.C))
	# True
# --- moduleB -----------------------------------------------------------------
def getClassC():
	return tmp.moduleC.C()
# --- moduleC -----------------------------------------------------------------
class C(object):
	def __init__(self):
		self.c = "c"

This can be called from the script console by moduleA.run().