-
Notifications
You must be signed in to change notification settings - Fork 330
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
Error on Win10 if wrapping py function with default int value that overflows with int32 #1487
Comments
Here is is as code:
And python version
|
So after digging some more digging with reproduciable examples, I found its the Sqltype python script (and function) in tableau hyper api that is triggering the crash not the connection script. I share more in the morning. |
Hi, thanks for reporting. Would you be able to provide instructions I can follow to reproduce the error locally?
Where is this output from? Do you have something in
Can you please install the development version of reticulate, just to rule out that the issue hasn't already been fixed? pak::pak("rstudio/reticulate") |
@t-kalinowski Sorry for the delay. So the error is this...
Directions to Reproduce
python file:
Now your ready to run the examples and tests. |
Now for convenience I will document all the tests below showing how the python file changes between the tests. Reproducible TestsTest 1: Does the reticulate installation work?Comment out the failing python code (as shown below). This way you can test that you have installed python and Tableau hyper api (or any python code) correctly.
Test 2 Reproduce the errorHave no code commented out and just verbatim copy/paste the code at the very top of this thread:
Test 3 Test if the Error from Test 2 is fatalSo an error in my opinion becomes a fatal error for an application (R/Rstudio) in one of 3 ways--1) Crashes OS; 2) Crashes or freezes the application; 3) Persists even when the line of code that caused the error was not run. This means that every line of code now triggers the error. Comment out everything except the "hello" line and run the script below again:
|
Now what is was odd is that that only source() errors out. For example, running the following code for test 5 produces no errors: Test 5 trying to see if other reticulate functions have the same error
|
Thank you for the detailed investigation! It was very helpful. I can reproduce the error without Tableau, on Windows, but not on macOS. The error occurs if one of the default arguments of a python function is an integer greater than a 32 bit int can represent. sprintf("lambda x = %s + 2: x", .Machine$integer.max) |>
py_eval() |>
formals() |> _$x On macOS I see a silent overflow of |
An even smaller MRE: > py_eval(paste(.Machine$integer.max, "+ 19"))
Error in py_eval_impl(code, convert) :
OverflowError: Python int too large to convert to C long
Run `reticulate::py_last_error()` for details. |
@fultoncoe Until this is fixed, you can wrap the
|
Keeping the top part so I don't forget.... I will post utils::sessionInfo() and reticulate::py_config() in the next post.
By crash I mean that once the error is "triggered" any input or python code after the error produces the same error. To fix the issue I have to completely restart R, use
rm()
to remove any persistant local variables then usegc()
to free back the memory in unallocated state. This seems to be an issue with the reticulate version 1.31 and later as back in 08/2022 did not have this bug.The bug is that the syntax user expects to use is for python not R. So warnings and Error should be thrown for things that are not compatible between the two languages. Errors should also not themselves crash the application. There should be error handling to double check syntax. The bug is the error right now is fatal. Less fatal errors in reticulate would be nice.
Ok let get into things.... with some pictures of running different lines of code
Edit: Added a comma to reproducible example so the correct error code produces
The text was updated successfully, but these errors were encountered: