Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-35021: Fixes assertion failures in _datetimemodule.c #10039

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Oct 22, 2018

Fixes assertion failures in _datetimemodule.c
introduced in the previous fix (bpo-31752).

Rather of trying to handle an int subclass as exact int,
let it to use overridden special methods, but check the
result of divmod().

https://bugs.python.org/issue35021

Fixes assertion failures in _datetimemodule.c
introduced in the previous fix.

Rather of trying to handle an int subclass as exact int,
let it to use overridden special methods, but check the
result of divmod().
@@ -2309,13 +2315,11 @@ accum(const char* tag, PyObject *sofar, PyObject *num, PyObject *factor,
assert(num != NULL);

if (PyLong_Check(num)) {
prod = PyNumber_Multiply(factor, num);
prod = PyNumber_Multiply(num, factor);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as the other PR: add a comment on the PyNumber_Multiply calls describing why the order might matter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order doesn't matter now. I just restore the order prior to bpo-31752 changes.

@Yhg1s
Copy link
Member

Yhg1s commented Oct 23, 2018

This looks good to me, and seems like the most sensible approach.

@serhiy-storchaka
Copy link
Member Author

Although #10040 is closer to the Python implementation.

@vstinner vstinner changed the title bpo-35021: Alternate solution of bpo-31752. bpo-35021: Fixes assertion failures in _datetimemodule.c Oct 24, 2018
@serhiy-storchaka serhiy-storchaka merged commit 3ec0f49 into python:master Nov 20, 2018
@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6, 3.7.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the timedelta-int-subclass2 branch November 20, 2018 18:41
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 20, 2018
Fixes assertion failures in _datetimemodule.c
introduced in the previous fix (see bpo-31752).

Rather of trying to handle an int subclass as exact int,
let it to use overridden special methods, but check the
result of divmod().
(cherry picked from commit 3ec0f49)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-bot
Copy link

GH-10614 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 20, 2018
Fixes assertion failures in _datetimemodule.c
introduced in the previous fix (see bpo-31752).

Rather of trying to handle an int subclass as exact int,
let it to use overridden special methods, but check the
result of divmod().
(cherry picked from commit 3ec0f49)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-bot
Copy link

GH-10615 is a backport of this pull request to the 3.6 branch.

@miss-islington
Copy link
Contributor

Sorry, @serhiy-storchaka, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 3ec0f495163da3b7a15deb2805cec48aed432f58 2.7

miss-islington added a commit that referenced this pull request Nov 20, 2018
Fixes assertion failures in _datetimemodule.c
introduced in the previous fix (see bpo-31752).

Rather of trying to handle an int subclass as exact int,
let it to use overridden special methods, but check the
result of divmod().
(cherry picked from commit 3ec0f49)

Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington added a commit that referenced this pull request Nov 20, 2018
Fixes assertion failures in _datetimemodule.c
introduced in the previous fix (see bpo-31752).

Rather of trying to handle an int subclass as exact int,
let it to use overridden special methods, but check the
result of divmod().
(cherry picked from commit 3ec0f49)

Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Nov 20, 2018
…GH-10039)

Fixes assertion failures in _datetimemodule.c
introduced in the previous fix (see bpo-31752).

Rather of trying to handle an int subclass as exact int,
let it to use overridden special methods, but check the
result of divmod()..
(cherry picked from commit 3ec0f49)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-bot
Copy link

GH-10617 is a backport of this pull request to the 2.7 branch.

@serhiy-storchaka serhiy-storchaka removed their assignment Nov 20, 2018
serhiy-storchaka added a commit that referenced this pull request Nov 20, 2018
…) (GH-10617)

Fixes assertion failures in _datetimemodule.c
introduced in the previous fix (see bpo-31752).

Rather of trying to handle an int subclass as exact int,
let it to use overridden special methods, but check the
result of divmod().
(cherry picked from commit 3ec0f49)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Ubuntu Shared 2.7 has failed when building commit 40fdf47.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/139/builds/149) and take a look at the build logs.
  4. Check if the failure is related to this commit (40fdf47) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/139/builds/149

Click to see traceback logs
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/bsddb/test/test_thread.py", line 292, in readerThread
    rec = dbutils.DeadlockWrap(c.next, max_retries=10)
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/bsddb/dbutils.py", line 68, in DeadlockWrap
    return function(*_args, **_kwargs)
DBLockDeadlockError: (-30993, 'BDB0068 DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock')
Exception in thread reader 0:
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/bsddb/test/test_thread.py", line 292, in readerThread
    rec = dbutils.DeadlockWrap(c.next, max_retries=10)
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/bsddb/dbutils.py", line 68, in DeadlockWrap
    return function(*_args, **_kwargs)
DBLockDeadlockError: (-30993, 'BDB0068 DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock')


Traceback (most recent call last):
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/test/test_imaplib.py", line 214, in test_anonlogin
    rs = self.server.login(self.username, self.password)
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/imaplib.py", line 521, in login
    typ, dat = self._simple_command('LOGIN', user, self._quote(password))
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/imaplib.py", line 1091, in _simple_command
    return self._command_complete(name, self._command(name, *args))
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/imaplib.py", line 913, in _command_complete
    typ, data = self._get_tagged_response(tag)
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/imaplib.py", line 1020, in _get_tagged_response
    self._get_response()
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/imaplib.py", line 932, in _get_response
    resp = self._get_line()
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/imaplib.py", line 1030, in _get_line
    line = self.readline()
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/imaplib.py", line 251, in readline
    line = self.file.readline(_MAXLINE + 1)
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/socket.py", line 480, in readline
    data = self._sock.recv(self._rbufsize)
timeout: timed out

----------------------------------------------------------------------
Ran 13 tests in 91.235s

FAILED (errors=1, skipped=1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants