Skip to content

Large integers fail to convert to the JVM #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cnuernber opened this issue May 10, 2021 · 3 comments
Closed

Large integers fail to convert to the JVM #164

cnuernber opened this issue May 10, 2021 · 3 comments

Comments

@cnuernber
Copy link
Collaborator

$ cat foo.py

def bar():
    return 9223372036854775808

after requiring,

user=> (py/cfn foo/bar)

Execution error at libpython-clj2.python.ffi/check-error-throw (ffi.clj:684).

OverflowError: int too big to convert

Not certain the best way to address this but it most likely involves bignums :-).

@cnuernber cnuernber changed the title Python integers fail to convert to the JVM Large integers fail to convert to the JVM May 10, 2021
@cnuernber
Copy link
Collaborator Author

cnuernber commented May 10, 2021

Potential fix in 2.00-beta-18. Asking user to test once release is out and will reopen or open further issues if there are failures.

@matthewdowney
Copy link

Fwiw I have been able to get around this by using pr-str and read-string, since the values are printing fine at the REPL.

E.g. (-> (foo/bar) pr-str read-string).

@cnuernber
Copy link
Collaborator Author

That is definitely worth a lot, thanks for sharing!. Glad you found a work around. A side note is that a numpy array of big values also won't convert and those are definitely also fixable but they will currently fail to convert correctly.

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

No branches or pull requests

2 participants