Skip to content

Commit b07a53b

Browse files
authored
Merge pull request #1 from jepler/warn-bitlength
Improve the diagnostic when the user's circuitpython is too old
2 parents 449cae5 + c2052c1 commit b07a53b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This library depends on:
2727
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
2828

2929
Note that some CircuitPython core changes were needed to support udecimal.
30-
These will be in upcoming release 6.0.0.alpha-4.
30+
Please use CircuitPython 6.0.0-rc.1 or newer with udecimal.
3131

3232
The library also runs on desktop Python3, and should give numerically identical
3333
results across all platorms.

jepler_udecimal/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@
160160

161161
if sys.implementation.name == "circuitpython":
162162

163+
if not hasattr(int, "bit_length"):
164+
raise ImportError(
165+
"jepler_udecimal requires int.bit_length. Use CircuitPython 6.0.0-rc.1 or newer."
166+
)
167+
163168
def _as_integer_ratio(f):
164169
m, e = _math.frexp(f)
165170
m = round(m * (1 << 53))

0 commit comments

Comments
 (0)