Skip to content

Commit a26f8ca

Browse files
committed
Revert r63934 -- it was mixing two patches.
1 parent f954c4b commit a26f8ca

37 files changed

+1082
-1242
lines changed

Doc/c-api/unicode.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,6 @@ the Python configuration.
144144

145145
Return 1 or 0 depending on whether *ch* is an alphanumeric character.
146146

147-
.. cfunction:: int Py_UNICODE_ISPRINTABLE(Py_UNICODE ch)
148-
149-
Return 1 or 0 depending on whether *ch* is a printable character.
150-
Characters defined in the Unicode character database as "Other"
151-
or "Separator" other than ASCII space(0x20) are not considered
152-
printable.
153-
154147
These APIs can be used for fast direct character conversions:
155148

156149

@@ -235,9 +228,6 @@ APIs:
235228
+===================+=====================+================================+
236229
| :attr:`%%` | *n/a* | The literal % character. |
237230
+-------------------+---------------------+--------------------------------+
238-
| :attr:`%a` | PyObject\* | The result of calling |
239-
| | | :func:`ascii`. |
240-
+-------------------+---------------------+--------------------------------+
241231
| :attr:`%c` | int | A single character, |
242232
| | | represented as an C int. |
243233
+-------------------+---------------------+--------------------------------+

Doc/library/functions.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,6 @@ are always available. They are listed here in alphabetical order.
9191
return False
9292

9393

94-
.. function:: ascii(object)
95-
96-
As :func:`repr`, return a string containing a printable
97-
representation of an object. But unlike :func:`repr`, the non-ASCII
98-
characters in the string returned by :func:`ascii`() are hex-escaped
99-
to generate a same string as :func:`repr` in Python 2.
100-
101-
10294
.. function:: bin(x)
10395

10496
Convert an integer number to a binary string. The result is a valid Python

Doc/library/stdtypes.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -774,14 +774,6 @@ functions based on regular expressions.
774774
least one cased character, false otherwise.
775775

776776

777-
.. method:: str.isprintable()
778-
779-
Return true if all characters in the string are printable and there is at
780-
least one character, false otherwise. Characters defined in the Unicode
781-
character database as "Other" or "Separator" other than ASCII space(0x20) are
782-
not considered printable.
783-
784-
785777
.. method:: str.isspace()
786778

787779
Return true if there are only whitespace characters in the string and there is

Doc/library/sys.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ always available.
231231
+------------------------------+------------------------------------------+
232232
| :const:`ignore_environment` | -E |
233233
+------------------------------+------------------------------------------+
234+
| :const:`tabcheck` | -t or -tt |
235+
+------------------------------+------------------------------------------+
234236
| :const:`verbose` | -v |
235237
+------------------------------+------------------------------------------+
236238
| :const:`unicode` | -U |

Doc/using/cmdline.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ Miscellaneous options
222222
manipulations of :data:`sys.path` that it entails.
223223

224224

225+
.. cmdoption:: -t
226+
227+
Issue a warning when a source file mixes tabs and spaces for indentation in a
228+
way that makes it depend on the worth of a tab expressed in spaces. Issue an
229+
error when the option is given twice (:option:`-tt`).
230+
231+
225232
.. cmdoption:: -u
226233

227234
Force stdin, stdout and stderr to be totally unbuffered. On systems where it

Include/pydebug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ PyAPI_DATA(int) Py_NoSiteFlag;
1414
PyAPI_DATA(int) Py_BytesWarningFlag;
1515
PyAPI_DATA(int) Py_UseClassExceptionsFlag;
1616
PyAPI_DATA(int) Py_FrozenFlag;
17+
PyAPI_DATA(int) Py_TabcheckFlag;
1718
PyAPI_DATA(int) Py_IgnoreEnvironmentFlag;
1819
PyAPI_DATA(int) Py_DivisionWarningFlag;
1920
PyAPI_DATA(int) Py_DontWriteBytecodeFlag;

