Re: Issue with PyUnicodeObject type variables

2010-05-17 Thread Stefan Behnel

gmail, 17.05.2010 11:24:

A variable whose data type is PyUnicodeObject checked whether it is a 
UnicodeObject type.
Got output as false

example :

PyUnicodeObject *p;
if (PyUnicode_Check(path)) {
 printf(\nTrue.\n);

}
else {
 printf(\nfalse.\n);
}

output: false


Doesn't surprise me at all. Could you make sure this is the code you are 
using? Especially the names 'p' and 'path'? And that you are initialising 
neither of the two in your code?


Stefan

--
http://mail.python.org/mailman/listinfo/python-list


Re: Issue with PyUnicodeObject type variables

2010-05-17 Thread mathan kumar
-- Forwarded message --
From: Stefan Behnel stefan...@behnel.de
To: python-list@python.org
Date: Mon, 17 May 2010 11:33:40 +0200
Subject: Re: Issue with PyUnicodeObject type variables
gmail, 17.05.2010 11:24:

 A variable whose data type is PyUnicodeObject checked whether it is a
 UnicodeObject type.
 Got output as false

 example :

 PyUnicodeObject *p;
 if (PyUnicode_Check(path)) {
 printf(\nTrue.\n);

 }
 else {
 printf(\nfalse.\n);
 }

 output: false


Doesn't surprise me at all. Could you make sure this is the code you are
using? Especially the names 'p' and 'path'? And that you are initialising
neither of the two in your code?

Stefan


Tat was a typo mistake instead of *p pls consider *path as follows.

PyUnicodeObject *path;
if (PyUnicode_Check(path)) {
printf(\nTrue.\n);

}
else {
printf(\nfalse.\n);
}
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Issue with PyUnicodeObject type variables

2010-05-17 Thread Stefan Behnel

mathan kumar, 17.05.2010 12:16:

From: Stefan Behnel

Doesn't surprise me at all. Could you make sure this is the code you are
using? Especially the names 'p' and 'path'? And that you are initialising
neither of the two in your code?


Tat was a typo mistake instead of *p pls consider *path as follows.

PyUnicodeObject *path;
if (PyUnicode_Check(path)) {


Again, you are not initialising the pointer, so it contains an arbitrary 
value when you run the program. You are lucky that it gives you a result at 
all, instead of just plain crashing.


You do not seem to have much experience with C. Is there any reason why you 
want to use it? Or is this just for curiosity?


Stefan

--
http://mail.python.org/mailman/listinfo/python-list