-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
copy.deepcopy() doesn't work anymore #210
Comments
that's because the Layer.save method stores a reference to the GlyphSet object that was used for writing, and the GlyphSet object in turns holds a filesystem object that uses some threading locks, which aren't pickleable, hence cannot be deepcopied. However, when the output format is UFOZ, since the Font.save method needs to close the writer (to be able to actually compress the zip file), we cannot hold that reference in Layer._glyphSet attribute, so we have to set it to None I think the reason why Layer holds a ref to the GlyphSet after saving is to support the testForExternalChanges feature. But that probably needs to be rethought (see #209). |
maybe for the deepcopy, you could try to use the getDataForSerialization and setDataFromSerialization methods |
OK. Thanks for looking into it. We'll use |
The |
we'd have to redefine |
Yeah. I looked at that. I need to experiment with it to see if there is some way to exclude a few things instead of listing a million things to include. |
how about we simply define def __deepcopy__(self, memo):
del memo # unused
data = self.getDataForSerialization()
copied = self.__class__()
copied.setDataFromSerialization(data)
return copied |
This now happens with 0.6.0, but was working before:
The text was updated successfully, but these errors were encountered: