<commit_before># Minimal repl.c to support precompilation with python symbols already loaded
import ctypes
import sys
import os
from ctypes import *
if sys.platform.startswith('darwin'):
    sh_ext = ".dylib"
elif sys.platform.startswith('win32'):
    sh_ext = ".dll"
else:
    sh_ext = ".so"
libjulia_path = os.environ["PYCALL_LIBJULIA_PATH"] + "/lib" + os.environ["PYCALL_JULIA_FLAVOR"] + sh_ext
libjulia = ctypes.CDLL(libjulia_path, ctypes.RTLD_GLOBAL)
os.environ["JULIA_HOME"] = os.environ["PYCALL_JULIA_HOME"]

if not hasattr(libjulia, "jl_init_with_image"):
    if hasattr(libjulia, "jl_init_with_image__threading"):
        libjulia.jl_init_with_image = libjulia.jl_init_with_image__threading
    else:
        raise ImportError("No libjulia entrypoint found! (tried jl_init and jl_init__threading)")

# Set up the calls from libjulia we'll use
libjulia.jl_parse_opts.argtypes = [POINTER(c_int), POINTER(POINTER(c_char_p))]
libjulia.jl_parse_opts.restype = None
libjulia.jl_init_with_image.argtypes = [c_char_p, c_char_p]
libjulia.jl_init_with_image.restype = None
libjulia.jl_get_global.argtypes = [c_void_p,c_void_p]
libjulia.jl_get_global.restype = c_void_p
libjulia.jl_symbol.argtypes = [c_char_p]
libjulia.jl_symbol.restype = c_void_p
libjulia.jl_apply_generic.argtypes = [POINTER(c_void_p), c_int]
libjulia.jl_apply_generic.restype = c_void_p
libjulia.jl_set_ARGS.argtypes = [c_int, POINTER(c_char_p)]
libjulia.jl_set_ARGS.restype = None
libjulia.jl_atexit_hook.argtypes = [c_int]
libjulia.jl_atexit_hook.restype = None
libjulia.jl_eval_string.argtypes = [c_char_p]
libjulia.jl_eval_string.restype = None

# Ok, go
argc = c_int(len(sys.argv)-1)
argv = (c_char_p * (len(sys.argv)))()
if sys.version_info[0] < 3:<commit_msg>Fix crashes when precompiling modules that require PyCall<commit_after># Minimal repl.c to support precompilation with python symbols already loaded
import ctypes
import sys
import os
from ctypes import *
if sys.platform.startswith('darwin'):
    sh_ext = ".dylib"
elif sys.platform.startswith('win32'):
    sh_ext = ".dll"
else:
    sh_ext = ".so"
libjulia_path = os.environ["PYCALL_LIBJULIA_PATH"] + "/lib" + os.environ["PYCALL_JULIA_FLAVOR"] + sh_ext
libjulia = ctypes.PyDLL(libjulia_path, ctypes.RTLD_GLOBAL)
os.environ["JULIA_HOME"] = os.environ["PYCALL_JULIA_HOME"]

if not hasattr(libjulia, "jl_init_with_image"):
    if hasattr(libjulia, "jl_init_with_image__threading"):
        libjulia.jl_init_with_image = libjulia.jl_init_with_image__threading
    else:
        raise ImportError("No libjulia entrypoint found! (tried jl_init and jl_init__threading)")

# Set up the calls from libjulia we'll use
libjulia.jl_parse_opts.argtypes = [POINTER(c_int), POINTER(POINTER(c_char_p))]
libjulia.jl_parse_opts.restype = None
libjulia.jl_init_with_image.argtypes = [c_char_p, c_char_p]
libjulia.jl_init_with_image.restype = None
libjulia.jl_get_global.argtypes = [c_void_p,c_void_p]
libjulia.jl_get_global.restype = c_void_p
libjulia.jl_symbol.argtypes = [c_char_p]
libjulia.jl_symbol.restype = c_void_p
libjulia.jl_apply_generic.argtypes = [POINTER(c_void_p), c_int]
libjulia.jl_apply_generic.restype = c_void_p
libjulia.jl_set_ARGS.argtypes = [c_int, POINTER(c_char_p)]
libjulia.jl_set_ARGS.restype = None
libjulia.jl_atexit_hook.argtypes = [c_int]
libjulia.jl_atexit_hook.restype = None
libjulia.jl_eval_string.argtypes = [c_char_p]
libjulia.jl_eval_string.restype = None

# Ok, go
argc = c_int(len(sys.argv)-1)
argv = (c_char_p * (len(sys.argv)))()
if sys.version_info[0] < 3:
{'fraction_non_alphanumeric': 0.11152204836415362, 'fraction_numerical': 0.002844950213371266, 'mean_word_length': 6.264462809917355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3068805', 'n_tokens_mistral': 1519, 'n_tokens_neox': 1484, 'n_words': 234}