From cf4561142bbdddd2a0acf48726d85e0f0bed14d0 Mon Sep 17 00:00:00 2001 From: hparekh Date: Mon, 26 Oct 2015 14:19:22 +0530 Subject: [PATCH] Division result is wrapped to int(). In py27 sys.getsizeof(str(long_string)) / 1024 returns int value but in py34 it returns float value. Due to this "if size_kb > size_limit_kb:" condition is getting true and in py34 UT "Size of 'input' is 0KB which exceeds the limit of 0KB" error is occurred. Partially-Implements: blueprint mistral-py3 Change-Id: I0c7a4bc316fcc67084d81f59cb1f6f3f9d1a8eef --- mistral/db/v2/sqlalchemy/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mistral/db/v2/sqlalchemy/models.py b/mistral/db/v2/sqlalchemy/models.py index 500c28e6d..4dc2edd58 100644 --- a/mistral/db/v2/sqlalchemy/models.py +++ b/mistral/db/v2/sqlalchemy/models.py @@ -184,7 +184,7 @@ def validate_long_type_length(cls, field_name, value): if (size_limit_kb < 0): return - size_kb = sys.getsizeof(str(value)) / 1024 + size_kb = int(sys.getsizeof(str(value)) / 1024) if size_kb > size_limit_kb: LOG.error(