Skip to content

localtime: don't hard-fault on type errors; handle localtime(float)#2070

Merged
dhalbert merged 2 commits into
adafruit:masterfrom
jepler:localtime-hardfault
Aug 18, 2019
Merged

localtime: don't hard-fault on type errors; handle localtime(float)#2070
dhalbert merged 2 commits into
adafruit:masterfrom
jepler:localtime-hardfault

Conversation

@jepler
Copy link
Copy Markdown

@jepler jepler commented Aug 18, 2019

It turns out mp_obj_int_get_checked is not appropriate to call when
the argument is not of int or long type--the "checked" refers to guarding
against overflow/underflow, not type checking.

For compatibility with CPython, handle float arguments.

Closes: #2069

Testing performed: time.localtime(time.time()), time.localtime(), time(1.0*time.time())

…(float)

It turns out `mp_obj_int_get_checked` is not appropriate to call when
the argument is not of int or long type--the "checked" refers to guarding
against overflow/underflow, not type checking.

For compatibility with CPython, handle float arguments.

Closes: adafruit#2069
Comment thread shared-bindings/time/__init__.c
Copy link
Copy Markdown
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dhalbert dhalbert merged commit 1dbb559 into adafruit:master Aug 18, 2019
@jepler jepler deleted the localtime-hardfault branch November 3, 2021 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash into the HardFault_Handler

2 participants