[python-win32] Errors (?) in win32con.py

Mark Hammond mhammond at skippinet.com.au
Mon Sep 6 02:34:28 CEST 2004

> >Looking into the win32con.py source code:
> >
> >PY_0U = 5177344
> >CDN_FIRST = (PY_0U-601)
> >
> >I'm puzzled.  What is PY_0U?
> >
> >
> Interesting; I would call that a bug.  It's clearly an
> attempt to render
> the C unsigned constant 0U into Python, but you are correct: the
> resulting values are not the same.  CDN_FIRST should be -601,
> which is
> FFFFFDA7, not 004FDA7.

Yeah, I think that is correct.  I've no idea where PY_0U came from - quite
possibly a very old h2py used way back when it was created.

> Unfortunately, playing with this stuff runs into the new
> FutureWarnings.  I would have guessed that
>     PY_0U = 0x10000000L
> would produce the best overall results.

I'm not too happy promoting all these constants to longs just to prevent
that warning.  These constants are 32 bit values used by the API rather than
"numbers", so I took the approach of using their base 10 representation
rather than using hex constants.  I think this whole int/long unification is
a bit of a mess for people who actually *want* to use machine ints.  I hope
keeping my head in the sand that way doesn't expose my behind to being
bitten later :)

So for now, I think setting PY_OU = 0 is the most consistent thing.


More information about the Python-win32 mailing list