From e00b64c34def26d244399f136848a573cbd49de4 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 11 Aug 2021 16:18:10 +0100 Subject: [PATCH 1/4] update test__opcode following changes in GH-27701 --- Lib/test/test__opcode.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/test__opcode.py b/Lib/test/test__opcode.py index f6d8c730645c19..8065231e052bb6 100644 --- a/Lib/test/test__opcode.py +++ b/Lib/test/test__opcode.py @@ -82,12 +82,14 @@ def test_specialization_stats(self): self.assertCountEqual(stats.keys(), specialized_opcodes) self.assertCountEqual( stats['load_attr'].keys(), - stat_names + ['fails']) + stat_names + ['specialization_failure_kinds']) for sn in stat_names: self.assertIsInstance(stats['load_attr'][sn], int) self.assertIsInstance(stats['load_attr']['specialization_failure_kinds'], tuple) for v in stats['load_attr']['specialization_failure_kinds']: self.assertIsInstance(v, int) + else: + print('No specialization stats to check') if __name__ == "__main__": From 1ff15389119302bec7ec414304a134569f4ae5d7 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 11 Aug 2021 16:20:18 +0100 Subject: [PATCH 2/4] add STORE_ATTR to _Py_GetSpecializationStats --- Python/specialize.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Python/specialize.c b/Python/specialize.c index d0e45d70c08801..f0d68f027d6464 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -122,6 +122,7 @@ _Py_GetSpecializationStats(void) { err += add_stat_dict(stats, LOAD_ATTR, "load_attr"); err += add_stat_dict(stats, LOAD_GLOBAL, "load_global"); err += add_stat_dict(stats, BINARY_SUBSCR, "binary_subscr"); + err += add_stat_dict(stats, STORE_ATTR, "store_attr"); if (err < 0) { Py_DECREF(stats); return NULL; From 7433456c15a804a4120b56ed4b66a91be06a8301 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 11 Aug 2021 16:24:14 +0100 Subject: [PATCH 3/4] wrap long line --- Lib/test/test__opcode.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/test__opcode.py b/Lib/test/test__opcode.py index 8065231e052bb6..6799619e2afc0d 100644 --- a/Lib/test/test__opcode.py +++ b/Lib/test/test__opcode.py @@ -85,7 +85,9 @@ def test_specialization_stats(self): stat_names + ['specialization_failure_kinds']) for sn in stat_names: 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']: self.assertIsInstance(v, int) else: From 641e12bef4fef2bd25f30d905f4e8748f5fdb8c4 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 11 Aug 2021 17:00:18 +0100 Subject: [PATCH 4/4] remove print --- Lib/test/test__opcode.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Lib/test/test__opcode.py b/Lib/test/test__opcode.py index 6799619e2afc0d..6bbab539903ce6 100644 --- a/Lib/test/test__opcode.py +++ b/Lib/test/test__opcode.py @@ -90,8 +90,6 @@ def test_specialization_stats(self): tuple) for v in stats['load_attr']['specialization_failure_kinds']: self.assertIsInstance(v, int) - else: - print('No specialization stats to check') if __name__ == "__main__":