Skip to content

TypeError: cannot pickle '_thread.lock' object #542

@rrauenza

Description

@rrauenza

I'll start with I don't know WHY the Q object has a _thread.lock object in it ... but ...

I think this is caused by this code, and the deepcopy of the Q object:

translate_polymorphic_Q_object(queryset_model, copy.deepcopy(q), using=using) for q in args

I wonder if the code should be using q.clone() (undocumented?) or even better, q.all() (which does the same as q.clone()), which supposedly makes a copy of the query? Oops, a Q object is not a query. It's a Q().

I noticed this seems similar to issue #524 that originates at the same line of code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions