Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ed11a5d0
Commit
ed11a5d0
authored
May 20, 2012
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8767: Restore building with --disable-unicode.
Original patch by Stefano Taschini.
parent
77e77a12
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
63 additions
and
9 deletions
+63
-9
Lib/glob.py
Lib/glob.py
+9
-1
Lib/locale.py
Lib/locale.py
+9
-1
Lib/posixpath.py
Lib/posixpath.py
+10
-2
Lib/test/script_helper.py
Lib/test/script_helper.py
+7
-1
Lib/test/test_support.py
Lib/test/test_support.py
+1
-1
Lib/textwrap.py
Lib/textwrap.py
+10
-2
Lib/unittest/case.py
Lib/unittest/case.py
+5
-1
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
Objects/object.c
Objects/object.c
+2
-0
Python/bltinmodule.c
Python/bltinmodule.c
+2
-0
Python/peephole.c
Python/peephole.c
+2
-0
configure
configure
+1
-0
configure.ac
configure.ac
+1
-0
No files found.
Lib/glob.py
View file @
ed11a5d0
...
@@ -5,6 +5,14 @@ import os
...
@@ -5,6 +5,14 @@ import os
import
re
import
re
import
fnmatch
import
fnmatch
try
:
_unicode
=
unicode
except
NameError
:
# If Python is built without Unicode support, the unicode type
# will not exist. Fake one.
class
_unicode
(
object
):
pass
__all__
=
[
"glob"
,
"iglob"
]
__all__
=
[
"glob"
,
"iglob"
]
def
glob
(
pathname
):
def
glob
(
pathname
):
...
@@ -49,7 +57,7 @@ def iglob(pathname):
...
@@ -49,7 +57,7 @@ def iglob(pathname):
def
glob1
(
dirname
,
pattern
):
def
glob1
(
dirname
,
pattern
):
if
not
dirname
:
if
not
dirname
:
dirname
=
os
.
curdir
dirname
=
os
.
curdir
if
isinstance
(
pattern
,
unicode
)
and
not
isinstance
(
dirname
,
unicode
):
if
isinstance
(
pattern
,
_
unicode
)
and
not
isinstance
(
dirname
,
unicode
):
dirname
=
unicode
(
dirname
,
sys
.
getfilesystemencoding
()
or
dirname
=
unicode
(
dirname
,
sys
.
getfilesystemencoding
()
or
sys
.
getdefaultencoding
())
sys
.
getdefaultencoding
())
try
:
try
:
...
...
Lib/locale.py
View file @
ed11a5d0
...
@@ -18,6 +18,14 @@ import re
...
@@ -18,6 +18,14 @@ import re
import
operator
import
operator
import
functools
import
functools
try
:
_unicode
=
unicode
except
NameError
:
# If Python is built without Unicode support, the unicode type
# will not exist. Fake one.
class
_unicode
(
object
):
pass
# Try importing the _locale module.
# Try importing the _locale module.
#
#
# If this fails, fall back on a basic 'C' locale emulation.
# If this fails, fall back on a basic 'C' locale emulation.
...
@@ -353,7 +361,7 @@ def normalize(localename):
...
@@ -353,7 +361,7 @@ def normalize(localename):
"""
"""
# Normalize the locale name and extract the encoding
# Normalize the locale name and extract the encoding
if
isinstance
(
localename
,
unicode
):
if
isinstance
(
localename
,
_
unicode
):
localename
=
localename
.
encode
(
'ascii'
)
localename
=
localename
.
encode
(
'ascii'
)
fullname
=
localename
.
translate
(
_ascii_lower_map
)
fullname
=
localename
.
translate
(
_ascii_lower_map
)
if
':'
in
fullname
:
if
':'
in
fullname
:
...
...
Lib/posixpath.py
View file @
ed11a5d0
...
@@ -17,6 +17,14 @@ import genericpath
...
@@ -17,6 +17,14 @@ import genericpath
import
warnings
import
warnings
from
genericpath
import
*
from
genericpath
import
*
try
:
_unicode
=
unicode
except
NameError
:
# If Python is built without Unicode support, the unicode type
# will not exist. Fake one.
class
_unicode
(
object
):
pass
__all__
=
[
"normcase"
,
"isabs"
,
"join"
,
"splitdrive"
,
"split"
,
"splitext"
,
__all__
=
[
"normcase"
,
"isabs"
,
"join"
,
"splitdrive"
,
"split"
,
"splitext"
,
"basename"
,
"dirname"
,
"commonprefix"
,
"getsize"
,
"getmtime"
,
"basename"
,
"dirname"
,
"commonprefix"
,
"getsize"
,
"getmtime"
,
"getatime"
,
"getctime"
,
"islink"
,
"exists"
,
"lexists"
,
"isdir"
,
"isfile"
,
"getatime"
,
"getctime"
,
"islink"
,
"exists"
,
"lexists"
,
"isdir"
,
"isfile"
,
...
@@ -312,7 +320,7 @@ def expandvars(path):
...
@@ -312,7 +320,7 @@ def expandvars(path):
def
normpath
(
path
):
def
normpath
(
path
):
"""Normalize path, eliminating double slashes, etc."""
"""Normalize path, eliminating double slashes, etc."""
# Preserve unicode (if path is unicode)
# Preserve unicode (if path is unicode)
slash
,
dot
=
(
u'/'
,
u'.'
)
if
isinstance
(
path
,
unicode
)
else
(
'/'
,
'.'
)
slash
,
dot
=
(
u'/'
,
u'.'
)
if
isinstance
(
path
,
_
unicode
)
else
(
'/'
,
'.'
)
if
path
==
''
:
if
path
==
''
:
return
dot
return
dot
initial_slashes
=
path
.
startswith
(
'/'
)
initial_slashes
=
path
.
startswith
(
'/'
)
...
@@ -341,7 +349,7 @@ def normpath(path):
...
@@ -341,7 +349,7 @@ def normpath(path):
def
abspath
(
path
):
def
abspath
(
path
):
"""Return an absolute path."""
"""Return an absolute path."""
if
not
isabs
(
path
):
if
not
isabs
(
path
):
if
isinstance
(
path
,
unicode
):
if
isinstance
(
path
,
_
unicode
):
cwd
=
os
.
getcwdu
()
cwd
=
os
.
getcwdu
()
else
:
else
:
cwd
=
os
.
getcwd
()
cwd
=
os
.
getcwd
()
...
...
Lib/test/script_helper.py
View file @
ed11a5d0
...
@@ -10,7 +10,13 @@ import subprocess
...
@@ -10,7 +10,13 @@ import subprocess
import
py_compile
import
py_compile
import
contextlib
import
contextlib
import
shutil
import
shutil
import
zipfile
try
:
import
zipfile
except
ImportError
:
# If Python is build without Unicode support, importing _io will
# fail, which, in turn, means that zipfile cannot be imported
# Most of this module can then still be used.
pass
from
test.test_support
import
strip_python_stderr
from
test.test_support
import
strip_python_stderr
...
...
Lib/test/test_support.py
View file @
ed11a5d0
...
@@ -405,7 +405,7 @@ def temp_cwd(name='tempcwd', quiet=False):
...
@@ -405,7 +405,7 @@ def temp_cwd(name='tempcwd', quiet=False):
the CWD, an error is raised. If it's True, only a warning is raised
the CWD, an error is raised. If it's True, only a warning is raised
and the original CWD is used.
and the original CWD is used.
"""
"""
if
isinstance
(
name
,
unicode
):
if
have_unicode
and
isinstance
(
name
,
unicode
):
try
:
try
:
name
=
name
.
encode
(
sys
.
getfilesystemencoding
()
or
'ascii'
)
name
=
name
.
encode
(
sys
.
getfilesystemencoding
()
or
'ascii'
)
except
UnicodeEncodeError
:
except
UnicodeEncodeError
:
...
...
Lib/textwrap.py
View file @
ed11a5d0
...
@@ -9,6 +9,14 @@ __revision__ = "$Id$"
...
@@ -9,6 +9,14 @@ __revision__ = "$Id$"
import
string
,
re
import
string
,
re
try
:
_unicode
=
unicode
except
NameError
:
# If Python is built without Unicode support, the unicode type
# will not exist. Fake one.
class
_unicode
(
object
):
pass
# Do the right thing with boolean values for all known Python versions
# Do the right thing with boolean values for all known Python versions
# (so this module can be copied to projects that don't depend on Python
# (so this module can be copied to projects that don't depend on Python
# 2.3, e.g. Optik and Docutils) by uncommenting the block of code below.
# 2.3, e.g. Optik and Docutils) by uncommenting the block of code below.
...
@@ -147,7 +155,7 @@ class TextWrapper:
...
@@ -147,7 +155,7 @@ class TextWrapper:
if self.replace_whitespace:
if self.replace_whitespace:
if isinstance(text, str):
if isinstance(text, str):
text = text.translate(self.whitespace_trans)
text = text.translate(self.whitespace_trans)
elif isinstance(text, unicode):
elif isinstance(text,
_
unicode):
text = text.translate(self.unicode_whitespace_trans)
text = text.translate(self.unicode_whitespace_trans)
return text
return text
...
@@ -167,7 +175,7 @@ class TextWrapper:
...
@@ -167,7 +175,7 @@ class TextWrapper:
'use', ' ', 'the', ' ', '-b', ' ', option!'
'use', ' ', 'the', ' ', '-b', ' ', option!'
otherwise.
otherwise.
"""
"""
if isinstance(text, unicode):
if isinstance(text,
_
unicode):
if self.break_on_hyphens:
if self.break_on_hyphens:
pat = self.wordsep_re_uni
pat = self.wordsep_re_uni
else:
else:
...
...
Lib/unittest/case.py
View file @
ed11a5d0
...
@@ -202,7 +202,11 @@ class TestCase(object):
...
@@ -202,7 +202,11 @@ class TestCase(object):
self
.
addTypeEqualityFunc
(
tuple
,
'assertTupleEqual'
)
self
.
addTypeEqualityFunc
(
tuple
,
'assertTupleEqual'
)
self
.
addTypeEqualityFunc
(
set
,
'assertSetEqual'
)
self
.
addTypeEqualityFunc
(
set
,
'assertSetEqual'
)
self
.
addTypeEqualityFunc
(
frozenset
,
'assertSetEqual'
)
self
.
addTypeEqualityFunc
(
frozenset
,
'assertSetEqual'
)
try
:
self
.
addTypeEqualityFunc
(
unicode
,
'assertMultiLineEqual'
)
self
.
addTypeEqualityFunc
(
unicode
,
'assertMultiLineEqual'
)
except
NameError
:
# No unicode support in this build
pass
def
addTypeEqualityFunc
(
self
,
typeobj
,
function
):
def
addTypeEqualityFunc
(
self
,
typeobj
,
function
):
"""Add a type specific assertEqual style function to compare a type.
"""Add a type specific assertEqual style function to compare a type.
...
...
Misc/ACKS
View file @
ed11a5d0
...
@@ -839,6 +839,7 @@ Arfrever Frehtes Taifersar Arahesis
...
@@ -839,6 +839,7 @@ Arfrever Frehtes Taifersar Arahesis
Geoff Talvola
Geoff Talvola
William Tanksley
William Tanksley
Christian Tanzer
Christian Tanzer
Stefano Taschini
Steven Taschuk
Steven Taschuk
Monty Taylor
Monty Taylor
Amy Taylor
Amy Taylor
...
...
Misc/NEWS
View file @
ed11a5d0
...
@@ -191,6 +191,9 @@ Tests
...
@@ -191,6 +191,9 @@ Tests
Build
Build
-----
-----
-
Issue
#
8767
:
Restore
building
with
--
disable
-
unicode
.
Patch
by
Stefano
Taschini
.
-
Build
against
bzip2
1.0.6
and
openssl
0.9.8
x
on
Windows
.
-
Build
against
bzip2
1.0.6
and
openssl
0.9.8
x
on
Windows
.
-
Issue
#
14557
:
Fix
extensions
build
on
HP
-
UX
.
Patch
by
Adi
Roiban
.
-
Issue
#
14557
:
Fix
extensions
build
on
HP
-
UX
.
Patch
by
Adi
Roiban
.
...
...
Objects/object.c
View file @
ed11a5d0
...
@@ -2111,8 +2111,10 @@ _Py_ReadyTypes(void)
...
@@ -2111,8 +2111,10 @@ _Py_ReadyTypes(void)
if
(
PyType_Ready
(
&
PySet_Type
)
<
0
)
if
(
PyType_Ready
(
&
PySet_Type
)
<
0
)
Py_FatalError
(
"Can't initialize set type"
);
Py_FatalError
(
"Can't initialize set type"
);
#ifdef Py_USING_UNICODE
if
(
PyType_Ready
(
&
PyUnicode_Type
)
<
0
)
if
(
PyType_Ready
(
&
PyUnicode_Type
)
<
0
)
Py_FatalError
(
"Can't initialize unicode type"
);
Py_FatalError
(
"Can't initialize unicode type"
);
#endif
if
(
PyType_Ready
(
&
PySlice_Type
)
<
0
)
if
(
PyType_Ready
(
&
PySlice_Type
)
<
0
)
Py_FatalError
(
"Can't initialize slice type"
);
Py_FatalError
(
"Can't initialize slice type"
);
...
...
Python/bltinmodule.c
View file @
ed11a5d0
...
@@ -1578,6 +1578,7 @@ builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -1578,6 +1578,7 @@ builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
Py_CLEAR
(
str_newline
);
Py_CLEAR
(
str_newline
);
return
NULL
;
return
NULL
;
}
}
#ifdef Py_USING_UNICODE
unicode_newline
=
PyUnicode_FromString
(
"
\n
"
);
unicode_newline
=
PyUnicode_FromString
(
"
\n
"
);
if
(
unicode_newline
==
NULL
)
{
if
(
unicode_newline
==
NULL
)
{
Py_CLEAR
(
str_newline
);
Py_CLEAR
(
str_newline
);
...
@@ -1591,6 +1592,7 @@ builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -1591,6 +1592,7 @@ builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
Py_CLEAR
(
unicode_space
);
Py_CLEAR
(
unicode_space
);
return
NULL
;
return
NULL
;
}
}
#endif
}
}
if
(
!
PyArg_ParseTupleAndKeywords
(
dummy_args
,
kwds
,
"|OOO:print"
,
if
(
!
PyArg_ParseTupleAndKeywords
(
dummy_args
,
kwds
,
"|OOO:print"
,
kwlist
,
&
sep
,
&
end
,
&
file
))
kwlist
,
&
sep
,
&
end
,
&
file
))
...
...
Python/peephole.c
View file @
ed11a5d0
...
@@ -135,6 +135,7 @@ fold_binops_on_constants(unsigned char *codestr, PyObject *consts)
...
@@ -135,6 +135,7 @@ fold_binops_on_constants(unsigned char *codestr, PyObject *consts)
will return a surrogate. In both the cases skip the
will return a surrogate. In both the cases skip the
optimization in order to produce compatible pycs.
optimization in order to produce compatible pycs.
*/
*/
#ifdef Py_USING_UNICODE
if
(
newconst
!=
NULL
&&
if
(
newconst
!=
NULL
&&
PyUnicode_Check
(
v
)
&&
PyUnicode_Check
(
newconst
))
{
PyUnicode_Check
(
v
)
&&
PyUnicode_Check
(
newconst
))
{
Py_UNICODE
ch
=
PyUnicode_AS_UNICODE
(
newconst
)[
0
];
Py_UNICODE
ch
=
PyUnicode_AS_UNICODE
(
newconst
)[
0
];
...
@@ -147,6 +148,7 @@ fold_binops_on_constants(unsigned char *codestr, PyObject *consts)
...
@@ -147,6 +148,7 @@ fold_binops_on_constants(unsigned char *codestr, PyObject *consts)
return
0
;
return
0
;
}
}
}
}
#endif
break
;
break
;
case
BINARY_LSHIFT
:
case
BINARY_LSHIFT
:
newconst
=
PyNumber_Lshift
(
v
,
w
);
newconst
=
PyNumber_Lshift
(
v
,
w
);
...
...
configure
View file @
ed11a5d0
...
@@ -12522,6 +12522,7 @@ ucs4) unicode_size="4"
...
@@ -12522,6 +12522,7 @@ ucs4) unicode_size="4"
$as_echo
"#define Py_UNICODE_SIZE 4"
>>
confdefs.h
$as_echo
"#define Py_UNICODE_SIZE 4"
>>
confdefs.h
;;
;;
no
)
;;
# To allow --disable-unicode
*
)
as_fn_error
$?
"invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase)."
"
$LINENO
"
5
;;
*
)
as_fn_error
$?
"invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase)."
"
$LINENO
"
5
;;
esac
esac
...
...
configure.ac
View file @
ed11a5d0
...
@@ -3776,6 +3776,7 @@ ucs2) unicode_size="2"
...
@@ -3776,6 +3776,7 @@ ucs2) unicode_size="2"
ucs4) unicode_size="4"
ucs4) unicode_size="4"
AC_DEFINE(Py_UNICODE_SIZE,4)
AC_DEFINE(Py_UNICODE_SIZE,4)
;;
;;
no) ;; # To allow --disable-unicode
*) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
*) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
esac
esac
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment