[Python-checkins] r66896 - python/branches/tlee-ast-optimize/Python/compile.c
thomas.lee
python-checkins at python.org
Wed Oct 15 04:55:08 CEST 2008
Author: thomas.lee
Date: Wed Oct 15 04:55:07 2008
New Revision: 66896
Log:
Ensure compiler_add_o generates the correct key for tuple objects, which may have been passed in on the back of a Const AST node.
Modified:
python/branches/tlee-ast-optimize/Python/compile.c
Modified: python/branches/tlee-ast-optimize/Python/compile.c
==============================================================================
--- python/branches/tlee-ast-optimize/Python/compile.c (original)
+++ python/branches/tlee-ast-optimize/Python/compile.c Wed Oct 15 04:55:07 2008
@@ -1015,10 +1015,19 @@
else {
t = PyTuple_Pack(2, o, o->ob_type);
}
- }
+ }
+ /* necessary for tuples of constants as produced by the AST optimizer */
+ /* e.g. (1, 0) and (1L, 0L) will otherwise be considered equal. */
+ else if (PyTuple_Check(o)) {
+ v = PyObject_Repr(o);
+ if (v == NULL)
+ return -1;
+ t = PyTuple_Pack(3, o, o->ob_type, v);
+ Py_DECREF(v);
+ }
else {
t = PyTuple_Pack(2, o, o->ob_type);
- }
+ }
if (t == NULL)
return -1;
More information about the Python-checkins
mailing list