[Python-Dev] [Python-checkins] r42490 - in python/branches/release24-maint: Lib/fileinput.py Lib/test/test_fileinput.py Misc/NEWS
M.-A. Lemburg
mal at egenix.com
Sun Feb 19 11:56:28 CET 2006
Why are these new features being backported to 2.4 ?
georg.brandl wrote:
> Author: georg.brandl
> Date: Sun Feb 19 10:51:33 2006
> New Revision: 42490
>
> Modified:
> python/branches/release24-maint/Lib/fileinput.py
> python/branches/release24-maint/Lib/test/test_fileinput.py
> python/branches/release24-maint/Misc/NEWS
> Log:
> Patch #1337756: fileinput now accepts Unicode filenames.
>
>
> Modified: python/branches/release24-maint/Lib/fileinput.py
> ==============================================================================
> --- python/branches/release24-maint/Lib/fileinput.py (original)
> +++ python/branches/release24-maint/Lib/fileinput.py Sun Feb 19 10:51:33 2006
> @@ -184,7 +184,7 @@
> """
>
> def __init__(self, files=None, inplace=0, backup="", bufsize=0):
> - if type(files) == type(''):
> + if isinstance(files, basestring):
> files = (files,)
> else:
> if files is None:
>
> Modified: python/branches/release24-maint/Lib/test/test_fileinput.py
> ==============================================================================
> --- python/branches/release24-maint/Lib/test/test_fileinput.py (original)
> +++ python/branches/release24-maint/Lib/test/test_fileinput.py Sun Feb 19 10:51:33 2006
> @@ -157,3 +157,13 @@
> verify(fi.lineno() == 6)
> finally:
> remove_tempfiles(t1, t2)
> +
> +if verbose:
> + print "15. Unicode filenames"
> +try:
> + t1 = writeTmp(1, ["A\nB"])
> + fi = FileInput(files=unicode(t1, sys.getfilesystemencoding()))
> + lines = list(fi)
> + verify(lines == ["A\n", "B"])
> +finally:
> + remove_tempfiles(t1)
>
> Modified: python/branches/release24-maint/Misc/NEWS
> ==============================================================================
> --- python/branches/release24-maint/Misc/NEWS (original)
> +++ python/branches/release24-maint/Misc/NEWS Sun Feb 19 10:51:33 2006
> @@ -74,6 +74,8 @@
> Library
> -------
>
> +- Patch #1337756: fileinput now accepts Unicode filenames.
> +
> - Patch #1373643: The chunk module can now read chunks larger than
> two gigabytes.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Feb 19 2006)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the Python-Dev
mailing list