Patches item #1446922, was opened at 2006-03-10 02:33 Message generated for change (Settings changed) made by nascheme 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: Closed >Resolution: Rejected Priority: 5 Submitted By: Grant Olson (logistix) >Assigned to: Neil Schemenauer (nascheme) 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. ---------------------------------------------------------------------- >Comment By: Neil Schemenauer (nascheme) Date: 2006-07-09 21:20 Message: Logged In: YES user_id=35752 Fixed in SVN rev 50495. I did the folding in the CST->AST phase, similar to how it was done in the old compiler. ---------------------------------------------------------------------- Comment By: Neal Norwitz (nnorwitz) Date: 2006-03-20 07:39 Message: Logged In: YES user_id=33168 Thanks! Unfortunately, this patch leaves the long in co_consts: >>> def foo(): ... x = -9223372036854775808 ... >>> foo.func_code.co_consts (None, 9223372036854775808L, -9223372036854775808) This is a 64-bit system. On 2.4, there is only sys.minint: Python 2.4.2 (#1, Oct 30 2005, 21:35:48) >>> def foo(): ... x = -9223372036854775808 ... >>> foo.func_code.co_consts (None, -9223372036854775808) Can you revise the patch to fix this? I cleaned up some things. Attached is an updated version I was using. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1446922&group_id=5470 _______________________________________________ Patches mailing list [email protected] http://mail.python.org/mailman/listinfo/patches
