Show More
@@ -1677,7 +1677,9 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||||
1677 |
|
1677 | |||
1678 | # Remove some chars from the delimiters list. If we encounter |
|
1678 | # Remove some chars from the delimiters list. If we encounter | |
1679 | # unicode chars, discard them. |
|
1679 | # unicode chars, discard them. | |
1680 |
delims = readline.get_completer_delims() |
|
1680 | delims = readline.get_completer_delims() | |
|
1681 | if not py3compat.PY3: | |||
|
1682 | delims = delims.encode("ascii", "ignore") | |||
1681 | for d in self.readline_remove_delims: |
|
1683 | for d in self.readline_remove_delims: | |
1682 | delims = delims.replace(d, "") |
|
1684 | delims = delims.replace(d, "") | |
1683 | delims = delims.replace(ESC_MAGIC, '') |
|
1685 | delims = delims.replace(ESC_MAGIC, '') |
@@ -10,6 +10,8 b'' | |||||
10 | import re |
|
10 | import re | |
11 | import sys |
|
11 | import sys | |
12 |
|
12 | |||
|
13 | from IPython.utils import py3compat | |||
|
14 | ||||
13 | coding_declaration = re.compile(r"#\s*coding[:=]\s*([-\w.]+)") |
|
15 | coding_declaration = re.compile(r"#\s*coding[:=]\s*([-\w.]+)") | |
14 |
|
16 | |||
15 | class Macro(object): |
|
17 | class Macro(object): | |
@@ -37,8 +39,7 b' class Macro(object):' | |||||
37 | self.value = code + '\n' |
|
39 | self.value = code + '\n' | |
38 |
|
40 | |||
39 | def __str__(self): |
|
41 | def __str__(self): | |
40 | enc = sys.stdin.encoding or sys.getdefaultencoding() |
|
42 | return py3compat.unicode_to_str(self.value) | |
41 | return self.value.encode(enc, "replace") |
|
|||
42 |
|
43 | |||
43 | def __unicode__(self): |
|
44 | def __unicode__(self): | |
44 | return self.value |
|
45 | return self.value |
@@ -676,7 +676,7 b' Currently the magic system has the following functions:\\n"""' | |||||
676 |
|
676 | |||
677 | %psearch -a _* list objects beginning with a single underscore""" |
|
677 | %psearch -a _* list objects beginning with a single underscore""" | |
678 | try: |
|
678 | try: | |
679 |
|
|
679 | parameter_s.encode('ascii') | |
680 | except UnicodeEncodeError: |
|
680 | except UnicodeEncodeError: | |
681 | print 'Python identifiers can only contain ascii characters.' |
|
681 | print 'Python identifiers can only contain ascii characters.' | |
682 | return |
|
682 | return |
General Comments 0
You need to be logged in to leave comments.
Login now