File tree 2 files changed +11
-10
lines changed
2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -365,16 +365,6 @@ impl RMain {
365
365
let libraries = RLibraries :: from_r_home_path ( & r_home) ;
366
366
libraries. initialize_pre_setup_r ( ) ;
367
367
368
- // In tests R may be run from various threads. This confuses R's stack
369
- // overflow checks so we disable those. This should not make it in
370
- // production builds as it causes stack overflows to crash R instead of
371
- // throwing an R error.
372
- if harp:: test:: IS_TESTING {
373
- unsafe {
374
- libr:: set ( libr:: R_CStackLimit , usize:: MAX ) ;
375
- }
376
- }
377
-
378
368
crate :: sys:: interface:: setup_r ( args) ;
379
369
380
370
libraries. initialize_post_setup_r ( ) ;
Original file line number Diff line number Diff line change @@ -68,6 +68,17 @@ pub fn setup_r(mut args: Vec<*mut c_char>) {
68
68
libr:: set ( ptr_R_Busy, Some ( r_busy) ) ;
69
69
libr:: set ( ptr_R_Suicide, Some ( r_suicide) ) ;
70
70
71
+ // In tests R may be run from various threads. This confuses R's stack
72
+ // overflow checks so we disable those. This should not make it in
73
+ // production builds as it causes stack overflows to crash R instead of
74
+ // throwing an R error.
75
+ //
76
+ // This must be called _after_ `Rf_initialize_R()`, since that's where R
77
+ // detects the stack size and sets the default limit.
78
+ if harp:: test:: IS_TESTING {
79
+ libr:: set ( libr:: R_CStackLimit , usize:: MAX ) ;
80
+ }
81
+
71
82
// Set up main loop
72
83
setup_Rmainloop ( ) ;
73
84
}
You can’t perform that action at this time.
0 commit comments