#33333: Models with a BinaryField fail to deepcopy
-------------------------------------+-------------------------------------
               Reporter:  Adam       |          Owner:  nobody
  Zimmerman                          |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  3.2
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 While using Postgres, models with a BinaryField fail to deepcopy, due to
 Django returning these field values as `memoryview` objects. This causes
 issues when creating instances in `setUpTestData()` during tests.

 The specific errors seem to be fairly inconsistent and hard to reproduce.
 But often the exception complains about a missing `_state` field, or that
 `_state` has no attribute `db`.

 I've currently worked around this by implementing a mixin for models where
 the `__getstate__()` method converts any `memoryview`s to `bytes`. But I
 don't know if that's the correct solution for Django generally.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33333>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.008970e6c17ad5640f908301181b0a94%40djangoproject.com.

Reply via email to