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 1818 MONO_DEBUG_FORMAT_DEBUGGER
1919} MonoDebugFormat;
2020
21+ char* mono_get_runtime_build_info (void);
22+
2123MonoDomain* mono_jit_init(const char *root_domain_name);
2224void mono_jit_cleanup(MonoDomain *domain);
2325void mono_jit_parse_options(int argc, char * argv[]);
Original file line number Diff line number Diff line change 11import atexit
2+ import re
23from typing import Optional , Sequence
34
45from .ffi import load_mono , ffi
@@ -122,13 +123,29 @@ def initialize(
122123 if jit_options :
123124 options = [ffi .new ("char[]" , o .encode ("utf8" )) for o in jit_options ]
124125 _MONO .mono_jit_parse_options (len (options ), options )
126+ else :
127+ options = []
125128
126129 if debug :
127130 _MONO .mono_debug_init (_MONO .MONO_DEBUG_FORMAT_MONO )
128131
129132 _ROOT_DOMAIN = _MONO .mono_jit_init (b"clr_loader" )
130133 _MONO .mono_domain_set_config (_ROOT_DOMAIN , b"." , config_encoded )
131134 _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+
132149 atexit .register (_release )
133150
134151
You can’t perform that action at this time.
0 commit comments