Code Injection Fix

This commit is contained in:
rparedis 2022-12-16 11:50:25 +01:00
parent 50164a92c6
commit 325880f46e
4 changed files with 8 additions and 4707 deletions

View file

@ -2,10 +2,11 @@ import time as python_time
import sys
def time():
if sys.platform == "win32":
if sys.version_info[0] == 2 and sys.platform == "win32":
# better precision on windows, but deprecated since 3.3
return python_time.clock()
else:
return python_time.time()
return python_time.perf_counter()
def sleep(t):
python_time.sleep(t)

View file

@ -47,6 +47,8 @@ except ImportError:
try:
import Queue as Queue
except ImportError:
# Fix for parallel DEVS?
# from multiprocessing import Queue
import queue as Queue
def local(sim):
@ -69,7 +71,7 @@ def loadCheckpoint(name):
"""
listdir = os.listdir('.')
if str(name) + "_SIM.pdc" not in listdir:
# Simulator object not even found, don't bother continueing
# Simulator object not even found, don't bother continuing
#assert info("Not even a SIM file was found for the requested name, giving up already")
return
try:

View file

@ -124,6 +124,8 @@ def easyCommand(function, args):
for i in range(len(args)):
if i != 0:
text += ", "
if isinstance(args[i], str):
args[i] = '"%s"' % args[i][1:-1].replace('"', "\\\"").replace("'", "\\'")
text += str(args[i])
text += ")"
return text