Closed nschloe closed 3 years ago
This is an odd one for me. I replicated the behavior. Maybe I'm confused something in the Python language or misunderstanding garbage collection.
When the function exits, the garbage should be collected, no? And then upon the next call the default options should be set and then the kwargs should be parsed. Guess that clearly isn't happening.
As a solution, I split the one options dictionary into two dictionaries at the top of generation.py
. One for generation options and the other for sliver options.
And then I run the gc.collect() upon exiting the generate_mesh
and sliver_removal
. This seems to clear things up.
yea that's not a good idea after all.
Without looking at the code, I'm smelling mutable default arguments.
Yes, that's good intuition. This was indeed the problem and as a result I moved the dictionaries that define default options inside their respective functions (in the pull request referenced above). This seemingly fixes the errors.
Actually, this helped me catch some gotcha calls on the README examples (where I didn't pass the bbox to the sliver_removal
for instance).
Okay, the fix for this was merged in and your MWE now actually works. After I finish the other improvement to the API, I'll release a new version.
When trying to mesh the L-shape and something else one after another, SM will error out.
MWE: