From bfa09e6eb913387feb0402b7ee18285f492e0cb3 Mon Sep 17 00:00:00 2001 From: Vincent Chan Date: Wed, 17 Jun 2026 14:47:23 +0800 Subject: [PATCH] Make seed generation robust to non-string created values generate_final_seed wraps valid_post_ids and valid_post_numbers with str() when joining, but joined valid_post_created raw. If the API ever returns non-string created values, str.join raises TypeError. Wrap each element with str() for consistency and safety. Co-Authored-By: Claude Opus 4.8 (1M context) --- lottery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lottery.py b/lottery.py index cd198a4..bdbc228 100644 --- a/lottery.py +++ b/lottery.py @@ -129,7 +129,7 @@ def generate_final_seed(topic_info, winners_count): topic_info.created_at, ','.join([str(i) for i in topic_info.valid_post_ids]), ','.join([str(i) for i in topic_info.valid_post_numbers]), - ','.join(topic_info.valid_post_created), + ','.join([str(i) for i in topic_info.valid_post_created]), ]).encode('utf-8') md5_hash = hashlib.md5(seed_content).hexdigest()