This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Problems in datetime.c and typeobject.c.
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ked-tao, loewis
Priority: normal Keywords:

Created on 2007-02-07 01:15 by ked-tao, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg31198 - (view) Author: ked-tao (ked-tao) Date: 2007-02-07 01:15
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.


msg31199 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-02-08 09:18
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.
msg31200 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-02-09 12:20
The second bug should now be fixed in r53689 and r53690.
msg31201 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-02-18 08:51
I had to revert r53672. New fix is r53816.
History
Date User Action Args
2022-04-11 14:56:22adminsetgithub: 44552
2007-02-07 01:15:19ked-taocreate