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
7fb697b5
Commit
7fb697b5
authored
Apr 03, 2003
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert Patch #670715: iconv support.
parent
1e469c56
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
2 additions
and
892 deletions
+2
-892
Lib/encodings/__init__.py
Lib/encodings/__init__.py
+0
-5
Lib/encodings/iconv_codec.py
Lib/encodings/iconv_codec.py
+0
-34
Lib/test/regrtest.py
Lib/test/regrtest.py
+0
-4
Lib/test/test_iconv_codecs.py
Lib/test/test_iconv_codecs.py
+0
-99
Misc/NEWS
Misc/NEWS
+2
-5
Modules/Setup.dist
Modules/Setup.dist
+0
-4
Modules/_iconv_codec.c
Modules/_iconv_codec.c
+0
-723
setup.py
setup.py
+0
-18
No files found.
Lib/encodings/__init__.py
View file @
7fb697b5
...
...
@@ -121,8 +121,3 @@ def search_function(encoding):
# Register the search_function in the Python codec registry
codecs
.
register
(
search_function
)
# Register iconv_codec lookup function if available
try
:
import
iconv_codec
except
(
ImportError
,
RuntimeError
):
pass
Lib/encodings/iconv_codec.py
deleted
100644 → 0
View file @
1e469c56
""" Python 'iconv' Codec
Written by Hye-Shik Chang (perky@FreeBSD.org).
Copyright(c) Python Software Foundation, All Rights Reserved. NO WARRANTY.
"""
import
_iconv_codec
import
codecs
def
lookup
(
enc
):
class
IconvCodec
(
_iconv_codec
.
iconvcodec
,
codecs
.
Codec
):
encoding
=
enc
try
:
c
=
IconvCodec
()
class
IconvStreamReader
(
IconvCodec
,
codecs
.
StreamReader
):
__init__
=
codecs
.
StreamReader
.
__init__
class
IconvStreamWriter
(
IconvCodec
,
codecs
.
StreamWriter
):
__init__
=
codecs
.
StreamWriter
.
__init__
return
(
c
.
encode
,
c
.
decode
,
IconvStreamReader
,
IconvStreamWriter
)
except
ValueError
:
return
None
codecs
.
register
(
lookup
)
# ex: ts=8 sts=4 et
Lib/test/regrtest.py
View file @
7fb697b5
...
...
@@ -569,7 +569,6 @@ _expectations = {
test_gdbm
test_gl
test_grp
test_iconv_codecs
test_imgfile
test_ioctl
test_largefile
...
...
@@ -626,7 +625,6 @@ _expectations = {
test_fork1
test_gl
test_grp
test_iconv_codecs
test_ioctl
test_imgfile
test_largefile
...
...
@@ -774,7 +772,6 @@ _expectations = {
test_email_codecs
test_gdbm
test_gl
test_iconv_codecs
test_imgfile
test_largefile
test_linuxaudiodev
...
...
@@ -890,7 +887,6 @@ _expectations = {
test_dl
test_email_codecs
test_gl
test_iconv_codecs
test_imgfile
test_largefile
test_linuxaudiodev
...
...
Lib/test/test_iconv_codecs.py
deleted
100644 → 0
View file @
1e469c56
from
test
import
test_support
import
unittest
,
sys
import
codecs
,
_iconv_codec
from
encodings
import
iconv_codec
from
StringIO
import
StringIO
class
IconvCodecTest
(
unittest
.
TestCase
):
if
sys
.
byteorder
==
'big'
:
spam
=
'
\
x00
s
\
x00
p
\
x00
a
\
x00
m'
*
2
else
:
spam
=
's
\
x00
p
\
x00
a
\
x00
m
\
x00
'
*
2
def
test_sane
(
self
):
# FIXME: Commented out, because it's not clear whether
# the internal encoding choosen requires byte swapping
# for this iconv() implementation.
if
False
:
self
.
encoder
,
self
.
decoder
,
self
.
reader
,
self
.
writer
=
\
codecs
.
lookup
(
_iconv_codec
.
internal_encoding
)
self
.
assertEqual
(
self
.
decoder
(
self
.
spam
),
(
u'spamspam'
,
16
))
self
.
assertEqual
(
self
.
encoder
(
u'spamspam'
),
(
self
.
spam
,
8
))
self
.
assertEqual
(
self
.
reader
(
StringIO
(
self
.
spam
)).
read
(),
u'spamspam'
)
f
=
StringIO
()
self
.
writer
(
f
).
write
(
u'spamspam'
)
self
.
assertEqual
(
f
.
getvalue
(),
self
.
spam
)
def
test_basic_errors
(
self
):
self
.
encoder
,
self
.
decoder
,
self
.
reader
,
self
.
writer
=
\
iconv_codec
.
lookup
(
"ascii"
)
def
testencerror
(
errors
):
return
self
.
encoder
(
u'sp
\
ufffd
am'
,
errors
)
def
testdecerror
(
errors
):
return
self
.
decoder
(
'sp
\
xff
am'
,
errors
)
self
.
assertRaises
(
UnicodeEncodeError
,
testencerror
,
'strict'
)
self
.
assertRaises
(
UnicodeDecodeError
,
testdecerror
,
'strict'
)
self
.
assertEqual
(
testencerror
(
'replace'
),
(
'sp?am'
,
5
))
self
.
assertEqual
(
testdecerror
(
'replace'
),
(
u'sp
\
ufffd
am'
,
5
))
self
.
assertEqual
(
testencerror
(
'ignore'
),
(
'spam'
,
5
))
self
.
assertEqual
(
testdecerror
(
'ignore'
),
(
u'spam'
,
5
))
def
test_pep293_errors
(
self
):
self
.
encoder
,
self
.
decoder
,
self
.
reader
,
self
.
writer
=
\
iconv_codec
.
lookup
(
"ascii"
)
def
testencerror
(
errors
):
return
self
.
encoder
(
u'sp
\
ufffd
am'
,
errors
)
def
testdecerror
(
errors
):
return
self
.
decoder
(
'sp
\
xff
am'
,
errors
)
self
.
assertEqual
(
testencerror
(
'xmlcharrefreplace'
),
(
'sp�am'
,
5
))
self
.
assertEqual
(
testencerror
(
'backslashreplace'
),
(
'sp
\
\
ufffdam'
,
5
))
def
error_bomb
(
exc
):
return
(
u'*'
*
40
,
len
(
exc
.
object
))
def
error_mock
(
exc
):
error_mock
.
lastexc
=
exc
return
(
unicode
(
exc
.
object
[
exc
.
start
-
1
]),
exc
.
end
)
codecs
.
register_error
(
'test_iconv_codec.bomb'
,
error_bomb
)
codecs
.
register_error
(
'test_iconv_codec.mock'
,
error_mock
)
self
.
assertEqual
(
testencerror
(
'test_iconv_codec.bomb'
),
(
'sp'
+
(
'*'
*
40
),
5
))
self
.
assertEqual
(
testdecerror
(
'test_iconv_codec.bomb'
),
(
u'sp'
+
(
u'*'
*
40
),
5
))
self
.
assertEqual
(
testencerror
(
'test_iconv_codec.mock'
),
(
'sppam'
,
5
))
exc
=
error_mock
.
lastexc
self
.
assertEqual
(
exc
.
object
,
u'sp
\
ufffd
am'
)
self
.
assertEqual
(
exc
.
start
,
2
)
self
.
assertEqual
(
exc
.
end
,
3
)
self
.
assert_
(
isinstance
(
exc
,
UnicodeEncodeError
))
self
.
assertEqual
(
testdecerror
(
'test_iconv_codec.mock'
),
(
u'sppam'
,
5
))
exc
=
error_mock
.
lastexc
self
.
assertEqual
(
exc
.
object
,
'sp
\
xff
am'
)
self
.
assertEqual
(
exc
.
start
,
2
)
self
.
assertEqual
(
exc
.
end
,
3
)
self
.
assert_
(
isinstance
(
exc
,
UnicodeDecodeError
))
def
test_empty_escape_decode
(
self
):
self
.
encoder
,
self
.
decoder
,
self
.
reader
,
self
.
writer
=
\
iconv_codec
.
lookup
(
"ascii"
)
self
.
assertEquals
(
self
.
decoder
(
u""
),
(
""
,
0
))
self
.
assertEquals
(
self
.
encoder
(
""
),
(
u""
,
0
))
def
test_main
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
IconvCodecTest
))
test_support
.
run_suite
(
suite
)
if
__name__
==
"__main__"
:
test_main
()
# ex: ts=8 sts=4 et
Misc/NEWS
View file @
7fb697b5
...
...
@@ -41,6 +41,8 @@ Core and builtins
Extension modules
-----------------
- The iconv module has been removed from this release.
- The platform-independent routines for packing floats in IEEE formats
(struct.pack'
s
<
f
,
>
f
,
<
d
,
and
>
d
codes
;
pickle
and
cPickle
's protocol 1
pickling of floats) ignored that rounding can cause a carry to
...
...
@@ -105,8 +107,6 @@ TBD
Build
-----
- Fix build problems when _iconv_codec failed. (SF bug #690012.)
- Fix problem building on OSF1 because the compiler only accepted
preprocessor directives that start in column 1. (SF bug #691793.)
...
...
@@ -276,9 +276,6 @@ Extension modules
- The SSL module now handles sockets with a timeout set correctly (SF
patch #675750, fixing SF bug #675552).
- A new module _iconv_codec has been added, to expose the iconv(3)
library.
- os/posixmodule has grown the sysexits.h constants (EX_OK and friends).
- Fixed broken threadstate swap in readline that could cause fatal
...
...
Modules/Setup.dist
View file @
7fb697b5
...
...
@@ -478,10 +478,6 @@ GLHACK=-Dclear=__GLclear
#EXPAT_DIR=/usr/local/src/expat-1.95.2
#pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EXPAT_DIR)/lib -L$(EXPAT_DIR) -lexpat
# Wrapper for iconv(3). This requires either GNU iconv, or a native
# iconv implementation (only Linux, Solaris, and BSD are known to work)
#_iconv_codec _iconv_codec -I$(prefix)/include -L$(exec_prefix)/lib -liconv
# Example -- included for reference only:
# xx xxmodule.c
...
...
Modules/_iconv_codec.c
deleted
100644 → 0
View file @
1e469c56
This diff is collapsed.
Click to expand it.
setup.py
View file @
7fb697b5
...
...
@@ -622,24 +622,6 @@ class PyBuildExt(build_ext):
exts
.
append
(
Extension
(
'nis'
,
[
'nismodule.c'
],
libraries
=
libs
)
)
# Hye-Shik Chang's iconv_codec C interface
iconv_incs
=
find_file
(
'iconv.h'
,
inc_dirs
,
[
'/usr/local/include'
,
'/usr/pkg/include'
])
iconv_libs
=
find_library_file
(
self
.
compiler
,
'iconv'
,
lib_dirs
,
[
'/usr/local/lib'
,
'/usr/pkg/lib'
])
if
platform
not
in
[
'darwin'
]
and
iconv_incs
is
not
None
:
if
iconv_libs
is
not
None
:
iconv_libraries
=
[
'iconv'
]
else
:
iconv_libraries
=
[]
# in libc
exts
.
append
(
Extension
(
'_iconv_codec'
,
[
'_iconv_codec.c'
],
include_dirs
=
iconv_incs
,
library_dirs
=
iconv_libs
,
libraries
=
iconv_libraries
),
)
# Curses support, requring the System V version of curses, often
# provided by the ncurses library.
if
platform
==
'sunos4'
:
...
...
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