Opened 2 years ago

Closed 2 years ago

#21037 closed Bug (fixed)

MigrationWriter.serialize() output invalid python for lambda functions.

Reported by: loic84 Owned by: Tim Graham <timograham@…>
Component: Migrations Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

AssertionError: Could not exec u'import migrations.test_writer\ntest_value_result = migrations.test_writer.<lambda>' (from value <function <lambda> at 0x104c7bde8>): invalid syntax (<string>, line 2)

Change History (3)

comment:1 Changed 2 years ago by loic84

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

PR https://github.com/django/django/pull/1550

We have two options here, either we error out or we nullify them: lambda *args, **kwargs: None.

I chose the former.

comment:2 Changed 2 years ago by timo

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 2 years ago by Tim Graham <timograham@…>

  • Owner set to Tim Graham <timograham@…>
  • Resolution set to fixed
  • Status changed from new to closed

In adc0ab3386520874dbc96c2f905fd66769b8f16d:

Fixed #21037 -- Made MigrationWriter raise a ValueError when serializing lambda functions.

Note: See TracTickets for help on using tickets.
Back to Top