Skip to content

Commit 82a30ec

Browse files
committed
added a 'generate_json_trace.py' string check for externally-defined objects
1 parent e35cf56 commit 82a30ec

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎v4-cokapi/backends/python-anaconda/Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ all:
88
test:
99
/usr/bin/docker run -m 1024m --rm --user=netuser --net=none --cap-drop all pgbovine/cokapi-python-anaconda:v1 python /tmp/python/generate_json_trace.py --allmodules --code="import pandas as pd; print(pd)"
1010

11+
testfunc:
12+
/usr/bin/docker run -m 1024m --rm --user=netuser --net=none --cap-drop all pgbovine/cokapi-python-anaconda:v1 python /tmp/python/generate_json_trace.py --allmodules --code="def foo(x,y): pass"
13+
1114
bash:
1215
docker run -m 512M -t -i --rm --user=netuser --net=none --cap-drop all pgbovine/cokapi-python-anaconda:v1 bash

‎v5-unity/pg_encoder.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ def encode(self, dat, get_parent):
243243
# NB: don't use os.path.isabs() since it doesn't work on some
244244
# python installations (e.g., on my webserver) and also adds a
245245
# dependency on the os module. just do a simple check:
246-
if gsf and gsf[0] == '/':
246+
#
247+
# hacky: do other checks for strings that are indicative of files
248+
# that load user-written code, like 'generate_json_trace.py'
249+
if gsf and gsf[0] == '/' and 'generate_json_trace.py' not in gsf:
247250
is_externally_defined = True
248251
except (AttributeError, TypeError):
249252
pass # fail soft

0 commit comments

Comments
 (0)