Permalink
Browse files

the encoding directive must be a comment

  • Loading branch information...
1 parent 8c6fe86 commit bd8c52d8d25b6cfdb931a5d93a0dc1bbb09e8cd3 @bukzor bukzor committed Apr 24, 2012
Showing with 6 additions and 1 deletion.
  1. +1 −1 pudb/lowlevel.py
  2. +5 −0 test/test-encoding.py
View
2 pudb/lowlevel.py
@@ -78,7 +78,7 @@ def lookup_module(filename):
# stolen from Python 3.1's tokenize.py, by Ka-Ping Yee
import re
-cookie_re = re.compile("coding[:=]\s*([-\w.]+)")
+cookie_re = re.compile("^\s*#.*coding[:=]\s*([-\w.]+)")
from codecs import lookup, BOM_UTF8
def detect_encoding(readline):
View
5 test/test-encoding.py
@@ -0,0 +1,5 @@
+def f(encoding=None):
+ print 'ENCODING:', encoding
+
+from pudb import runcall
+runcall(f)

0 comments on commit bd8c52d

Please sign in to comment.