[Patches] [ python-Patches-483059 ] Avoid use of eval() in random.py

noreply@sourceforge.net noreply@sourceforge.net
Sun, 25 Nov 2001 13:13:22 -0800


Patches item #483059, was opened at 2001-11-18 05:39
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=483059&group_id=5470

Category: Library (Lib)
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Finn Bock (bckfnn)
>Assigned to: Tim Peters (tim_one)
Summary: Avoid use of eval() in random.py

Initial Comment:
Calling eval() in the main code of random.py makes the 
module unnecessary slow on jython and prevent the 
module from being used in applets. This patch avoids 
the eval() call by passing the computed value as an 
argument to _verify().

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

>Comment By: Tim Peters (tim_one)
Date: 2001-11-25 13:13

Message:
Logged In: YES 
user_id=31435

Accepted and closed.  It's hard to buy the speed argument, 
since these are one-shot module initialization costs.  But 
the use of "eval" here was pointless, obscure, and mildly 
disgusting.

python/Lib/random.py; new revision: 1.26

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

Comment By: Finn Bock (bckfnn)
Date: 2001-11-24 05:33

Message:
Logged In: YES 
user_id=4201

Post 2.2 is fine. We have already added the patch to jython 
version of random.py, the patch to CPython is mainly to 
ensure that the two versions doesn't drift apart.

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

Comment By: Martin v. Löwis (loewis)
Date: 2001-11-24 01:47

Message:
Logged In: YES 
user_id=21627

Can you please indicate whether you want to see this patch
in 2.2? I would propose to postpone the patch past 2.2.

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

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=483059&group_id=5470