Martin Panter | 2 Sep 03:26 2014

[issue1508475] transparent gzip compression in urllib


Martin Panter added the comment:

I think the patch is indeed a bit short, for instannce it looks like calling read() without a size limit could
bypass the decoding.

Also, I wonder if Content-Encoding handling is better done at a higher level. What if someone wants to
download a *.tar.gz file? They may not expect the tar file to be transparently decompressed. And I suspect
this would blow up if you tried a partial range request.

Transfer-Encoding is meant to be the proper way to transparently compress HTTP messages at a low level, but
it doesn’t seem to be used as much in the real world.

----------

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue1508475>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

STINNER Victor | 2 Sep 00:39 2014

[issue22324] Use PyUnicode_AsWideCharString() instead of PyUnicode_AsUnicode()


New submission from STINNER Victor:

I would like to deprecate PyUnicode_AsUnicode(), see the issue #22271 for the rationale (hint: memory footprint).

To deprecate PyUnicode_AsUnicode(), we should stop using it internally.

The attached patch is a work-in-progress patch, untested on Windows (only tested on Linux). It gives an
idea of how many files should be modified.

TODO:

* Modify posixmodule.c: I don't understand how the Argument Clinic generates the call to
PyUnicode_AsUnicode() when the parameter type is declared as "unicode". What is the "unicode" type?
Where is the code generating the call to PyUnicode_AsUnicode()?

* Modify a few other files.

----------
files: wchar.patch
keywords: patch
messages: 226247
nosy: haypo, loewis
priority: normal
severity: normal
status: open
title: Use PyUnicode_AsWideCharString() instead of PyUnicode_AsUnicode()
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file36522/wchar.patch
(Continue reading)

STINNER Victor | 1 Sep 23:32 2014

[issue22323] Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString()


New submission from STINNER Victor:

I would like to deprecate PyUnicode_AsUnicode(), see the issue #22271 for the rationale (hint: memory
footprint). The first step is to rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString() to
not call PyUnicode_AsUnicode() anymore.

Attached patch implements this.

The code is based on PyUnicode_AsUnicode(), but it's more tricky because PyUnicode_AsWideChar() can
truncate the string, and PyUnicode_AsUnicode() does no copy characters if kind == sizeof(wchar_t),
PyASCIIObject.wstr "just" points to data.

I hate PyUnicode_AsWideChar(), but we must keep it for backward compatibility :-)

It would be possible to write an optimized PyUnicode_AsWideCharString() which computes the length,
allocate memory and write wide characters, but I don't want to have 3 functions converting a Python string
to a wide character string. There are already PyUnicode_AsUnicodeAndSize() and unicode_aswidechar()
(+ unicode_aswidechar_len()).

----------
messages: 226244
nosy: haypo, loewis
priority: normal
severity: normal
status: open
title: Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString()
type: enhancement
versions: Python 3.5

(Continue reading)

Peter Wu | 1 Sep 17:11 2014

[issue22322] Zip files created by `git archive` result in a SyntaxError (due to comment?)


New submission from Peter Wu:

Files created by `git archive` are not understood by the Python interpreter. This could be caused by the
additional comment (for the commit hash) in the file.

echo 'print(1)' > __main__.py
git init && git add __main__.py && git commit -m init
git archive --format=zip HEAD > y.zip
python y.zip

Packing it with `zip x.zip __main__.py && python x.zip` works.

----------
components: Extension Modules
messages: 226230
nosy: lekensteyn
priority: normal
severity: normal
status: open
title: Zip files created by `git archive` result in a SyntaxError (due to comment?)
type: behavior
versions: Python 2.7, Python 3.4

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22322>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
(Continue reading)

Dima Tisnek | 1 Sep 12:03 2014

[issue22321] odd result for datetime.time.strftime("%s")


New submission from Dima Tisnek:

$ python2 -c 'import datetime; print datetime.time(10, 44, 11).strftime("%s")'
-2208955189

$ python3 -c 'import datetime; print (datetime.time(10, 44, 11).strftime("%s"))'
-2208955189

So apparently, datetime.time(...).strftime("%s") semantically "seconds since unix epoch" assumes
Jan 1, 1900 for missing date part.

However datetime module doesn't allow subtracting time objects, i.e. no assumption of date is made, where
"same date" chould be reasonable.

----------
components: Extension Modules
messages: 226224
nosy: Dima.Tisnek
priority: normal
severity: normal
status: open
title: odd result for datetime.time.strftime("%s")
type: behavior
versions: Python 2.7, Python 3.4

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22321>
_______________________________________
(Continue reading)

Hideaki Muranami | 1 Sep 03:47 2014

[issue22320] Invalid link in General Python FAQ


New submission from Hideaki Muranami:

Link of "Developer FAQ" on
https://docs.python.org/3.4/faq/general.html#how-do-i-obtain-a-copy-of-the-python-source
is invalid.

----------
assignee: docs <at> python
components: Documentation
messages: 226199
nosy: docs <at> python, mnamihdk
priority: normal
severity: normal
status: open
title: Invalid link in General Python FAQ
versions: Python 3.4

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22320>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

Tim Chase | 1 Sep 02:44 2014

[issue22319] mailbox.MH chokes on directories without .mh_sequences


New submission from Tim Chase:

If a mailbox.MH() object is created by pointing at a path that exists but doesn't contain a ".mh_sequences"
file, it raises an exception upon iteration over .{iter,}items() rather than gracefully assuming that
the file is empty.  I encountered this by pointing it at a Claws Mail IMAP-cache folder (which claims to
store its messages in MH format¹ but it doesn't place a .mh_sequences file in those folders) only to have
it raise an exception.

To replicate:
$ mkdir empty
$ python
>>> import mailbox
>>> for msg in mailbox.MH('empty').values(): pass

I suspect this could simply wrap the "f = open(os.path.join(self._path, '.mh_sequences'), 'r')" and
following lines in a check to ignore the file if it doesn't exist (returning the empty "results").

¹ http://www.claws-mail.org/faq/index.php/General_Information#How_does_Claws_Mail_store_mails.3F

----------
components: Library (Lib)
messages: 226197
nosy: gumnos
priority: normal
severity: normal
status: open
title: mailbox.MH chokes on directories without .mh_sequences
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2
(Continue reading)

Tony Flury | 31 Aug 23:55 2014

[issue22318] unitest documentation on assertItemsEqual misleading


New submission from Tony Flury:

The notes on assertItemsEqual do not make it clear that the comparison works by using their hash value, and
not their __eq__ implementation - i.e. it does an 'is' not an '==' between objects in the sequence.

If the sequences being compared contain user created objects which don't implement their own specific
__hash__ method (and therefore inherit their __hash__ from the base object - based on the object id), then
the assertion will ALWAYS be false, regardless of their __eq__ value.

This only became clear when trying to use unitest, getting strange results, and I eventually read the code.

----------
assignee: docs <at> python
components: Documentation
messages: 226193
nosy: TonyFlury, docs <at> python
priority: normal
severity: normal
status: open
title: unitest documentation on assertItemsEqual misleading
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22318>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
(Continue reading)

Ubik | 31 Aug 22:39 2014

[issue22317] action argument is not documented in argparse add_subparser() docs


New submission from Ubik:

See: https://docs.python.org/2/library/argparse.html#argparse.ArgumentParser.add_subparsers

----------
assignee: docs <at> python
components: Documentation
messages: 226190
nosy: Ubik, docs <at> python
priority: normal
severity: normal
status: open
title: action argument is not documented in argparse add_subparser() docs
versions: Python 2.7

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22317>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

Anthony Mayer | 31 Aug 18:02 2014

[issue22316] Add rule about "extraneous whitespace around colon" to "Whitespace In Expressions and Statements" of PEP8


New submission from Anthony Mayer:

After discussion about extraneous whitespace around colons in a list slice not being an error on the pep8
checker project (see https://github.com/jcrocholl/pep8/issues/321#issuecomment-53649841),
ncoghlan suggested filing a ticket here to get the issue added to PEP8. The issue being that PEP8 doesn't
say that

x = [1, 2, 3, 4]
x[1: 3]

is wrong. It should suggest doing

x = [1, 2, 3, 4]
x[1:3]

instead. This rule should probably be added to the "Whitespace In Expressions and Statements" section of
PEP8 (http://legacy.python.org/dev/peps/pep-0008/#whitespace-in-expressions-and-statements)

----------
assignee: docs <at> python
components: Documentation
messages: 226185
nosy: Guido.van.Rossum, anthonymayer, barry, docs <at> python, ncoghlan
priority: normal
severity: normal
status: open
title: Add rule about "extraneous whitespace around colon" to "Whitespace In Expressions and
Statements" of PEP8

(Continue reading)

Jason R. Coombs | 31 Aug 17:15 2014

[issue22315] TypeError in error handling in distutils.dir_util.copy_tree


New submission from Jason R. Coombs:

This morning, I was running an install of a package on Python 3.4.1 when I encountered this error:

C:\Users\jaraco\projects\jaraco.financial [default tip]> ./setup install
running install
running bdist_egg
running egg_info
writing namespace_packages to jaraco.financial.egg-info\namespace_packages.txt
writing jaraco.financial.egg-info\PKG-INFO
writing top-level names to jaraco.financial.egg-info\top_level.txt
writing requirements to jaraco.financial.egg-info\requires.txt
writing dependency_links to jaraco.financial.egg-info\dependency_links.txt
writing entry points to jaraco.financial.egg-info\entry_points.txt
writing manifest file 'jaraco.financial.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
copying jaraco\financial\records.py -> build\lib\jaraco\financial
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\jaraco
creating build\bdist.win-amd64\egg\jaraco\financial
copying build\lib\jaraco\financial\ledger.py -> build\bdist.win-amd64\egg\jaraco\financial
copying build\lib\jaraco\financial\qif.py -> build\bdist.win-amd64\egg\jaraco\financial
copying build\lib\jaraco\financial\merchant.py -> build\bdist.win-amd64\egg\jaraco\financial
Traceback (most recent call last):
  File "C:\Program Files\Python34\lib\distutils\dir_util.py", line 126, in copy_tree
    names = os.listdir(src)
OSError: [WinError 59] An unexpected network error occurred: 'build\\lib\\jaraco\\financial\\records.py'
(Continue reading)


Gmane