Scoping is weird with python3 in python interpolation and crashes.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
UltiSnips |
Fix Committed
|
High
|
Unassigned |
Bug Description
I tried list comprehensions inside python interpolated snippets and it seems not to work. When trying to access local variables (say for example the 're' module) it throws NameError and that the variable is not global (in the following case I defined arg = t[4] before the list comprehension).
An error occured. This is either a bug in UltiSnips or a bug in a
snippet definition. If you think this is a bug, please report it to
https:/
Following is the full stack trace:
Traceback (most recent call last):
File "/home/
return f(self, *args, **kwds)
File "/home/
rv = self._try_expand()
File "/home/
self.
File "/home/
si = snippet.
File "/home/
last_re = self._last_re, globals = self._globals)
File "/home/
self.
File "/home/
if obj._update(done, not_done):
File "/home/
compatible_
File "<string>", line 9, in <module>
File "<string>", line 9, in <listcomp>
NameError: global name 'arg' is not defined
:py3 import sys; print(sys.version):
3.3.2+ (default, Oct 9 2013, 14:53:41)
[GCC 4.8.1]
We do not limit python in any way in the snippets. So you are able to use all of it.
It would be helpful if you could paste a minimal snippet that shows the problem you have, without an example I will have a hard time reproducing the bug.