[Patches] [ python-Patches-1446922 ] Patch for bug 1441486: bad unary minus folding in compiler

SourceForge.net noreply at sourceforge.net
Fri Mar 10 03:33:08 CET 2006


Patches item #1446922, was opened at 2006-03-09 20:33
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1446922&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
Submitted By: Grant Olson (logistix)
Assigned to: Nobody/Anonymous (nobody)
Summary: Patch for bug 1441486: bad unary minus folding in compiler

Initial Comment:
In the old compiler, there was a optimization in
com_factor that folded a unary minus against a constant.

In the new AST, it looks like numbers are converted
from strings into PyObjects earlier in the pipeline. 
The compiler does fold a unary minus against a
constant, but since the PyObject has already been
created, it may return a PyLong when a PyInt is
sufficient.  This patch adds a check that will convert
a PyLong object back into a PyInt if possible.

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

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


More information about the Patches mailing list