Author vstinner
Recipients christian.heimes, inada.naoki, skrah, vstinner
Date 2016-09-13.12:40:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473770417.91.0.544158912385.issue28120@psf.upfronthosting.co.za>
In-reply-to
Content
I added debug traces to _PyDict_Pop(). It looks like the assertion failed after dictresize() converts a splitted table into a combined table. After the resize, the key '_columns_plus_names' cannot be found anymore, whereas it was found before.

The string thing about the key '_columns_plus_names' is that I cannot see it in the output of repr(dict).

The length of the dictionary is 7, but it looks like it contains 8 items... Something is wrong, no?


Note: I'm not sure that my debug traces are correct, especially the number of entries may be larger. I don't understand yet exactly the internal structure of dictionaries.


@@ delete memoized
{'_auto_correlate': True, 
 '_from_obj': OrderedSet([]), '_raw_columns': [Table('t1', MetaData(bind=None), Column('c1', Integer(), table=<t1>, primary_key=True, nullable=False), Column('c2', String(length=30), table=<t1>), schema=None)],
 '_whereclause': <sqlalchemy.sql.elements.BinaryExpression object at 0x7fffe93d1190>,
 '_having': None,
 'use_labels': False,
 '_bind': None}
_PyDict_Pop(): ix=7, resize!

before resize:
<splitted dict 0x7fffe93cda30 used=7 keys->dk_size=16 keys->dk_nentries=8 keys->dk_usable=2 || usable=10>

index[0]=-1
index[1]=4
index[2]=-1
index[3]=-1
index[4]=0
index[5]=3
index[6]=-1
index[7]=7      <----- it looks like the entry #7 is referenced, no?
index[8]=1
index[9]=2
index[10]=-1
index[11]=-1
index[12]=-1
index[13]=-1
index[14]=5
index[15]=6

entry[0]: key='_auto_correlate', hash=-4930419206435490684
entry[1]: key='_from_obj', hash=-717737569259548376
entry[2]: key='_raw_columns', hash=6382956110151689156
entry[3]: key='_whereclause', hash=-7105285138948878507
entry[4]: key='_having', hash=-8328824464742262616
entry[5]: key='use_labels', hash=8687253172181039710
entry[6]: key='_bind', hash=-5556925267210855474
entry[7]: key='_columns_plus_names', hash=-7771762227888271625
entry[8]: key='NULL', hash=0
entry[9]: key='NULL', hash=0

object  : {'_auto_correlate': True, '_from_obj': OrderedSet([]), '_raw_columns': [Table('t1', MetaData(bind=None), Column('c1', Integer(), table=<t1>, primary_key=True, nullable=False), Column('c2', String(length=30), table=<t1>), schema=None)], '_whereclause': <sqlalchemy.sql.elements.BinaryExpression object at 0x7fffe93d1190>, '_having': None, 'use_labels': False, '_bind': None}
type    : dict

***

after resize:

<combined dict 0x7fffe93cda30 used=7 keys->dk_size=32 keys->dk_nentries=7 keys->dk_usable=14 || usable=21>

index[0]=-1
index[1]=-1
index[2]=-1
index[3]=-1
index[4]=0
index[5]=-1
index[6]=-1
index[7]=-1
index[8]=1
index[9]=-1
index[10]=-1
index[11]=-1
index[12]=-1
index[13]=-1
index[14]=6
index[15]=-1
index[16]=-1
index[17]=4
index[18]=-1
index[19]=-1
index[20]=-1
index[21]=3
index[22]=-1
index[23]=-1
index[24]=-1
index[25]=2
index[26]=-1
index[27]=-1
index[28]=-1
index[29]=-1
index[30]=5
index[31]=-1   <------ no more entry #7 ???

entry[0]: key='_auto_correlate', value=True, hash=-4930419206435490684
entry[1]: key='_from_obj', value=OrderedSet([]), hash=-717737569259548376
entry[2]: key='_raw_columns', value=[Table('t1', MetaData(bind=None), Column('c1', Integer(), table=<t1>, primary_key=True, nullable=False), Column('c2', String(length=30), table=<t1>), schema=None)], hash=6382956110151689156
entry[3]: key='_whereclause', value=<sqlalchemy.sql.elements.BinaryExpression object at 0x7fffe93d1190>, hash=-7105285138948878507
entry[4]: key='_having', value=None, hash=-8328824464742262616
entry[5]: key='use_labels', value=False, hash=8687253172181039710
entry[6]: key='_bind', value=None, hash=-5556925267210855474
entry[7]: key='NULL', value='NULL', hash=0
entry[8]: key='NULL', value='NULL', hash=0
entry[9]: key='NULL', value='NULL', hash=0
entry[10]: key='NULL', value='NULL', hash=0
entry[11]: key='NULL', value='NULL', hash=0
entry[12]: key='NULL', value='NULL', hash=0
entry[13]: key='NULL', value='NULL', hash=0
entry[14]: key='NULL', value='NULL', hash=0
entry[15]: key='NULL', value='NULL', hash=0
entry[16]: key='NULL', value='NULL', hash=0
entry[17]: key='NULL', value='NULL', hash=0
entry[18]: key='NULL', value='NULL', hash=0
entry[19]: key='NULL', value='NULL', hash=0
entry[20]: key='NULL', value='NULL', hash=0

object  : {'_auto_correlate': True, '_from_obj': OrderedSet([]), '_raw_columns': [Table('t1', MetaData(bind=None), Column('c1', Integer(), table=<t1>, primary_key=True, nullable=False), Column('c2', String(length=30), table=<t1>), schema=None)], '_whereclause': <sqlalchemy.sql.elements.BinaryExpression object at 0x7fffe93d1190>, '_having': None, 'use_labels': False, '_bind': None}
type    : dict
refcount: 3


python: Objects/dictobject.c:1810: _PyDict_Pop: Assertion `ix >= 0' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff711f6f5 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install bzip2-libs-1.0.6-20.fc24.x86_64 keyutils-libs-1.5.9-8.fc24.x86_64 krb5-libs-1.14.3-8.fc24.x86_64 libcom_err-1.42.13-4.fc24.x86_64 libselinux-2.5-9.fc24.x86_64 openssl-libs-1.0.2h-3.fc24.x86_64 pcre-8.39-3.fc24.x86_64 sqlite-libs-3.13.0-1.fc24.x86_64 xz-libs-5.2.2-2.fc24.x86_64 zlib-1.2.8-10.fc24.x86_64
(gdb) up
#1  0x00007ffff71212fa in abort () from /lib64/libc.so.6
(gdb) 
#2  0x00007ffff7117f97 in __assert_fail_base () from /lib64/libc.so.6
(gdb) 
#3  0x00007ffff7118042 in __assert_fail () from /lib64/libc.so.6
(gdb) 
#4  0x00000000004bdfd7 in _PyDict_Pop (mp=0x7fffe93cda30, key='_columns_plus_names', deflt=None) at Objects/dictobject.c:1810
1810	        assert(ix >= 0);
(gdb) p key
$1 = '_columns_plus_names'
(gdb) l
1805	        fprintf(stderr, "after resize:\n");
1806	        dict_dump_key_value_table(mp);
1807	        _PyObject_Dump((PyObject *)mp);
1808	
1809	        ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, &hashpos);
1810	        assert(ix >= 0);
1811	    }
1812	
1813	    old_value = *value_addr;
1814	    assert(old_value != NULL);
(gdb) p hash
$2 = -7771762227888271625
(gdb) print value_addr
$3 = (PyObject **) 0x0
(gdb) print value_addr
$4 = (PyObject **) 0x0
(gdb) print hashpos
$5 = 23
History
Date User Action Args
2016-09-13 12:40:17vstinnersetrecipients: + vstinner, christian.heimes, inada.naoki, skrah
2016-09-13 12:40:17vstinnersetmessageid: <1473770417.91.0.544158912385.issue28120@psf.upfronthosting.co.za>
2016-09-13 12:40:17vstinnerlinkissue28120 messages
2016-09-13 12:40:17vstinnercreate