@@ -27,7 +27,7 @@ static PyObject* PyXmlSec_Transform__str__(PyObject* self) {
2727 else
2828 snprintf (buf , sizeof (buf ), "%s, None" , transform -> id -> name );
2929
30- return PyString_FromString (buf );
30+ return PyUnicode_FromString (buf );
3131}
3232
3333// __repr__ method
@@ -38,18 +38,18 @@ static PyObject* PyXmlSec_Transform__repr__(PyObject* self) {
3838 snprintf (buf , sizeof (buf ), "__Transform('%s', '%s', %d)" , transform -> id -> name , transform -> id -> href , transform -> id -> usage );
3939 else
4040 snprintf (buf , sizeof (buf ), "__Transform('%s', None, %d)" , transform -> id -> name , transform -> id -> usage );
41- return PyString_FromString (buf );
41+ return PyUnicode_FromString (buf );
4242}
4343
4444static const char PyXmlSec_TransformNameGet__doc__ [] = "The transform's name." ;
4545static PyObject * PyXmlSec_TransformNameGet (PyXmlSec_Transform * self , void * closure ) {
46- return PyString_FromString ((const char * )self -> id -> name );
46+ return PyUnicode_FromString ((const char * )self -> id -> name );
4747}
4848
4949static const char PyXmlSec_TransformHrefGet__doc__ [] = "The transform's identification string (href)." ;
5050static PyObject * PyXmlSec_TransformHrefGet (PyXmlSec_Transform * self , void * closure ) {
5151 if (self -> id -> href != NULL )
52- return PyString_FromString ((const char * )self -> id -> href );
52+ return PyUnicode_FromString ((const char * )self -> id -> href );
5353 Py_RETURN_NONE ;
5454}
5555
@@ -149,7 +149,7 @@ static PyObject* PyXmlSec_KeyData__str__(PyObject* self) {
149149 snprintf (buf , sizeof (buf ), "%s, %s" , keydata -> id -> name , keydata -> id -> href );
150150 else
151151 snprintf (buf , sizeof (buf ), "%s, None" , keydata -> id -> name );
152- return PyString_FromString (buf );
152+ return PyUnicode_FromString (buf );
153153}
154154
155155// __repr__ method
@@ -160,18 +160,18 @@ static PyObject* PyXmlSec_KeyData__repr__(PyObject* self) {
160160 snprintf (buf , sizeof (buf ), "__KeyData('%s', '%s')" , keydata -> id -> name , keydata -> id -> href );
161161 else
162162 snprintf (buf , sizeof (buf ), "__KeyData('%s', None)" , keydata -> id -> name );
163- return PyString_FromString (buf );
163+ return PyUnicode_FromString (buf );
164164}
165165
166166static const char PyXmlSec_KeyDataNameGet__doc__ [] = "The key data's name." ;
167167static PyObject * PyXmlSec_KeyDataNameGet (PyXmlSec_KeyData * self , void * closure ) {
168- return PyString_FromString ((const char * )self -> id -> name );
168+ return PyUnicode_FromString ((const char * )self -> id -> name );
169169}
170170
171171static const char PyXmlSec_KeyDataHrefGet__doc__ [] = "The key data's identification string (href)." ;
172172static PyObject * PyXmlSec_KeyDataHrefGet (PyXmlSec_KeyData * self , void * closure ) {
173173 if (self -> id -> href != NULL )
174- return PyString_FromString ((const char * )self -> id -> href );
174+ return PyUnicode_FromString ((const char * )self -> id -> href );
175175 Py_RETURN_NONE ;
176176}
177177
@@ -245,15 +245,13 @@ static PyObject* PyXmlSec_KeyDataNew(xmlSecKeyDataId id) {
245245 return (PyObject * )keydata ;
246246}
247247
248- #ifdef PY3K
249248static PyModuleDef PyXmlSec_ConstantsModule =
250249{
251250 PyModuleDef_HEAD_INIT ,
252251 STRINGIFY (MODULE_NAME ) ".constants" ,
253252 PYXMLSEC_CONSTANTS_DOC ,
254253 -1 , NULL , NULL , NULL , NULL , NULL
255254};
256- #endif // PY3K
257255
258256// initialize constants module and registers it base package
259257int PyXmlSec_ConstantsModule_Init (PyObject * package ) {
@@ -267,12 +265,7 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
267265 PyObject * keyDataTypeCls = NULL ;
268266 PyObject * tmp = NULL ;
269267
270- #ifdef PY3K
271268 constants = PyModule_Create (& PyXmlSec_ConstantsModule );
272- #else
273- constants = Py_InitModule3 (STRINGIFY (MODULE_NAME ) ".constants" , NULL , PYXMLSEC_CONSTANTS_DOC );
274- Py_XINCREF (constants );
275- #endif
276269
277270 if (!constants ) return -1 ;
278271
@@ -292,7 +285,7 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
292285#undef PYXMLSEC_ADD_INT_CONSTANT
293286
294287#define PYXMLSEC_DECLARE_NAMESPACE (var , name ) \
295- if (!(var = PyCreateDummyObject (name))) goto ON_FAIL; \
288+ if (!(var = PyModule_New (name))) goto ON_FAIL; \
296289 if (PyModule_AddObject(package, name, var) < 0) goto ON_FAIL; \
297290 Py_INCREF(var); // add object steels reference
298291
@@ -308,7 +301,7 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
308301
309302
310303#define PYXMLSEC_ADD_NS_CONSTANT (name , lname ) \
311- tmp = PyString_FromString ((const char*)(JOIN(xmlSec, name))); \
304+ tmp = PyUnicode_FromString ((const char*)(JOIN(xmlSec, name))); \
312305 PYXMLSEC_ADD_CONSTANT(nsCls, name, lname);
313306
314307 // namespaces
@@ -334,7 +327,7 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
334327
335328
336329#define PYXMLSEC_ADD_ENC_CONSTANT (name , lname ) \
337- tmp = PyString_FromString ((const char*)(JOIN(xmlSec, name))); \
330+ tmp = PyUnicode_FromString ((const char*)(JOIN(xmlSec, name))); \
338331 PYXMLSEC_ADD_CONSTANT(encryptionTypeCls, name, lname);
339332
340333 // encryption type
@@ -349,7 +342,7 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
349342
350343
351344#define PYXMLSEC_ADD_NODE_CONSTANT (name , lname ) \
352- tmp = PyString_FromString ((const char*)(JOIN(xmlSec, name))); \
345+ tmp = PyUnicode_FromString ((const char*)(JOIN(xmlSec, name))); \
353346 PYXMLSEC_ADD_CONSTANT(nodeCls, name, lname);
354347
355348 // node
0 commit comments