Add support for python unicode objects.

The previous hack was that PyString_Check also returns True for unicode
 objects, but then the functions PyString_AsString always returned NULL
 for a unicode object. So now PyString_Check only returns true for strings,
 and a new function PyUnicode_Check was added.
(PyBaseString_Check): new function, with the old behavior of PyString_Check
(PyUnicode_*): new functions
For K616-011

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@175218 936e1b1b-40f2-da11-902a-00137254ae57
This commit is contained in:
Emmanuel Briot
2011-06-20 11:12:55 +00:00
parent 9c7e172c8b
commit 9dfd2e9399
4 changed files with 163 additions and 19 deletions

View File

@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------
G P S --
--
Copyright (C) 2003-2010, AdaCore --
Copyright (C) 2003-2011, AdaCore --
--
GPS is free software; you can redistribute it and/or modify it --
under the terms of the GNU General Public License as published by --
@@ -114,11 +114,23 @@ ada_py_xdecref (PyObject* obj)
}
int
ada_pystring_check (PyObject* obj)
ada_pybasestring_check (PyObject* obj)
{
return PyString_Check (obj) || PyUnicode_Check (obj);
}
int
ada_pystring_check (PyObject* obj)
{
return PyString_Check (obj);
}
int
ada_pyunicode_check (PyObject* obj)
{
return PyUnicode_Check (obj);
}
int
ada_pyint_check (PyObject* obj)
{