Opened 7 years ago

Closed 7 years ago

#28854 closed Cleanup/optimization (fixed)

Replace type(True) with bool in django/db/backends/sqlite3/schema.py

Reported by: Дилян Палаузов Owned by: nobody
Component: Migrations Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Why does the code below use type(True) instead of bool?

diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py
--- a/django/db/backends/sqlite3/schema.py
+++ b/django/db/backends/sqlite3/schema.py
@@ -37,7 +37,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
         except sqlite3.ProgrammingError:
             pass
         # Manual emulation of SQLite parameter quoting
-        if isinstance(value, type(True)):
+        if isinstance(value, bool):
             return str(int(value))
         if isinstance(value, (Decimal, float, int)):
             return str(value)

Change History (2)

comment:1 by Tim Graham, 7 years ago

Component: UncategorizedMigrations
Summary: django/db/backends/sqlite3/schema.py: type(True)Replace type(True) with bool in django/db/backends/sqlite3/schema.py
Triage Stage: UnreviewedReady for checkin
Type: UncategorizedCleanup/optimization

comment:2 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: newclosed

In 3308085:

Fixed #28854 -- Replaced type(True) with bool in sqlite's SchemaEditor.

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