mongoengine
mongoengine copied to clipboard
Fix BaseDocument._from_son() deepcopy failed with compiled regex
Fix for issue https://github.com/MongoEngine/mongoengine/issues/2429
Hi, thanks for the reviewing, I added more tests and changed approach for this fix based on that.
but there are some question might need more discussion:
deepcopy()won't copy class-level attributes added by__new__, which isinstance._fieldsin this case. which resulting in the test you request to add won't pass in the first place, is this expected or another bug for mongoengine?deepcopy()works for_fieldsattribute of the instance returned by_from_son(), but not work for the objects returned from queryset