summary refs log tree commit diff stats
path: root/plugins/python/python.py
diff options
context:
space:
mode:
authorA_D <A_D@snoonet.org>2018-07-25 21:41:05 +0200
committerPatrick Griffis <tingping@tingping.se>2018-11-09 18:36:59 -0500
commita2ff661d40bcd49a0be973b7b60583fde64e09c2 (patch)
tree6c2b32aaaa2804cb001368a5d83dd6ac93ab3425 /plugins/python/python.py
parent706f9bca82d463f6f1bd17d5dc609807e4a1e8a9 (diff)
python: Various cffi fixes
- fixed /py exec behaviour
- fixed hexchat.unload_hook() failing when passed a hook id
- fixed get_list() calls in python3
Diffstat (limited to 'plugins/python/python.py')
-rw-r--r--plugins/python/python.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/python/python.py b/plugins/python/python.py
index 3845a79f..e6a61b5e 100644
--- a/plugins/python/python.py
+++ b/plugins/python/python.py
@@ -98,7 +98,8 @@ else:
         return compile(data, filename, 'exec', optimize=2, dont_inherit=True)
 
     def compile_line(string):
-        return compile(string, '<string>', 'eval', optimize=2, dont_inherit=True)
+        # newline appended to solve unexpected EOF issues
+        return compile(string + '\n', '<string>', 'single', optimize=2, dont_inherit=True)
 
 
 class Plugin:
@@ -122,7 +123,7 @@ class Plugin:
     def remove_hook(self, hook):
         for h in self.hooks:
             if id(h) == hook:
-                ud = hook.userdata
+                ud = h.userdata
                 self.hooks.remove(h)
                 return ud
         else: