Preloading a script inside autoloaded script not correctly initializing variables?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TheSHEEEP

I’m porting a project of mine from 2.1.4 to 3.0.

Now I’ve hit a very strange behavior:

Inside an autoloaded script, I preload and instantiate another script, like this:

var optionValues = preload("res://src/").new()

Inside that GlobalValues script, I declare an empty dictionary variable as a member, like this:

var _values = {}

This empty dictionary is then accessed in functions of the GlobalValues script, like this:

# Set a value
func set(key, value):
	_values[key] = value

This results in an error, as _values is Null and not, as one would expect, a “Dictionary{0}”. Worked fine in 2.1.4, of course.
_values is never set to Null and I tried declaring an empty dictionary in the autoloaded script itself, which works fine, so it’s not like anything is wrong with “= {}”.

So my guess is there has been some change to preload that I’m not aware of (there should really be a 2.1.4 → 3.0 porting guide, btw…) or this is a bug - in which case I’ll report it on github later.