Preparation of polyesters and a polyanhydride containing