[Python-3000] Int and Long unification (was Re: Help replacing Py_FindMethod)

Benjamin Peterson musiccomposition at gmail.com
Sat Jul 19 15:39:24 CEST 2008


On Sat, Jul 19, 2008 at 12:39 AM, Jesus Cea <jcea at jcea.es> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jesus Cea wrote:
> | Good night everybody!.
> |
> | Working on the Python3.0 support for bsddb I see that "Py_FindMethod"
> | was just removed in Python last beta.
>
> Nevermind. I just reviewed the recent changes in the SVN and I can see
> your patches for bsddb. Changes "ported" to my tree :-).
>
> Now I see another issue: I just changed "PyInt_*" in my code to
> "PyLong_*" (since PyInt_* functions don't exist in Python 3.0). But
> since an integer fails "PyLong_Check()" in Python 2.*, how can I check
> for integers portably between Python 2.[3-6] and Python 3.0?. I would
> like to avoid conditional compilation, if possible.

I think PyNumber_Check should do the trick.
>
> I'm thinking about defining macros "NUMBER_*" to be defined as "PyInt_*"
> in Python 2.* and "PyLong_*" in Python 3.0, but I guess must exist a
> better approach. Ideas?.
>
> Thanks for your time and attention.
>
> - --
> Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
> jcea at jcea.es - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
> jabber / xmpp:jcea at jabber.org         _/_/    _/_/          _/_/_/_/_/
> .                              _/_/  _/_/    _/_/          _/_/  _/_/
> "Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
> "My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
> "El amor es poner tu felicidad en la felicidad de otro" - Leibniz
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.8 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iQCVAwUBSIF+CZlgi5GaxT1NAQLAxQP/ahlDSx2MsHMvcTnVbhBom4ulT0XdIIKu
> kGNPi1il0orF6udom3Y3eGxbdVqwetvGRMrkn56US7wWFUIkNllFbdvk+ILc9neP
> HudrLl2QNt+TIaEU/e0KztfJEU4ilaxZ20T0VVFaJsUALEZ1ovxMWKkwzo/CVHfN
> EZ5ljqBQ0hY=
> =8TJz
> -----END PGP SIGNATURE-----
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe:
> http://mail.python.org/mailman/options/python-3000/musiccomposition%40gmail.com
>



-- 
Cheers,
Benjamin Peterson
"There's no place like 127.0.0.1."


More information about the Python-3000 mailing list