[python-committers] Fwd: [Python-checkins] cpython (merge 2.7 -> 2.7): hg pull/merge - Changes to accomodate.

Senthil Kumaran orsenthil at gmail.com
Wed Apr 6 09:07:22 CEST 2011


The below changes were from Alexander Belopolsky. When I tried to push
my changes, my changes resulted in multiple heads in 2.7, so I had to
go back 2.7 branch, merge 2.7 and then commit and push. This resulted
in both my changes as well as merged changes being pushed. I
understand that the second part should not happen, like merging an
already available change and then pushing it again.

I have a script which kind of traverses all the local directories of
branches and does a hg pull; hg update before I start making changes
and I thought that was enough. How could the push would resulted in
two heads here and why I did have merge ? ( I am unable to traceback
the steps) and if there is anything I should know, or change in the
workflow when doing changes to 2.7, please let me know.

Thanks,
Senthil



---------- Forwarded message ----------
From: senthil.kumaran <python-checkins at python.org>
Date: Wed, Apr 6, 2011 at 2:45 PM
Subject: [Python-checkins] cpython (merge 2.7 -> 2.7): hg pull/merge -
Changes to accomodate.
To: python-checkins at python.org


http://hg.python.org/cpython/rev/da212fa62fea
changeset:   69170:da212fa62fea
branch:      2.7
parent:      69169:1320f29bcf98
parent:      69165:202a9feb1fd6
user:        Senthil Kumaran <orsenthil at gmail.com>
date:        Wed Apr 06 14:41:42 2011 +0800
summary:
 hg pull/merge - Changes to accomodate.

files:
 Lib/test/test_datetime.py |   7 +++++++
 Modules/datetimemodule.c  |  15 ++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)


diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -231,6 +231,13 @@
        eq(a//10, td(0, 7*24*360))
        eq(a//3600000, td(0, 0, 7*24*1000))

+        # Issue #11576
+        eq(td(999999999, 86399, 999999) - td(999999999, 86399, 999998),
+           td(0, 0, 1))
+        eq(td(999999999, 1, 1) - td(999999999, 1, 0),
+           td(0, 0, 1))
+
+
    def test_disallowed_computations(self):
        a = timedelta(42)

diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -1737,13 +1737,14 @@

    if (PyDelta_Check(left) && PyDelta_Check(right)) {
        /* delta - delta */
-        PyObject *minus_right = PyNumber_Negative(right);
-        if (minus_right) {
-            result = delta_add(left, minus_right);
-            Py_DECREF(minus_right);
-        }
-        else
-            result = NULL;
+        /* The C-level additions can't overflow because of the
+         * invariant bounds.
+         */
+        int days = GET_TD_DAYS(left) - GET_TD_DAYS(right);
+        int seconds = GET_TD_SECONDS(left) - GET_TD_SECONDS(right);
+        int microseconds = GET_TD_MICROSECONDS(left) -
+                           GET_TD_MICROSECONDS(right);
+        result = new_delta(days, seconds, microseconds, 1);
    }

    if (result == Py_NotImplemented)

--
Repository URL: http://hg.python.org/cpython

_______________________________________________
Python-checkins mailing list
Python-checkins at python.org
http://mail.python.org/mailman/listinfo/python-checkins




-- 
Senthil


More information about the python-committers mailing list