Re: [Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-12-14 Thread Simon Urbanek
Laurent, > On Dec 14, 2019, at 5:29 PM, Laurent Gautier wrote: > > Hi Simon, > > Widespread errors would have caught my earlier as the way that code is > using only one initialization of the embedded R, is used quite a bit, and > is covered by quite a few unit tests. This is the only situation

Re: [Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-12-14 Thread Laurent Gautier
Hi Simon, Widespread errors would have caught my earlier as the way that code is using only one initialization of the embedded R, is used quite a bit, and is covered by quite a few unit tests. This is the only situation I am aware of in which an error occurs. What is a "correct context", or initi

Re: [Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-12-14 Thread Simon Urbanek
Laurent, the main point here is that ParseVector() just like any other R API has to be called in a correct context since it can raise errors so the issue was that your C code has a bug of not setting R correctly (my guess would be your'e not creating the initial context necessary in embedded R)

Re: [Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-12-14 Thread Laurent Gautier
Le lun. 9 déc. 2019 à 09:57, Tomas Kalibera a écrit : > On 12/9/19 2:54 PM, Laurent Gautier wrote: > > > > Le lun. 9 déc. 2019 à 05:43, Tomas Kalibera a > écrit : > >> On 12/7/19 10:32 PM, Laurent Gautier wrote: >> >> Thanks for the quick response Tomas. >> >> The same error is indeed happening

Re: [Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-12-09 Thread Tomas Kalibera
On 12/9/19 2:54 PM, Laurent Gautier wrote: > > > Le lun. 9 déc. 2019 à 05:43, Tomas Kalibera > a écrit : > > On 12/7/19 10:32 PM, Laurent Gautier wrote: >> Thanks for the quick response Tomas. >> >> The same error is indeed happening when trying to have

Re: [Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-12-09 Thread Laurent Gautier
Le lun. 9 déc. 2019 à 05:43, Tomas Kalibera a écrit : > On 12/7/19 10:32 PM, Laurent Gautier wrote: > > Thanks for the quick response Tomas. > > The same error is indeed happening when trying to have a zero-length > variable name in an environment. The surprising bit is then "why is this > happen

Re: [Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-12-09 Thread Tomas Kalibera
On 12/7/19 10:32 PM, Laurent Gautier wrote: > Thanks for the quick response Tomas. > > The same error is indeed happening when trying to have a zero-length > variable name in an environment. The surprising bit is then "why is > this happening during parsing" (that is why are variables assigned to

Re: [Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-12-07 Thread Laurent Gautier
Thanks for the quick response Tomas. The same error is indeed happening when trying to have a zero-length variable name in an environment. The surprising bit is then "why is this happening during parsing" (that is why are variables assigned to an environment) ? We are otherwise aware that the err

Re: [Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-12-02 Thread Tomas Kalibera
Dear Laurent, could you please provide a complete reproducible example where parsing results in a crash of R? Calling parse(text="list(''=123") from R works fine for me (gives Error: attempt to use zero-length variable name). I don't think the problem you observed could be related to the memo

Re: [Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-11-30 Thread Laurent Gautier
Hi again, Beside R_ParseVector()'s possible inconsistent behavior, R's handling of zero-length named elements does not seem consistent either: ``` > lst <- list() > lst[[""]] <- 1 > names(lst) [1] "" > list("" = 1) Error: attempt to use zero-length variable name ``` Should the parser be made to

Re: [Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-11-30 Thread Laurent Gautier
I found the following code comment in `src/main/gram.c`: ``` /* Memory leak yyparse(), as generated by bison, allocates extra space for the parser stack using malloc(). Unfortunately this means that there is a memory leak in case of an R error (long-jump). In principle, we could define yyoverflo

[Rd] Inconsistent behavior for the C AP's R_ParseVector() ?

2019-11-30 Thread Laurent Gautier
Hi, The behavior of ``` SEXP R_ParseVector(SEXP, int, ParseStatus *, SEXP); ``` defined in `src/include/R_ext/Parse.h` appears to be inconsistent depending on the string to be parsed. Trying to parse a string such as `"list(''=1+"` sets the `ParseStatus` to incomplete parsing error but trying to