Update test__opcode and _Py_GetSpecializationStats with recent specialization stat changes (GH-27728)

This commit is contained in:
Irit Katriel 2021-08-11 17:34:01 +01:00 committed by GitHub
parent 08caf2d5d4
commit 64a7812c17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -82,10 +82,12 @@ class SpecializationStatsTests(unittest.TestCase):
self.assertCountEqual(stats.keys(), specialized_opcodes) self.assertCountEqual(stats.keys(), specialized_opcodes)
self.assertCountEqual( self.assertCountEqual(
stats['load_attr'].keys(), stats['load_attr'].keys(),
stat_names + ['fails']) stat_names + ['specialization_failure_kinds'])
for sn in stat_names: for sn in stat_names:
self.assertIsInstance(stats['load_attr'][sn], int) self.assertIsInstance(stats['load_attr'][sn], int)
self.assertIsInstance(stats['load_attr']['specialization_failure_kinds'], tuple) self.assertIsInstance(
stats['load_attr']['specialization_failure_kinds'],
tuple)
for v in stats['load_attr']['specialization_failure_kinds']: for v in stats['load_attr']['specialization_failure_kinds']:
self.assertIsInstance(v, int) self.assertIsInstance(v, int)

View file

@ -122,6 +122,7 @@ _Py_GetSpecializationStats(void) {
err += add_stat_dict(stats, LOAD_ATTR, "load_attr"); err += add_stat_dict(stats, LOAD_ATTR, "load_attr");
err += add_stat_dict(stats, LOAD_GLOBAL, "load_global"); err += add_stat_dict(stats, LOAD_GLOBAL, "load_global");
err += add_stat_dict(stats, BINARY_SUBSCR, "binary_subscr"); err += add_stat_dict(stats, BINARY_SUBSCR, "binary_subscr");
err += add_stat_dict(stats, STORE_ATTR, "store_attr");
if (err < 0) { if (err < 0) {
Py_DECREF(stats); Py_DECREF(stats);
return NULL; return NULL;