[ python-Bugs-1653736 ] Problems in datetime.c and typeobject.c.

SourceForge.net noreply at sourceforge.net
Thu Feb 8 10:18:06 CET 2007


Bugs item #1653736, was opened at 2007-02-07 02:15
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1653736&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: ked-tao (ked-tao)
Assigned to: Nobody/Anonymous (nobody)
Summary: Problems in datetime.c and typeobject.c.

Initial Comment:
This is related to [python-Bugs-1648268], but I think these problems might be important enough to consider fixing prior to any patch being produced for that item.

Modules/datetimemodule.c:time_isoformat() is declared in time_methods[] as METH_KEYWORDS. However, I believe it is better declared as METH_NOARGS (calling it with args and kwargs doesn't raise any exception, but it doesn't accept them).

Objects/typeobject.c:4428 - slot_nb_inplace_power is declared with the SLOT1() macro. I'm not sure I entirely grok what's going on here (not enough to supply a python-level failure case), but it seems to me that it should be declared with the SLOT2() macro (it's a ternary op). FWIW, I changed it from:

SLOT1(slot_nb_inplace_power, "__ipow__", PyObject *, "O")

to:

SLOT2(slot_nb_inplace_power, "__ipow__", PyObject *, PyObject *, "OO")

... and that ran the failing tests OK.

Hopefully someone familiar with this code can determine if this is correct or not.

Thanks, Kev.




----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2007-02-08 10:18

Message:
Logged In: YES 
user_id=21627
Originator: NO

Thanks for the report. I have fixed the first bug, in r53671 and r53672.

As for the second bug: I think your suggested change is wrong. __ipow__ is
supposed to take only two arguments. I'm unsure why nb_inplace_power is
defined with three arguments; the third argument is set to Py_None in all
places I could find. So it is, at a minimum,
ok if slot_nb_inplace_power discards its third argument; I wonder whether
the API should be changed to drop this argument entirely. This is for
python-dev to discuss.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1653736&group_id=5470


More information about the Python-bugs-list mailing list