function Promise.prototype._finalize(f)for I,Y in ipairs(f._queuedFinally)do(coroutine.wrap(Y))(f._status)end f._queuedFinally=nil f._queuedReject=nil f._queuedResolve=nil if not Promise.TEST then f._parent=nil f._consumers=nil end end

function Promise.prototype:_finalize()
	for _, callback in ipairs(self._queuedFinally) do
		-- Purposefully not passing values to callbacks here, as it could be the
		-- resolved values, or rejected errors. If the developer needs the values,
		-- they should use :andThen or :catch(explicitly.
		coroutine.wrap(callback)(self._status)
	end

	self._queuedFinally = nil
	self._queuedReject = nil
	self._queuedResolve = nil

	-- Clear references to other Promises to allow gc
	if not Promise.TEST then
		self._parent = nil
		self._consumers = nil
	end
end
