You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
parser.pyj module has several static objects that are mutated during the process.
(I mean BASELIB and CLASS_MAP at least). Thus, when two or more files are compiled at once, these objects contain data from the previous compilation, because there is no initialization / cleanup before the next compilation. I caught this bug when compiling in a browser.
It seems, there is no trivial-elegant solution, because parser has recursive calls + baselib is parsed at separated step before file compiling (these objects should be kept after baselib has been parsed)
Possible fix:
Create function parser.init_mod() that will initialize static objects
Fix rapydscript.compile(): If browser_env: Call parser.init_mod()
Fix compile.pyj: call parser.init_mod() and rapydscript.parse_baselib(...) before each file compiling (i.e. move rapydscript.parse_baselib(...) from module.exports = def():... into compile_single_file(...))
thoughts?
The bug demo
#make two files:#foo.pyj:deffoo():
a=range(10)
#bar.pyj:defbar():
print('hello')
try to compile files at once: rapydscript -p foo.pyj bar.pyj you will see that bar exhaust includes range() as overhead
The text was updated successfully, but these errors were encountered:
parser.pyj
module has several static objects that are mutated during the process.(I mean
BASELIB
andCLASS_MAP
at least). Thus, when two or more files are compiled at once, these objects contain data from the previous compilation, because there is no initialization / cleanup before the next compilation. I caught this bug when compiling in a browser.It seems, there is no trivial-elegant solution, because
parser
has recursive calls + baselib is parsed at separated step before file compiling (these objects should be kept after baselib has been parsed)Possible fix:
parser.init_mod()
that will initialize static objectsrapydscript.compile()
:If browser_env:
Callparser.init_mod()
compile.pyj
: callparser.init_mod()
andrapydscript.parse_baselib(...)
before each file compiling (i.e. moverapydscript.parse_baselib(...)
frommodule.exports = def():...
intocompile_single_file(...)
)thoughts?
The bug demo
try to compile files at once:
rapydscript -p foo.pyj bar.pyj
you will see thatbar
exhaust includesrange()
as overheadThe text was updated successfully, but these errors were encountered: