      Detail, DumbCategory, ExtraInfo, Fan, Item, LeafA, LoopX, LoopZ,
      ManagedModel, Member, NamedCategory, Note, Number, Plaything, PointerA,
      Ranking, Related, Report, ReservedName, Tag, TvChef, Valid, X, Food, Eaten,
      Node, ObjectA, ObjectB, ObjectC, CategoryItem, SimpleCategory,
      SpecialCategory, OneToOneCategory)
  
  
  class BaseQuerysetTest(TestCase):
      def assertValueQuerysetEqual(self, qs, values):
          return self.assertQuerysetEqual(qs, values, transform=lambda x: x)
 
</s> remove                 if not (lookup_type == 'in'
                            and not hasattr(value, 'as_sql')
                            and not hasattr(value, '_as_sql')
                            and not value) and field.null:
                    # Leaky abstraction artifact: We have to specifically
                    # exclude the "foo__in=[]" case from this handling, because
                    # it's short-circuited in the Where class.
                    # We also need to handle the case where a subquery is provided
 </s> add                 if field.null:
                    # In SQL NULL = anyvalue returns unknown, and NOT unknown
                    # is still unknown. However, in Python None = anyvalue is False
                    # (and not False is True...), and we want to return this Python's
                    # view of None handling. So we need to specifically exclude the
                    # NULL values, and because we are inside NOT branch they will
                    # be included in the final resultset. We are essentially creating
                    # SQL like this here: NOT (col IS NOT NULL), where the first NOT
                    # is added in upper layers of the code.
    SpecialCategory, OneToOneCategory, NullableName)
      Detail, DumbCategory, ExtraInfo, Fan, Item, LeafA, LoopX, LoopZ,
      ManagedModel, Member, NamedCategory, Note, Number, Plaything, PointerA,
      Ranking, Related, Report, ReservedName, Tag, TvChef, Valid, X, Food, Eaten,
      Node, ObjectA, ObjectB, ObjectC, CategoryItem, SimpleCategory,
    SpecialCategory, OneToOneCategory, NullableName)
  
  
  class BaseQuerysetTest(TestCase):
      def assertValueQuerysetEqual(self, qs, values):
          return self.assertQuerysetEqual(qs, values, transform=lambda x: x)
keep keep keep keep replace keep keep keep keep keep
 Simplified QuerySet field.null handling

QuerySet had previously some complex logic for dealing with nullable
fields in negated add_filter() calls. It seems the logic is leftover
from a time where the WhereNode wasn't as intelligent in handling
field__in=[] conditions.

Thanks to aaugustin for comments on the patch. 
tests/regressiontests/queries/tests.py