Title: An assertion failure in test_pickle
Type: crash Stage: patch review
Components: Extension Modules Versions: Python 3.9, Python 3.8, Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, pconnell, serhiy.storchaka, taleinat
Priority: normal Keywords: patch

Created on 2019-10-06 13:39 by ZackerySpytz, last changed 2019-11-22 23:14 by taleinat.

Pull Requests
URL Status Linked Edit
PR 16606 open ZackerySpytz, 2019-10-06 13:41
Messages (3)
msg354038 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2019-10-06 13:39
When running test_pickle, I sometimes see an assertion failure.

./python -m test test_pickle
0:00:00 load avg: 1.04 Run tests sequentially
0:00:00 load avg: 1.04 [1/1] test_pickle
python: Objects/typeobject.c:3151: _PyType_Lookup: Assertion `!PyErr_Occurred()' failed.
Fatal Python error: Aborted

Current thread 0x00007f8158632140 (most recent call first):
  File "/home/lubuntu2/cpython/Lib/test/", line 3400 in test_unpickling_buffering_readline
  File "/home/lubuntu2/cpython/Lib/unittest/", line 617 in _callTestMethod
  File "/home/lubuntu2/cpython/Lib/unittest/", line 663 in run
  File "/home/lubuntu2/cpython/Lib/unittest/", line 725 in __call__
  File "/home/lubuntu2/cpython/Lib/unittest/", line 122 in run
  File "/home/lubuntu2/cpython/Lib/unittest/", line 84 in __call__
  File "/home/lubuntu2/cpython/Lib/unittest/", line 122 in run
  File "/home/lubuntu2/cpython/Lib/unittest/", line 84 in __call__
  File "/home/lubuntu2/cpython/Lib/test/support/", line 162 in run
  File "/home/lubuntu2/cpython/Lib/test/support/", line 2032 in _run_suite
  File "/home/lubuntu2/cpython/Lib/test/support/", line 2128 in run_unittest
  File "/home/lubuntu2/cpython/Lib/test/", line 525 in test_main
  File "/home/lubuntu2/cpython/Lib/test/libregrtest/", line 234 in _runtest_inner2
  File "/home/lubuntu2/cpython/Lib/test/libregrtest/", line 270 in _runtest_inner
  File "/home/lubuntu2/cpython/Lib/test/libregrtest/", line 153 in _runtest
  File "/home/lubuntu2/cpython/Lib/test/libregrtest/", line 193 in runtest
  File "/home/lubuntu2/cpython/Lib/test/libregrtest/", line 417 in run_tests_sequential
  File "/home/lubuntu2/cpython/Lib/test/libregrtest/", line 515 in run_tests
  File "/home/lubuntu2/cpython/Lib/test/libregrtest/", line 687 in _main
  File "/home/lubuntu2/cpython/Lib/test/libregrtest/", line 634 in main
  File "/home/lubuntu2/cpython/Lib/test/libregrtest/", line 712 in main
  File "/home/lubuntu2/cpython/Lib/test/", line 2 in <module>
  File "/home/lubuntu2/cpython/Lib/", line 85 in _run_code
  File "/home/lubuntu2/cpython/Lib/", line 192 in _run_module_as_main
Aborted (core dumped)

In _Unpickler_SetInputStream(), _PyObject_LookupAttrId() is called three times in a row without any error handling.
If an exception occurs during the first or second call, _PyObject_LookupAttrId() will be called with a live exception.
msg354040 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-10-06 16:34
I do not understand how you got an assertion failure. Did you interrupt tests with Ctrl-C?
msg357337 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2019-11-22 23:13
Good catch on this, Zackery!

For anyone readying this, Serhiy posted a minimal reproducer in a PR comment, and the PR now adds a test for this.
Date User Action Args
2019-11-22 23:14:05taleinatsetmessages: - msg357336
2019-11-22 23:13:54taleinatsetmessages: + msg357337
2019-11-22 23:13:39taleinatsetnosy: + taleinat
messages: + msg357336
2019-10-28 20:47:42pconnellsetnosy: + pconnell
2019-10-06 16:34:54serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg354040
2019-10-06 13:41:58ZackerySpytzsetkeywords: + patch
stage: patch review
pull_requests: + pull_request16194
2019-10-06 13:39:09ZackerySpytzcreate