Include/unicodeobject.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
217217
# define _PyUnicode_IsLinebreak _PyUnicodeUCS2_IsLinebreak
218218
# define _PyUnicode_IsLowercase _PyUnicodeUCS2_IsLowercase
219219
# define _PyUnicode_IsNumeric _PyUnicodeUCS2_IsNumeric
220-
# define _PyUnicode_IsPrintable _PyUnicodeUCS2_IsPrintable
221220
# define _PyUnicode_IsTitlecase _PyUnicodeUCS2_IsTitlecase
222221
# define _PyUnicode_IsXidStart _PyUnicodeUCS2_IsXidStart
223222
# define _PyUnicode_IsXidContinue _PyUnicodeUCS2_IsXidContinue
@@ -312,7 +311,6 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
312311
# define _PyUnicode_IsLinebreak _PyUnicodeUCS4_IsLinebreak
313312
# define _PyUnicode_IsLowercase _PyUnicodeUCS4_IsLowercase
314313
# define _PyUnicode_IsNumeric _PyUnicodeUCS4_IsNumeric
315-
# define _PyUnicode_IsPrintable _PyUnicodeUCS4_IsPrintable
316314
# define _PyUnicode_IsTitlecase _PyUnicodeUCS4_IsTitlecase
317315
# define _PyUnicode_IsXidStart _PyUnicodeUCS4_IsXidStart
318316
# define _PyUnicode_IsXidContinue _PyUnicodeUCS4_IsXidContinue
@@ -353,7 +351,6 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
353351
#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch)
354352
#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch)
355353
#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch)
356-
#define Py_UNICODE_ISPRINTABLE(ch) _PyUnicode_IsPrintable(ch)
357354

358355
#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch)
359356
#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch)
@@ -384,7 +381,6 @@ extern const unsigned char _Py_ascii_whitespace[];
384381
#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch)
385382
#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch)
386383
#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch)
387-
#define Py_UNICODE_ISPRINTABLE(ch) _PyUnicode_IsPrintable(ch)
388384

389385
#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch)
390386
#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch)
@@ -1503,10 +1499,6 @@ PyAPI_FUNC(int) _PyUnicode_IsNumeric(
15031499
Py_UNICODE ch /* Unicode character */
15041500
);
15051501

1506-
PyAPI_FUNC(int) _PyUnicode_IsPrintable(
1507-
Py_UNICODE ch /* Unicode character */
1508-
);
1509-
15101502
PyAPI_FUNC(int) _PyUnicode_IsAlpha(
15111503
Py_UNICODE ch /* Unicode character */
15121504
);

Lib/doctest.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,13 +1441,6 @@ class OutputChecker:
14411441
and returns true if they match; and `output_difference`, which
14421442
returns a string describing the differences between two outputs.
14431443
"""
1444-
1445-
def _toAscii(self, s):
1446-
"""
1447-
Convert string to hex-escaped ASCII string.
1448-
"""
1449-
return str(s.encode('ASCII', 'backslashreplace'), "ASCII")
1450-
14511444
def check_output(self, want, got, optionflags):
14521445
"""
14531446
Return True iff the actual output from an example (`got`)
@@ -1458,15 +1451,6 @@ def check_output(self, want, got, optionflags):
14581451
documentation for `TestRunner` for more information about
14591452
option flags.
14601453
"""
1461-
1462-
# If `want` contains hex-escaped character such as "\u1234",
1463-
# then `want` is a string of six characters(e.g. [\,u,1,2,3,4]).
1464-
# On the other hand, `got` could be an another sequence of
1465-
# characters such as [\u1234], so `want` and `got` should
1466-
# be folded to hex-escaped ASCII string to compare.
1467-
got = self._toAscii(got)
1468-
want = self._toAscii(want)
1469-
14701454
# Handle the common case first, for efficiency:
14711455
# if they're string-identical, always return true.
14721456
if got == want:

Lib/test/test_array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ def test_unicode(self):
768768
a = array.array('u', s)
769769
self.assertEqual(
770770
repr(a),
771-
"array('u', '\\x00=\"\\'a\\\\b\\x80\xff\\x00\\x01\u1234')")
771+
"array('u', '\\x00=\"\\'a\\\\b\\x80\\xff\\x00\\x01\\u1234')")
772772

773773
self.assertRaises(TypeError, a.fromunicode)
774774

Lib/test/test_builtin.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ def test_any(self):
159159
S = [10, 20, 30]
160160
self.assertEqual(any(x > 42 for x in S), False)
161161

162-
def test_ascii(self):
163-
self.assertEqual(ascii("\u0370"), "'\\u0370'")
164-
165162
def test_neg(self):
166163
x = -sys.maxsize-1
167164
self.assert_(isinstance(x, int))

0 commit comments

Comments
 (0)