h2py.py bug?

G

Gabriel Rossetti

Hello everyone,

I wanted to use the h2py.py script (Tools/scripts/h2py.py) and it didn't
like char litterals :

Skipping: PC_ERROR = ord()

where my *.h file contained :

#define PC_ERROR '0'

I searched the web and found a post with the same error :

http://mail.python.org/pipermail/python-list/2005-September/340608.html

but it got no replies, I tried the fix and it works. I have the
following questions:

1) Why did it not get any attention, is something wrong with it?
2) If nothing is wrong, did the fix not get applied because a bug report
wasn't filed?
3) Isn't turning a char literal into the ordinal value not contrary to
what a C programmer had in mind when he/she defined it? I mean if you
define a char literal then in python you would have used a string value :

#define PC_ERROR '0'

would become :

PC_ERROR = '0'

in python, and if you intended to use the char type for an 8 bit
numerical value you would have done :

#define PC_ERROR 0x30

where 0x30 is the '0' ascii hex value, so shouldn'it the line in the
diff (see the post) be :

body = p_char.sub("'\\1'", body)

instead of :

body = p_char.sub("ord('\\1')", body)

?

Thank you,
Gabriel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,264
Messages
2,571,320
Members
48,004
Latest member
KelseyFors

Latest Threads

Top