[Patches] [ python-Patches-652930 ] math.log(x [,base])
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 13 Dec 2002 23:37:12 -0800
Patches item #652930, was opened at 2002-12-12 22:26
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=652930&group_id=5470
Category: Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Nobody/Anonymous (nobody)
Summary: math.log(x [,base])
Initial Comment:
Added an optional base argument to math.log().
Inspired by a request to help@python.org.
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2002-12-14 08:37
Message:
Logged In: YES
user_id=21627
I'm sorry for be that picky, but ... This version loses the
num object into garbage if computation of the den object fails.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2002-12-14 06:42
Message:
Logged In: YES
user_id=80475
New patch attached.
* removed re-use of newargs tuple
* used PyTuple_SET_ITEM
* trapped potential error exits
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-12-13 16:36
Message:
Logged In: YES
user_id=21627
This still missing a number of potential error exits: the
Tuple_New can fail (as could have the BuildValue), and the
loghelpers can fail.
On the second SetItem, please add a comment that mutating
the tuple is fine.
Potentially, the Divide can also fail, but that probably won't
matter.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2002-12-13 16:24
Message:
Logged In: YES
user_id=80475
Revised patch attached.
* Now, only one call to ParseTuple
* Used PyTuple_New instead of Py_BuildValue
* Added \versionchanged{} mark-up
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-12-13 11:55
Message:
Logged In: YES
user_id=21627
I think you should avoid the triple calls to ParseTuple, and
the intermediate BuildValue call. AFAICT, the ParseTuple in
loghelper can *only* fail if there is not exactly one argument
(since it won't care about its type); atleast for log, you made
it impossible that the argument count is incorrect. For log10,
making the function a METH_O can do that test.
Building a tuple from an object with BuildValue also seems
overkill, using PyTuple_New is just as simple.
Please use the \versionchanged (or \versionadded) markup to
document that the parameter is new to 2.3.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=652930&group_id=5470