              This test doesn't apply under Python 3 because the URL is a string
              and not a bytestring.
              """
              q = QueryDict(str(b'foo=bar&foo=\xff'))
              self.assertEqual(q['foo'], '\ufffd')
              self.assertEqual(q.getlist('foo'), ['bar', '\ufffd'])
  
      def test_pickle(self):
          q = QueryDict()
          q1 = pickle.loads(pickle.dumps(q, 2))
          self.assertEqual(q == q1, True)
 
</s> remove             case, bad UTF-8 encoding).
 </s> add             case, bad UTF-8 encoding), falling back to ISO-8859-1 decoding. </s> remove                                 force_text(value, encoding, errors='replace'))
 </s> add                                 value) </s> remove                 # query_string contains URL-encoded data, a subset of ASCII.
                query_string = query_string.decode()
 </s> add                 # query_string normally contains URL-encoded data, a subset of ASCII.
                try:
                    query_string = query_string.decode(encoding)
                except UnicodeDecodeError:
                    # ... but some user agents are misbehaving :-(
                    query_string = query_string.decode('iso-8859-1')
            self.assertEqual(q['foo'], '\xff')
            self.assertEqual(q.getlist('foo'), ['bar', '\xff'])
              This test doesn't apply under Python 3 because the URL is a string
              and not a bytestring.
              """
              q = QueryDict(str(b'foo=bar&foo=\xff'))
            self.assertEqual(q['foo'], '\xff')
            self.assertEqual(q.getlist('foo'), ['bar', '\xff'])
            self.assertEqual(q['foo'], '\xff')
            self.assertEqual(q.getlist('foo'), ['bar', '\xff'])
  
      def test_pickle(self):
          q = QueryDict()
          q1 = pickle.loads(pickle.dumps(q, 2))
          self.assertEqual(q == q1, True)
keep keep keep keep replace replace keep keep keep keep keep
 Fixed #22996 -- Prevented crash with unencoded query string

Thanks Jorge Carleitao for the report and Aymeric Augustin, Tim Graham
for the reviews. 
tests/httpwrappers/tests.py