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 import sys
def time(): 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() return python_time.clock()
else: else:
return python_time.time() return python_time.perf_counter()
def sleep(t): def sleep(t):
python_time.sleep(t) python_time.sleep(t)

View file

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

View file

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

File diff suppressed because it is too large Load diff