From 867e9a9c0cdabf7aa6e5795936491ed14b13b18b Mon Sep 17 00:00:00 2001 From: Jakob Scheid Date: Thu, 2 Apr 2026 12:48:18 +0200 Subject: [PATCH] Bug fix: jeb_utils.utils.is_number could return True even if the base is 0 which is mathematically incorrect. --- README.md | 7 +++++-- pyproject.toml | 2 +- src/jeb_utils/utils.py | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1a995ec..8744dfa 100644 --- a/README.md +++ b/README.md @@ -77,11 +77,14 @@ pip install jeb-utils --index-url https://repo.jcloud-services.ddns.net/simple/ - `create_file_if_not_exists`: Creates a file if it does not exist. ## Changelog +### Version 0.2.2 +- Bug fix: jeb_utils.utils.is_number could return `True` even if the base is `0` which is mathematically incorrect. + ### Version 0.2.1 -- Added feature for validating addresses. +- Add feature for validating addresses. ### Version 0.2.0 -- Removed all the functions and classes that are now in jeb-server-utils. +- Remove all the functions and classes that are now in jeb-server-utils. ### Version 0.1.4 - Bug fix: Due to a refactoring, `jeb_utils.jebp_utils.unpack_fields` did not work. diff --git a/pyproject.toml b/pyproject.toml index c70e41f..cb0be83 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "jeb-utils" -version = "0.2.1" +version = "0.2.2" description = "Common utils for JEB client and server." dependencies = ["cryptography"] license = "Apache-2.0" \ No newline at end of file diff --git a/src/jeb_utils/utils.py b/src/jeb_utils/utils.py index b43f1f9..2a2cdd0 100644 --- a/src/jeb_utils/utils.py +++ b/src/jeb_utils/utils.py @@ -38,6 +38,8 @@ def is_number(string: str, base: int = 10) -> bool: :return: ``True`` if the string is a number, otherwise ``False`` :rtype: bool ''' + if base == 0: + return False if not string: return False try: