File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 18
18
MONO_DEBUG_FORMAT_DEBUGGER
19
19
} MonoDebugFormat;
20
20
21
+ char* mono_get_runtime_build_info (void);
22
+
21
23
MonoDomain* mono_jit_init(const char *root_domain_name);
22
24
void mono_jit_cleanup(MonoDomain *domain);
23
25
void mono_jit_parse_options(int argc, char * argv[]);
Original file line number Diff line number Diff line change 1
1
import atexit
2
+ import re
2
3
from typing import Optional , Sequence
3
4
4
5
from .ffi import load_mono , ffi
@@ -122,13 +123,29 @@ def initialize(
122
123
if jit_options :
123
124
options = [ffi .new ("char[]" , o .encode ("utf8" )) for o in jit_options ]
124
125
_MONO .mono_jit_parse_options (len (options ), options )
126
+ else :
127
+ options = []
125
128
126
129
if debug :
127
130
_MONO .mono_debug_init (_MONO .MONO_DEBUG_FORMAT_MONO )
128
131
129
132
_ROOT_DOMAIN = _MONO .mono_jit_init (b"clr_loader" )
130
133
_MONO .mono_domain_set_config (_ROOT_DOMAIN , b"." , config_encoded )
131
134
_check_result (_ROOT_DOMAIN , "Failed to initialize Mono" )
135
+
136
+ build = _MONO .mono_get_runtime_build_info ()
137
+ _check_result (build , "Failed to get Mono version" )
138
+ ver_str = ffi .string (build ).decode ('utf8' ) # e.g. '6.12.0.122 (tarball)'
139
+
140
+ ver = re .match (r'^(?P<major>\d+)\.(?P<minor>\d+)\.[\d.]+' , ver_str )
141
+ if ver is not None :
142
+ major = int (ver .group ('major' ))
143
+ minor = int (ver .group ('minor' ))
144
+
145
+ if major < 6 or (major == 6 and minor < 12 ):
146
+ import warnings
147
+ warnings .warn ('Hosting Mono versions before v6.12 is known to be problematic. If the process crashes shortly after you see this message, try updating Mono to at least v6.12.' )
148
+
132
149
atexit .register (_release )
133
150
134
151
You can’t perform that action at this time.
0 commit comments