Message67943
Tools/scripts/h2py.py doesn't work with char literals in a define. This
was first reported in the following post :
http://mail.python.org/pipermail/python-list/2005-September/340608.html
The fix works, I have included the patch as h2py.py.patch2.
Also, the current thing that is done when a char literal is encountered
is to use the char's ordinal value. I think that this is misleading,
since in C, if you use a char literal you are usually meaning to check
for an ascii char value like so :
#define EXIT_CHAR 'x'
/* ..... */
if(char_read == EXIT_CHAR)
exit(0)
and not an integer/numeric value, and if you intend to do numerical
things then you'd use an integer/numeric value instead.
This is the way ctypes does it with their h2xml.py & xml2py.py scripts.
So currently, a defines like the following :
#define EXIT_CHAR 'x'
#define MASK 0xfe
#define LIMIT 4
give (after the h2py.py.patch2 being applied) :
EXIT_CHAR = 120
MASK = 0xfe
LIMIT = 4
and the second patch I am submitting (h2py.py.patch) makes it give :
EXIT_CHAR = 'x'
MASK = 0xfe
LIMIT = 4
which I think is a better interpretation of the intent of the defines.
So to resume :
h2py.py.patch2 : this fixes the bug, maintaining the way the original
h2py script tried to process a char literal.
h2py.py.patch : this fixes the bug, but makes a char literal become a
string literal in python instead of the ordinal value.
Gabriel |
|
Date |
User |
Action |
Args |
2008-06-11 08:26:09 | grossetti | set | spambayes_score: 0.000668456 -> 0.00066845637 recipients:
+ grossetti |
2008-06-11 08:26:08 | grossetti | set | spambayes_score: 0.000668456 -> 0.000668456 messageid: <1213172768.79.0.156029263713.issue3077@psf.upfronthosting.co.za> |
2008-06-11 08:26:06 | grossetti | link | issue3077 messages |
2008-06-11 08:26:04 | grossetti | create | |
|