rpm-python only accepts string objects, not unicode
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 13 Mar 2009 07:26:04 +0000 (09:26 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 13 Mar 2009 07:26:04 +0000 (09:26 +0200)
- Reverts broken commit 832fe4f01865cd17ab9393fc48b960206da223b0.
  Anything trying to pass in unicode objects is already broken as
  PyString_AsString() uses default encoding for unicode conversions, which
  by default is ascii (at least in python >= 2.5) so any non-ascii string
  will cause it to fail anyway.
- Only accepting strings keeps encoding madness out of rpm, thank you Toshio.

python/rpmts-py.c

index 84da9cb..e56e001 100644 (file)
@@ -1100,7 +1100,7 @@ fprintf(stderr, "*** rpmts_Match(%p) ts %p\n", s, s->ts);
     }
 
     if (Key) {
-       if (PyString_Check(Key) || PyUnicode_Check(Key)) {
+       if (PyString_Check(Key)) {
            key = PyString_AsString(Key);
            len = PyString_Size(Key);
        } else if (PyInt_Check(Key)) {