go-python / gpython

gpython is a python interpreter written in go "batteries not included"
BSD 3-Clause "New" or "Revised" License
870 stars 95 forks source link

py: int() default to decimal #221

Closed wetor closed 1 year ago

wetor commented 1 year ago

https://docs.python.org/3.4/library/functions.html#int

int(x, base=10)

If base=0, an exception will be thrown when executing int("07")

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (652daef) 74.42% compared to head (9ecc919) 74.42%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #221 +/- ## ======================================= Coverage 74.42% 74.42% ======================================= Files 76 76 Lines 12675 12675 ======================================= Hits 9433 9433 Misses 2567 2567 Partials 675 675 ``` | [Impacted Files](https://codecov.io/gh/go-python/gpython/pull/221?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-python) | Coverage Δ | | |---|---|---| | [py/int.go](https://codecov.io/gh/go-python/gpython/pull/221?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-python#diff-cHkvaW50Lmdv) | `77.81% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-python). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-python)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

ncw commented 1 year ago

Does this change break this (which is correct)?

$ gpython
[snip]
>>> 
>>> 07
Compile error: 
  File "<string>", line 1, offset 0
    07

SyntaxError: 'illegal decimal with leading zero'
>>> 
wetor commented 1 year ago

I tried it and it didn't affect here, because this PR fixes ValueError: "invalid literal for int() with base 10: '07'" at "sigils" error.