[issue4910] Remove uses of nb_long slot, and rename to nb_reserved.

Benjamin Peterson report at bugs.python.org
Thu Jan 15 18:57:00 CET 2009


Benjamin Peterson <benjamin at python.org> added the comment:

On Thu, Jan 15, 2009 at 10:48 AM, Mark Dickinson <report at bugs.python.org> wrote:
>
> Mark Dickinson <dickinsm at gmail.com> added the comment:
>
> Thanks, Benjamin!  Checked in in r68553, backported to 3.0 in r68556.
>
> Here's the second patch, which fixes almost all remaining uses of nb_long
> but stops short of actually removing/renaming the nb_long slot.
>
> Notes:
>
> (1) I haven't tested the change to PC/winreg.c

This looks correct. In fact, I don't really see the point of having
PyHKEY_unaryFailureFunc since a TypeError will automatically be raised
if the slot is NULL, but that is certainly another issue.

>
> (2) The Modules/_struct.c change does introduce a change in behaviour:
> for example, before the patch,
>
> struct.pack('q', decimal.Decimal(1))
>
> raises struct.error.  After the patch, the packing succeeds.  I *think*
> the patched behaviour is probably the right behaviour, since it agrees
> with 2.x, but it's not 100% clear to me what the intentions of the struct
> module are with respect to integer packing of non-integer types.  This is
> probably a question for another issue.

Since Decimal implements __int__ and that's what the struct module is
converting with, I think this is fine.

Overall, the patch looks fine. I wonder if we should mark
PyNumber_Long as deprecated in the docs, though.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4910>
_______________________________________


More information about the Python-bugs-list mailing list