Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

encoding detection #37

Merged
merged 1 commit into from

2 participants

@bukzor

pudb was crashing with 'unknown encoding: None' because of a function which had an optional argument of encoding=None.

As specified in the pep, the encoding directive must be a comment.
I've altered the regex accordingly.

http://www.python.org/dev/peps/pep-0263/

@inducer inducer merged commit f65d3f6 into from
@inducer
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 24, 2012
  1. @bukzor
This page is out of date. Refresh to see the latest.
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)
Something went wrong with that request. Please try again.