[issue22464] Speed up fractions implementation

2014-09-23 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22464
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22457] load_tests not invoked in root __init__.py when start=package root

2014-09-23 Thread Robert Collins

Robert Collins added the comment:

This should fix this issue :)

--
keywords: +patch
Added file: http://bugs.python.org/file36694/issue22457.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22457
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22468] Tarfile using fstat on GZip file object

2014-09-23 Thread Bart Olsthoorn

New submission from Bart Olsthoorn:

CPython tarfile `gettarinfo` method uses fstat to determine the size of a file 
(using its fileobject). When that file object is actually created with 
Gzip.open (so a GZipfile), it will get the compressed size of the file. The 
addfile method will then continue to read the uncompressed data of the gzipped 
file, but will read too few bytes, resulting in a tar of incomplete files.

I suggest checking the file object class before using fstat to determine the 
size, and raise a warning if it's a gzip file.

To clarify, this only happens when adding a GZip file object to tar. I know 
that it's not a really common scenario, and the problem is really that GZip 
file size can only properly be determined by uncompressing and reading it 
entirely, but I think it's nice to not fail without warning.

So this is an example that is failing:
```
import tarfile
c = io.BytesIO()
with tarfile.open(mode='w', fileobj=c) as tar:
  for textfile in ['1.txt.gz', '2.txt.gz']:
with gzip.open(textfile) as f:
  tarinfo = tar.gettarinfo(fileobj=f)
  tar.addfile(tarinfo=tarinfo, fileobj=f)
  data = c.getvalue()
return data
```

Instead this reads the proper filesize and writes the files to a tar:
```
import tarfile
c = io.BytesIO()
with tarfile.open(mode='w', fileobj=c) as tar:
  for textfile in ['1.txt.gz', '2.txt.gz']:
with gzip.open(textfile) as f:
  buff = f.read()
  tarinfo = tarfile.TarInfo(name=f.name)
  tarinfo.size = len(buff)
  tar.addfile(tarinfo=tarinfo, fileobj=io.BytesIO(buff))
  data = c.getvalue()
return data
```

--
messages: 227328
nosy: bartolsthoorn
priority: normal
severity: normal
status: open
title: Tarfile using fstat on GZip file object
type: behavior
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22468
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Stefan Champailler

Stefan Champailler added the comment:

I don't know if this is 100% related, but here I go. Here's a session in a 
windows console (cmd.exe) :

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\stcchcp 65001
Active code page: 65001

C:\Users\stc\PORT-STCA2\opt\python3\python
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit 
(Intel)] on win32
Type help, copyright, credits or license for more information.
 print '€'


C:\Users\stc

So basically, the python interpreters just quits without any message. Windows 
doesn't comply about python crashing though...

Best regards,

Stefan

--
nosy: +wiz21

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Stefan Champailler

Stefan Champailler added the comment:

In my previous comment, I've shown :

print '€'

which is not valid python 3.4.1 (don't why the interpreter didn't complaing 
though). So I tested again with missing parenthesis added :

C:\PORT-STCA2\pl-PRIVATE\horsechcp 65001
Active code page: 65001

C:\PORT-STCA2\pl-PRIVATE\horsepython
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit 
(Intel)] on win32
Type help, copyright, credits or license for more information.
 print(€)


C:\PORT-STCA2\pl-PRIVATE\horseecho %PROCESSOR_IDENTIFIER%
Intel64 Family 6 Model 42 Stepping 7, GenuineIntel

Exactly the same behaviour.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16662] load_tests not invoked in package/__init__.py

2014-09-23 Thread Robert Collins

Robert Collins added the comment:

I've managed to get a windows setup working. Its my mini-vfs which needs to be 
Windows aware (because the abs path of /foo is C:\\foo). I'll work up a patch 
tomorrowish.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16662
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

Drekin, it would be good to be able to incorporate some of your improvements 
for Python 3.5. Before we could do that, we'd need to review and agree to the 
PSF Contributor Agreement at https://www.python.org/psf/contrib/contrib-form/

The underlying licensing situation for CPython is a little messy (albeit in a 
way that doesn't impact users or redistributors), so we use the contributor 
agreement to ensure we continue to have the right to distribute Python under 
its current license without making the history any messier, and to preserve the 
option of switching to a simpler standard license at some point in the future 
(if it ever becomes feasible to do so).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Drekin

Drekin added the comment:

Stefan Champailler:

The crash you see is maybe not a crash at all. First it has nothing to do with 
printing, the problem is reading of your input line. That explains why Python 
exited even before printing the traceback of the SyntaxError. If you try to 
read input using `sys.stdin.buffer.raw.read(100)` and type Unicode characters, 
it returns just empty bytes `b''`. So maybe Python REPL then thinks the input 
just ended and so standardly exits the interpreter.

Why are you using chcp 65001? As far as I know, it doesn't give you the ability 
to use Unicode in the console. It somehow helps with printing, but there are 
some issues. `print(\N{euro sign})` prints the right character, but it prints 
additional blank line. `sys.stdout.write(\N{euro sign})` and 
`sys.stdout.buffer.write(\N{euro sign}.encode(cp65001))` does the same, but 
`sys.stdout.buffer.raw.write(\N{euro sign}.encode(cp65001))` works as 
expected.

If you want to enter and display Unicode in Python on Windows console, try my 
package `win_unicode_console`, which tries to solve the issues. See 
https://pypi.python.org/pypi/win_unicode_console.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22166] test_codecs leaks references

2014-09-23 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
assignee:  - ncoghlan

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22166
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

Updated issue title to reflect current proposal.

--
title: Add tools for cleaning surrogate escaped strings - Add 
codecs.convert_surrogateescape to clean surrogate escaped strings

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9951] introduce bytes.hex method (also for bytearray and memoryview)

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

Updated issue title to indicate proposal also covers bytearray and memoryview.

--
title: introduce bytes.hex method - introduce bytes.hex method (also for 
bytearray and memoryview)

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9951
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22264] Add wsgiref.util.dump_wsgistr load_wsgistr

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

Updated issue title to reflect current proposal

--
title: Add wsgiref.util helpers for dealing with WSGI strings - Add 
wsgiref.util.dump_wsgistr  load_wsgistr

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22264
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Drekin

Drekin added the comment:

Nick Coghlan: Ok, done.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

Drekin: thanks! That should get processed by the PSF Secretary before too long, 
and the * to indicate you have signed it will appear by your name.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Don't like the function name :-)

How about codecs.filter_non_utf8_data(), since that's closer
to what the function is really doing and doesn't require
knowledge about what surrogateescape is.

--
nosy: +lemburg

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

The error handler is called surrogateescape. That means 
convert_surrogateescape is always only a single step away from thinking I 
want to remove the smuggled bytes from a surrogateescape'd string, without 
needing to assume any knowledge on the part of the user other than the name of 
the error handler and the fact that it is used to smuggle arbitrary bytes 
through the Python 3 str type.

Getting from this string was decoded with the surrogateescape handler and may 
contain smuggled bytes to filter_non_utf8_data as the relevant cleanup 
function is a much bigger leap that requires more assumed knowledge on the part 
of the user, and also one that confuses the conceptual purpose of the function 
(cleaning up the output of the surrogateescape error handler to ensure it is a 
pure Unicode string) with the internal details of the proposed approach to 
implementing that cleanup operation (encoding to UTF-8 with surrogateescape, 
and then decoding again with a different error handler).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

The function definition again, this time with a draft docstring:

def convert_surrogateescape(data, errors='replace'):
Convert escaped raw bytes by applying a different error handler

Uses the replace error handler by default, but any input
error handler may be specified.

return data.encode('utf-8', 'surrogateescape').decode('utf-8', errors)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

Note I would also be OK with convert_surrogates, as that's the term that 
appears in the relevant error message:

 b'\xe9'.decode('ascii', 'surrogateescape').encode()
Traceback (most recent call last):
  File stdin, line 1, in module
UnicodeEncodeError: 'utf-8' codec can't encode character '\udce9' in position 
0: surrogates not allowed

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 23/09/2014 12:57, Nick Coghlan a écrit :
 The function definition again, this time with a draft docstring:
 
 def convert_surrogateescape(data, errors='replace'):
 Convert escaped raw bytes by applying a different error handler
 
 Uses the replace error handler by default, but any input
 error handler may be specified.
 
 return data.encode('utf-8', 'surrogateescape').decode('utf-8', errors)

'utf-8' is hardcoded?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

Draft docstring for that version

def convert_surrogates(data, errors='replace'):
Convert escaped surrogates by applying a different error handler

Uses the replace error handler by default, but any input
error handler may be specified.

return data.encode('utf-8', 'surrogateescape').decode('utf-8', errors)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

Antoine: what would be the use case for using a different encoding for the 
temporary bytes object? It's discarded anyway, so the encoding used isn't 
externally visible.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The encoding used impacts the result:

 s = 'abc\udcc3\udca9'
 s.encode('ascii', 'surrogateescape').decode('ascii', 'replace')
'abc��'
 s.encode('utf-8', 'surrogateescape').decode('utf-8', 'replace')
'abcé'

The original string ('abc\udcc3\udca9') was obtained by decoding a valid utf-8 
string with the 'ascii' codec and the 'surrogateescape' error handler.

If anything, the default encoding should probably be 
sys.getfilesystemencoding().

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Stefan Champailler

Stefan Champailler added the comment:

Dear Drekin,

 The crash you see is maybe not a crash at all. First it has nothing 
 to do with printing, the problem is reading of your input line. 

I guessed that, but thanks for pointing out.

 So maybe Python REPL then thinks the input just ended and so standardly exits 
 the interpreter.

Yes. I have showed that because the line of code seemed perfectly valid and 
innocuous (I moved to Python3 because I *need* good unicode/encodings support). 
The answer from the REPL is, to me, very suprising. I would have expected a 
badly displayed character at least and a syntax error at worst. I consider 
myself quite aware of unicode issues but without any output from the repl, I'd 
have very hard times figuring out what went wrong, hence my bug report.

So even though this might not qualify as the worse bug in Python, I'd say it is 
actually quite misleading. But see no complaint here, I'm very happy with 
Python in general. It's just that I thought I had to tell it to the dev team.

 Why are you using chcp 65001? 

I thought it'd help me with printing unicode (I tried CP437 but problem is the 
EURO sign is not there, and I *do* need eurosign :-)). But I'll readily admit I 
didn't read all the stuff about encoing issues on Windows console before trying.

try my package `win_unicode_console`, which tries to solve the issues. 

I'll certainly do that.

Thank you for your answer

Stefan

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9951] introduce bytes.hex method (also for bytearray and memoryview)

2014-09-23 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9951
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22385] Define a binary output formatting mini-language for *.hex()

2014-09-23 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22385
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5550] [urllib.request]: Comparison of HTTP headers should be insensitive to the case

2014-09-23 Thread karl

karl added the comment:

Ok this is an attempt at solving the issue with lowercase. I find my get_header 
a bit complicated, but if you have a better idea. :) I'll modify the patches.

I have try to run the tests on the mac here but I have an issue currently.

→ ./python.exe -V
Python 3.5.0a0

Traceback (most recent call last):
  File ./Tools/scripts/patchcheck.py, line 6, in module
import subprocess
  File /Users/karl/code/cpython/Lib/subprocess.py, line 353, in module
import signal
ImportError: No module named 'signal'
make: *** [patchcheck] Error 1

--
Added file: http://bugs.python.org/file36695/issue-5550-3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5550
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22469] Allow the backslashreplace error handler support decoding

2014-09-23 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch allows the backslashreplace error handler to be used not only 
in encoding, but in decoding and translating.

--
components: Extension Modules
files: backslashreplace_decode.patch
keywords: patch
messages: 227349
nosy: doerwalter, lemburg, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Allow the backslashreplace error handler support decoding
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file36696/backslashreplace_decode.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22469
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12006] strptime should implement %V or %u directive from libc

2014-09-23 Thread Erik Cederstrand

Erik Cederstrand added the comment:

Well, it's an ambiguous situation, as established earlier. I'm not sure what 
the policy is wrt. foot-shooting, but I'd opt to fail if %G, %V and %u are not 
used together.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12006
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22469] Allow the backslashreplace error handler support decoding

2014-09-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh sorry, there is already opened issue22469.

--
resolution:  - duplicate
stage: patch review - resolved
status: open - closed
superseder:  - Allow the backslashreplace error handler support decoding

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22469
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22286] Allow backslashreplace error handler to be used on input

2014-09-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch.

--
components: +Extension Modules
keywords: +patch
nosy: +serhiy.storchaka
stage: needs patch - patch review
Added file: http://bugs.python.org/file36697/backslashreplace_decode.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22286
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22469] Allow the backslashreplace error handler support decoding

2014-09-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
superseder: Allow the backslashreplace error handler support decoding - 
Allow backslashreplace error handler to be used on input

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22469
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5550] [urllib.request]: Comparison of HTTP headers should be insensitive to the case

2014-09-23 Thread karl

Changes by karl karl+pythonb...@la-grange.net:


Removed file: http://bugs.python.org/file36695/issue-5550-3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5550
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5550] [urllib.request]: Comparison of HTTP headers should be insensitive to the case

2014-09-23 Thread karl

karl added the comment:

And I had to do a typo in patch3. Submitting patch4. Sorry about that.

--
Added file: http://bugs.python.org/file36698/issue-5550-4.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5550
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Mark Hammond

Mark Hammond added the comment:

 The crash you see is maybe not a crash at all.

I'd call it a crash - the repl shouldn't exit.  But it's not necessarily part 
of *this* bug.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22396] AIX posix_fadvise and posix_fallocate

2014-09-23 Thread David Edelsohn

David Edelsohn added the comment:

Attached is a revised patch that disables posix_fadvise() and posix_fallocate() 
when building on 32 bit AIX with _LARGE_FILES defined.

--
Added file: http://bugs.python.org/file36699/22396_aix.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22396
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22396] AIX posix_fadvise and posix_fallocate

2014-09-23 Thread STINNER Victor

STINNER Victor added the comment:

 Attached is a revised patch that disables posix_fadvise() and 
 posix_fallocate() when building on 32 bit AIX with _LARGE_FILES defined.

Good. You should add a reference to this issue, something like Issue #22396: 


To avoid code duplication, you may write something like:

/* Issue #22396: AIX currently does not support a 32-bit 
   call to posix_fallocate() if _LARGE_FILES is defined. */
#if defined(HAVE_POSIX_FALLOCATE)  !(defined(_AIX)  defined(_LARGE_FILES) 
 !defined(__64BIT__))
#  undef HAVE_POSIX_FALLOCATE
#endif

or #define BROKEN_POSIX_FALLOCATE.

Which Python versions should be patched? 3.4 and 3.5? Python 2.7 doesn't have 
the function (introduced in Python 3.3). For Python 3.4, it means that between 
two Python minor versions, the function disappears on AIX 32-bit :-/ Is it a 
problem since the function didn't work on this platform? (always fail with 
EINVAL)

I suggest to patch 3.4 and 3.5.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22396
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22396] AIX posix_fadvise and posix_fallocate

2014-09-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think that some time AIX bug will be fixed. May be it would be better to 
introduce special macros, and set it in the configure script (similar to 
HAVE_GLIBC_MEMMOVE_BUG or HAVE_IPA_PURE_CONST_BUG). Or may be just udefine 
HAVE_POSIX_FADVISE at such circumstances.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22396
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22396] AIX posix_fadvise and posix_fallocate

2014-09-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Or can we simply keep the function and skip the test?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22396
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22396] AIX posix_fadvise and posix_fallocate

2014-09-23 Thread David Edelsohn

David Edelsohn added the comment:

The declaration of the two system calls should be fixed in the AIX header, but 
the clueless response to the AIX problem report is underwhelming.

I don't understand the keep the function and skip the test suggestion.  I 
thought that was my first patch -- catch the exception of invalid argument and 
allow it to fail on AIX.  If AIX eventually is fixed, the test will pass, no 
harm, no foul.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22396
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1446619] extended slice behavior inconsistent with docs

2014-09-23 Thread Fumihiro Bessho

Fumihiro Bessho added the comment:

I also wondered the same thing today and found this issue.

I've added my comment on the patch to make the change more precise. Can anyone 
move it ahead and update the document?

--
nosy: +bessho

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1446619
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2014-09-23 Thread karl

karl added the comment:

Just a follow up for giving the stable version of the now new RFC version for 
HTTP 1.1

HTTP header field names parsing
http://tools.ietf.org/html/rfc7230#section-3.2.4

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17322
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 23.09.2014 13:12, Nick Coghlan wrote:
 
 Nick Coghlan added the comment:
 
 Draft docstring for that version
 
 def convert_surrogates(data, errors='replace'):
 Convert escaped surrogates by applying a different error handler
 
 Uses the replace error handler by default, but any input
 error handler may be specified.
 
 return data.encode('utf-8', 'surrogateescape').decode('utf-8', errors)

Nick, the doc string is not correct. It is not working on escaped
surrogates. Instead it is working on lone surrogates that were used
to encode undecodable bytes from some input data.

The longer story goes like this:

The surrogateescape error handler in the .decode() call that lead up
to the data you want this function to take as input, will convert
undecodable data to lone low surrogates.

The function then reverts these bytes back into UTF-8 (which may well
not be the original encoding, as Antoine has already pointed out, but
that's not really important for the use case), recreating the
unencodable bytes and then decodes the result again using the UTF-8
codec using a new error handler.

So in summary, the function is supposed to retroactively apply
a different error handler to the input data, undoing the effects
of the surrogateescapes error handler.

The name still doesn't match this functionality.

BTW: There's a catch in the approach. The encoding used to decode
the original data may well be 'ascii'. Now, if the original input
data was in fact UTF-8, the input decoding would have mapped the
UTF-8 code points to lone surrogates. The above function would then
turn these back into UTF-8, redecode and get a completely different
string back (since the error handlers would not trigger).

I'm not sure whether adding such a small function with so many
unclear implications is a good idea. Either it should be
made more specific, e.g. be reserved for use on data from input
streams with known encoding, or be put into the documentation as
example for people to use and adapt as necessary.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19746] No introspective way to detect ModuleImportFailure in unittest

2014-09-23 Thread R. David Murray

R. David Murray added the comment:

Oh, ok, if the existing glue does it that way, then it seems fine.  I thought 
when I read the code that it was holding a reference to the traceback until it 
raised the error in the synthetic test.  Or do you mean that when exceptions 
are raised by tests it is the string that is captured not the exception?  That 
would make sense.  So, yeah, I guess capturing the string makes sense, to be 
consistent with the rest of the reporting.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19746
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread R. David Murray

R. David Murray added the comment:

And indeed my use case for this has instances of both cases: originally decoded 
using ASCII and the non-ascii bytes must end up as replaced characters, and 
originally decoded using utf-8.

I'm also not sure that it is worth adding this.  If you know what you are doing 
the solution is obvious, and if you don't know what you are doing you shouldn't 
be using surrogateescape in the first place :)

Now, if there were or there is intended to be a more efficient C level 
implementation, that answer might be different.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread R. David Murray

R. David Murray added the comment:

Oh, wait, I forgot that the context for this was dealing with unix filenames 
and/or stdio.  So, a function that just uses the fsencoding to do the replace 
might indeed be appropriate, but in that case should probably live in the os 
module.  os.convert_surrogates?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22467] Lib/http/server.py, inconsistent header casing

2014-09-23 Thread R. David Murray

R. David Murray added the comment:

It also has a leading underscore, which means it is a private interface and 
you use it at your own risk.

To the extent that there is an actionable issue here, it is a duplicate of 
issue 12455.  email.message already provides case insensitive header retrieval, 
by the way.

--
nosy: +r.david.murray
resolution:  - duplicate
stage:  - resolved
status: open - closed
superseder:  - urllib2 forces title() on header names, breaking some requests

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22467
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add a convert_surrogates function to clean surrogate escaped strings

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

As RDM noted, avoiding the use of surrogateescape isn't feasible when we do it 
by default on all OS interfaces (including the standard streams when we detect 
'ascii' as the filesystem encoding in 3.5+).

This *needs* to be a case that folks can handle without needing to spend years 
learning about encodings and error handlers first. That means being able to 
tell them use this documented function to remove the surrogates rather than 
use this magic incantation that you don't understand, and that other people 
may not be able to read.

I know more about Unicode encodings than the average programmer at this point, 
yet I still needed to be schooled by true experts in this thread to learn how 
to solve the problem properly.

Look at this as an opportunity to encapsulate that knowledge in executable 
form, as while the code is short, it is conceptually *very* dense.

If there's a dedicated function, then replacing the encode/decode dance with a 
faster pure C alternative also becomes a future possibility (with only a 
recipe, there's no opportunity to ever optimise it).

With the additional clarification, it is also clear to me that Antoine is 
correct that the encoding needs to be configurable and should default to the 
appropriate setting to remove the surrogates from OS provided data.

With that change:

def convert_surrogates(data, encoding=None, errors='replace'):
Convert escaped surrogates by applying a different error handler

If no encoding is given, defaults to sys.getfilesystemencoding()
Uses the replace error handler by default, but any input
error handler may be specified.

if encoding is None:
encoding = sys.getfilesystemencoding()
return data.encode(encoding, 'surrogateescape').decode(encoding, errors)

Since it's primarily intended for cleaning OS provided data, then I agree 
os.convert_surrogates() could be a good choice. It would be appropriate to 
reference it from os.fsdecode() as a way to clean escaped data when the 
original binary data was no longer available to be decoded again with a 
different error handler.

--
title: Add codecs.convert_surrogateescape to clean surrogate escaped strings 
- Add a convert_surrogates function to clean surrogate escaped strings

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Good catch Antoine!

Here is a sample of more complicated implementation.

--
title: Add a convert_surrogates function to clean surrogate escaped strings 
- Add codecs.convert_surrogateescape to clean surrogate escaped strings
Added file: http://bugs.python.org/file36700/convert_surrogates.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___import codecs
import re

def convert_surrogates(data, errors='strict'):
handler = None
p = re.compile('[\ud800-\uefff]+')
pos = 0
res = []
while True:
m = p.search(data, pos)
if m:
if handler is None:
handler = codecs.lookup_error(errors)
res.append(data[pos: m.start()])
repl, pos = handler(UnicodeTranslateError(data, m.start(), m.end(),
  'lone surrogates'))
res.append(repl)
elif pos:
res.append(data[pos:])
return ''.join(res)
else:
return data

def convert_surrogateescape(data, errors='strict'):
handler = None
p = re.compile('[\ud800-\uefff]+')
pos = 0
res = []
while True:
m = p.search(data, pos)
if m:
if handler is None:
handler = codecs.lookup_error(errors)
start = m.start()
res.append(data[pos: start])
try:
baddata = data[start: m.end()].encode('ascii', 
'surrogateescape')
except UnicodeEncodeError as err:
raise UnicodeTranslateError(data,
err.start + start,err.end + start,
r'surrogates not in range \ud880-\ud8ff') from None
try:
repl, pos = handler(UnicodeDecodeError('unicode', baddata,
   0, len(baddata),
   'lone surrogates'))
except UnicodeDecodeError as err:
raise UnicodeTranslateError(data,
err.start + start,
err.end + start,
err.reason) from None
pos += start
res.append(repl)
elif pos:
res.append(data[pos:])
return ''.join(res)
else:
return data
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2014-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

Ah, Serhiy's approach of avoiding the encode/decode dance entirely is an even 
better idea - replacing the lone surrogates directly with the output of the 
alternative error handler avoids any need to worry about the original encoding.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18814
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22286] Allow backslashreplace error handler to be used on input

2014-09-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
dependencies: +Possible integer overflow in error handlers

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22286
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22470] Possible integer overflow in error handlers

2014-09-23 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

There are potential integer overflows in error handlers. Here is simple patch 
which fixes them.

--
assignee: serhiy.storchaka
components: Extension Modules
files: codecs_error_hadlers_overflow.patch
keywords: patch
messages: 227370
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Possible integer overflow in error handlers
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36701/codecs_error_hadlers_overflow.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22470
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22455] idna/punycode give wrong results on narrow builds

2014-09-23 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22455
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22466] problem with installing python 2.7.8

2014-09-23 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +steve.dower, zach.ware

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22466
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22468] Tarfile using fstat on GZip file object

2014-09-23 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +lars.gustaebel

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22468
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22466] problem with installing python 2.7.8

2014-09-23 Thread Steve Dower

Steve Dower added the comment:

Can you try running this command and then post the log file after installation 
fails:

 msiexec /l*vx log.txt /i path to .MSI

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22466
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21866] zipfile.ZipFile.close() doesn't respect allowZip64

2014-09-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8a010ca89094 by Serhiy Storchaka in branch '2.7':
Issue #21866: ZipFile.close() no longer writes ZIP64 central directory
https://hg.python.org/cpython/rev/8a010ca89094

New changeset 8f25d118ce38 by Serhiy Storchaka in branch '3.4':
Issue #21866: ZipFile.close() no longer writes ZIP64 central directory
https://hg.python.org/cpython/rev/8f25d118ce38

New changeset d361d2176121 by Serhiy Storchaka in branch 'default':
Issue #21866: ZipFile.close() no longer writes ZIP64 central directory
https://hg.python.org/cpython/rev/d361d2176121

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21866
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Stefan, the Idle Shell handles the BMP subset of Unicode quite well.

 print('€')
€


It is superior to the Windows console in other ways too.  For instance, cut and 
paste work normally as for other Windows windows.

(cp65001 is know to be buggy and essentially useless. Check the results in any 
search engine.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Drekin

Drekin added the comment:

Idle shell handles Unicode characters well, but one cannot enter them using 
deadkey combinations. See http://bugs.python.org/issue22408.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22467] Lib/http/server.py, inconsistent header casing

2014-09-23 Thread DS6

DS6 added the comment:

Whoa, I thought  - no selection -  would not change the set values, but I 
guess I was wrong. I have no idea what I'm doing, sorry.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22467
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22467] Lib/http/server.py, inconsistent header casing

2014-09-23 Thread DS6

DS6 added the comment:

Yeah, I was aware it's used for getting the request headers. It's strange that 
it's not used for setting reply headers, though the casing really doesn't cause 
any problems for the current implementation and really only affects fringe 
cases like mine and that fellow in issue #12455.
I suppose it would simply be wiser to rewrite my own code a bit instead of 
relying on private fields, since I am actually extending with my own classes 
instead of wholly relying on the std libs.

I appreciate the post, David, I was not aware this issue had been brought up 
before; I did actually search for related issues but I guess I didn't see that 
one.

Whoa, I thought  - no selection -  would not change the set values, but I 
guess I was wrong.
...And apparently duplicate messages are pruned.
I have no idea what I'm doing, sorry.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22467
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22467] Lib/http/server.py, inconsistent header casing

2014-09-23 Thread DS6

DS6 added the comment:

Oh... It showed that the message had been created but it really hadn't, because 
I had the Status field set to  - no selection -  so now I've posted two 
(three) times.

Good lord I am sickeningly bad at this. I'll just stop posting now.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22467
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22471] Python build problems via Homebrew on Mac OS X when GNU core/find utils are default

2014-09-23 Thread Todd Thomas

New submission from Todd Thomas:

Installing Python via Homebrew on Mac OS X has build issues if the GNU 
core/find utils are set as defaults on the system. OS X is very common, on it 
Homebrew is very common, via Homebrew GNU utilities are among the first 
installations; EG:
http://goo.gl/OodjHI

GNU core/find utils are likely the most common tools use on POSIX systems but 
Mac wants to keep rolling with UNIX tools. The Makefile is flexible. If it 
discovers the rm program in: /usr/local/opt/coreutils/libexec/gnubin/rm (where 
Homebrew would install it) the build 'could' break.


Testing is ad hoc but seen by many and confirmed as likely by ned_deily; he 
adds: that particular problem is simple to fix: just change the Makefile to 
/usr/bin/rm.

This is the work-around for now.

Props to ned_deily; this is an old/annoying problem, now solved.

--
assignee: ronaldoussoren
components: Macintosh
messages: 227379
nosy: ronaldoussoren, todd_dsm
priority: normal
severity: normal
status: open
title: Python build problems via Homebrew on Mac OS X when GNU core/find utils 
are default
type: compile error
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22471
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22408] Tkinter doesn't handle Unicode key events on Windows

2014-09-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The term 'dead key' is new to me. I found this: 
https://en.wikipedia.org/wiki/Dead_key . 'AltGr' is also new: 
https://en.wikipedia.org/wiki/AltGr_key .  It apparently is a 'modifier' key, 
not a 'dead key'. Standard non-Mac US keyboards apparently have neither, so I 
cannot experiment or test.

Drekin, does your last comment mean that the title should be modified?

--
nosy: +serhiy.storchaka, terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22408
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20912] [zipfile.py]: Make zip directory attributes more friendly for MS-Windows

2014-09-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c6b884483cd6 by Serhiy Storchaka in branch '2.7':
Issue #20912: Now directories added to ZIP file have correct Unix and MS-DOS
https://hg.python.org/cpython/rev/c6b884483cd6

New changeset b06e25a357de by Serhiy Storchaka in branch '3.4':
Issue #20912: Now directories added to ZIP file have correct Unix and MS-DOS
https://hg.python.org/cpython/rev/b06e25a357de

New changeset 051105a95461 by Serhiy Storchaka in branch 'default':
Issue #20912: Now directories added to ZIP file have correct Unix and MS-DOS
https://hg.python.org/cpython/rev/051105a95461

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20912
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22467] Lib/http/server.py, inconsistent header casing

2014-09-23 Thread R. David Murray

R. David Murray added the comment:

Don't worry about it :)  The roundup UI isn't terrible, but it is far from 
perfect.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22467
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22471] Python build problems via Homebrew on Mac OS X when GNU core/find utils are default

2014-09-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5444c2e22ff8 by Ned Deily in branch '2.7':
Issue #22471: Avoid Python Launcher.app install problems by removing
https://hg.python.org/cpython/rev/5444c2e22ff8

New changeset ff2cb4dc36e7 by Ned Deily in branch '3.4':
Issue #22471: Avoid Python Launcher.app install problems by removing
https://hg.python.org/cpython/rev/ff2cb4dc36e7

New changeset 9c9980c3c38c by Ned Deily in branch 'default':
Issue #22471: Avoid Python Launcher.app install problems by removing
https://hg.python.org/cpython/rev/9c9980c3c38c

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22471
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22471] Python build problems via Homebrew on Mac OS X when GNU core/find utils are default

2014-09-23 Thread Ned Deily

Ned Deily added the comment:

Thanks for the report!  On further inspection, the whole rm thing isn't needed 
anymore with Python no longer maintained in svn.  Fixed for release in 2.7.9, 
3.4.3, and 3.5.0.

--
assignee: ronaldoussoren - ned.deily
components: +Build
nosy: +ned.deily
resolution:  - fixed
stage:  - resolved
status: open - closed
versions: +Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22471
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22408] Tkinter doesn't handle Unicode key events on Windows

2014-09-23 Thread Ned Deily

Ned Deily added the comment:

Just to avoid any confusion, Apple-supplied Mac keyboards don't have an AltGr 
key.  It is found on certain PC keyboard layouts and, as such, could be used on 
any platform (Windows, OS X, or other Unix).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22408
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22362] Warn about octal escapes 0o377 in re

2014-09-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3b32f495fb38 by Serhiy Storchaka in branch 'default':
Issue #22362: Forbidden ambiguous octal escapes out of range 0-0o377 in
https://hg.python.org/cpython/rev/3b32f495fb38

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22362
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22362] Warn about octal escapes 0o377 in re

2014-09-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Antoine and Victor for the review.

--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22362
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22408] Tkinter doesn't handle Unicode dead key combinations on Windows

2014-09-23 Thread Drekin

Drekin added the comment:

By modifier I mean a key like Shift, Ctrl, Alt, AltGr; or the corresponding 
modifier state. A combination modifier + base key produces either special 
action or a character or a dead key. A dead key affects the next character 
rather than producing a character itself. Dead keys can be even chained, i.e. a 
sequence [previous dead key, modifier + base key] can produce another dead key. 
(Aside: This feature has been present on Windows for long time, but is used 
very rarely and applications are buggy. I spent some time designing my Unicode 
keyboard layout using chained dead keys to produce various mathematical 
symbols. Then I found out than some applications have problems with the feature 
– including Firefox. It's basically because they try to implement the 
interpretation of keyboard layout by themselves rather then using standard 
Windows implementation through API.)

For example standard Czech keyboard use the AltGr key and the corresponing 
state to produce characters like $, #, , @, {, }, [, ], because the top row is 
used for common diacritical combinations and its Shift state for numbers. I 
understand that English doesn't need many characters and so the layout usually 
doesn't need AltGr or dead keys. But I think even English keyboard should be 
able to type characters like English quotes, N-dash, or ellipsis: “, ”, –, ….

I have also changed the title.

--
title: Tkinter doesn't handle Unicode key events on Windows - Tkinter doesn't 
handle Unicode dead key combinations on Windows

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22408
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22472] OSErrors should use str and not repr on paths

2014-09-23 Thread R. David Murray

New submission from R. David Murray:

 open(r'c:\bad\path')
Traceback (most recent call last):
  File stdin, line 1, in module
FileNotFoundError: [Errno 2] No such file or directory: 'c:\\bad\\path'

--
components: Windows
messages: 227389
nosy: r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: OSErrors should use str and not repr on paths
versions: Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22472
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20912] [zipfile.py]: Make zip directory attributes more friendly for MS-Windows

2014-09-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20912
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21866] zipfile.ZipFile.close() doesn't respect allowZip64

2014-09-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21866
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22133] IDLE: Set correct WM_CLASS on X11

2014-09-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch which sets WM_CLASS of all long-lived toplevel windows.

--
Added file: http://bugs.python.org/file36702/idle_wm_class.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22133
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22472] OSErrors should use str and not repr on paths

2014-09-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

File names can contain special characters such as spaces or even newlines. 
str() can be ambiguous. I prefer always use repr() for file names or other user 
data.

--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22472
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22408] Tkinter doesn't handle Unicode dead key combinations on Windows

2014-09-23 Thread Ned Deily

Ned Deily added the comment:

I guess it still comes down to whether this is an issue in tkinter or in Tk 
itself.  Almost all character processing and event generation is done in Tk.  
One way to isolate the issue would be to use text widgets in the Tk wish shell 
and its demo programs.  They should be available in the ActiveState ActiveTcl 
distribution.  (I'm assuming that the Python Windows installer does not include 
wish but I don't know that for a fact.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22408
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6639] turtle: _tkinter.TclError: invalid command name .10170160

2014-09-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Any feedback?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6639
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22427] TemporaryDirectory attempts to clean up twice

2014-09-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22427
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22472] OSErrors should use str and not repr on paths

2014-09-23 Thread R. David Murray

R. David Murray added the comment:

I realized that after I hit submit.

However, this is a real problem on windows: I can't pass the error message back 
to the UI (in this case the log file) without first munging it, because the 
string is not a correct representation of the filename and the user will think 
they've entered the filename wrong to begin with (this is what really happened 
and what resulting this bug getting filed).

On windows, if I understand correctly, we don't normally have the problem of 
non-unicode filenames, so could we use str on windows only?

--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22472
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22464] Speed up fractions implementation

2014-09-23 Thread Stefan Behnel

Stefan Behnel added the comment:

This simple Cython variant of gcd() is substantially faster for me (you may 
consider it pseudo-code for a C implementation):

def _gcd(a, b):
# Try doing all computation in C space.  If the numbers are too large
# at the beginning, retry until they are small enough.
cdef long long ai, bi
while b:
try:
ai, bi = a, b
except OverflowError:
pass
else:
# switch to C loop
while bi:
ai, bi = bi, ai%bi
return ai
a, b = b, a%b
return a

It tries to drop the two numbers into C long-long-ints as soon as possible, and 
only runs the calculation in Python space until they are small enough to fit. 
In most cases, this will be either right from the start or fairly quickly after 
only a few iterations.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22464
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7511] msvc9compiler.py: ValueError when trying to compile with VC Express

2014-09-23 Thread Paul Moore

Paul Moore added the comment:

From the comments here, there seems to be a belief that this is somehow 
related to VC Express only.

I have hit this error when using the MS SDK (both 7.0 on Python 2.7, and 7.1 on 
Python 3.3 and 3.4) with DISTUTILS_USE_SDK set.

Unless I have somehow misconfigured my installation, this bug prevents me from 
having any means of building Python extensions using free tools for 64-bit 
Windows. It is possible I have misconfigured something, as I am working from 
various notes on the web, plus trial and error, because there is no official 
documentation I have found on how to set up the SDK for use with distutils in 
this manner.

--
nosy: +pmoore

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7511
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22473] The gloss on asyncio future with run_forever example is confusing

2014-09-23 Thread R. David Murray

New submission from R. David Murray:

In 
https://docs.python.org/3/library/asyncio-task.html#example-future-with-run-forever
 we have the sentence

  In this example, the future is responsible to display the result and to stop 
the loop.

We could dune up the English by rewriting it:

  In this example, the future is responsible for displaying the result and 
stopping the loop.

But that isn't quite true.  It is the callback associated with the future that 
is displaying the result and stopping the loop.  So, perhaps the correct gloss 
is:

  In this example, the got_result callback is responsible for displaying the 
result and stopping the loop.

--
assignee: docs@python
components: Documentation
messages: 227398
nosy: docs@python, r.david.murray
priority: normal
severity: normal
status: open
title: The gloss on asyncio future with run_forever example is confusing
type: behavior
versions: Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22473
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22466] problem with installing python 2.7.8

2014-09-23 Thread Steve Dower

Steve Dower added the comment:

You almost certainly have a corrupted download. I'd try downloading the 
installer again, perhaps with a different browser?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22466
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22474] No explanation of how a task gets destroyed in asyncio 'task' documentation

2014-09-23 Thread R. David Murray

New submission from R. David Murray:

In https://docs.python.org/3/library/asyncio-task.html#task, there is a note 
about a warning being logged if a pending task is destroyed.  The section does 
not explain or link to an explanation of how a task might get destroyed.  Nor 
does it define pending, but that seems reasonably clear from context (ie: the 
future has not completed).

The example linked to does not show how the pending task got destroyed, it only 
shows an example of the resulting logging, with not enough information to 
really understand what the final line of the error message is reporting (is 
kill_me an asyncio API, or the name of the task, or the future it is wrapping?)

--
assignee: docs@python
components: Documentation
messages: 227400
nosy: docs@python, r.david.murray
priority: normal
severity: normal
status: open
title: No explanation of how a task gets destroyed in asyncio 'task' 
documentation
type: behavior
versions: Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22474
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22475] asyncio task get_stack documentation seems to contradict itself

2014-09-23 Thread R. David Murray

New submission from R. David Murray:

The get_stack method docs say:

If the coroutine is active, returns the stack where it was suspended.

I presume this means something more like if the coroutine is not done..., 
since in English you can't be both active *and* suspended.  Or does it mean 
last suspended?

Then it talks about limit and how stacks limit returns newest frames while with 
tracebacks it is oldest frames...but the last sentence says that for suspended 
coroutines only one frame is returned.

So there is a definite lack of clarity here: can we get multiple frames if the 
coroutine is not suspended (in which case that first sentence seems likely to 
be the 'last suspended' interpretation), or for non-tracebacks can we only ever 
get one frame, in which case why talk about limit returning the newest frames 
for stacks?

--
assignee: docs@python
components: Documentation
messages: 227401
nosy: docs@python, r.david.murray
priority: normal
severity: normal
status: open
title: asyncio task get_stack documentation seems to contradict itself
type: behavior
versions: Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22475
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22466] problem with installing python 2.7.8

2014-09-23 Thread Khalid

Khalid added the comment:

I tried downloading installer by firefox,chrome  explorer with latest
update but still the same problem. I'm getting mad about why I can't get an
error log

On Wed, Sep 24, 2014 at 2:50 AM, Steve Dower rep...@bugs.python.org wrote:


 Steve Dower added the comment:

 You almost certainly have a corrupted download. I'd try downloading the
 installer again, perhaps with a different browser?

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue22466
 ___


--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22466
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22433] Argparse considers unknown optional arguments with spaces as a known positional argument

2014-09-23 Thread paul j3

paul j3 added the comment:

I've added a patch with tests that I think handles this case, without messing 
with existing test cases.  It adds a new 'space' test right before the existing 
one, one that explicitly handles an '=' arg_string.  

If the space is in the 1st part, it is marked as a positional (as it does in 
the existing code).  But if the space is in the argument portion has no such 
effect; the arg_string will be handled as an unknown optional.

if '=' in arg_string:
option_prefix, explicit_arg = arg_string.split('=', 1)
if ' ' in option_prefix:
return None
else:
return None, arg_string, None

The new testcase is in the TestParseKnownArgs class (near the end of 
test_argparse.py), and tests the different ways in which an arg_string can be 
allocated to a positional or unknown.

The underlying idea is that elsewhere in '_parse_optional()', an arg_string 
with '=' is handled just like a two part optional.  It first tries an exact 
match, and then tries an abbreviation match.  In that spirit, this space test 
also focuses on the flag part of the arg_string, not the argument part.

Much as I like this solution, I still worry about backward compatibility.  As 
discussed in 'http://bugs.python.org/issue9334', 'argparse does not accept 
options taking arguments beginning with dash (regression from optparse)', 
compatibility in this _parse_optional() function is a serious issue.  There the 
proposed patch adds a switch to the API.  But an API change is itself messy, 
and not to be taken lightly if it isn't needed.

This patch has some comments that should be stripped out before it is actually 
applied.  There is a quite a backlog argparse issues, so I don't expect quick 
action here.

--
Added file: http://bugs.python.org/file36704/patch_1.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22433
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22466] problem with installing python 2.7.8

2014-09-23 Thread Khalid

Khalid added the comment:

I found a fix  this is the source
http://www.youtube.com/watch?v=KikshWVWhzg

but the question is did I make a security vulnerability?

On Wed, Sep 24, 2014 at 3:55 AM, Khalid rep...@bugs.python.org wrote:


 Khalid added the comment:

 I tried downloading installer by firefox,chrome  explorer with latest
 update but still the same problem. I'm getting mad about why I can't get an
 error log

 On Wed, Sep 24, 2014 at 2:50 AM, Steve Dower rep...@bugs.python.org
 wrote:

 
  Steve Dower added the comment:
 
  You almost certainly have a corrupted download. I'd try downloading the
  installer again, perhaps with a different browser?
 
  --
 
  ___
  Python tracker rep...@bugs.python.org
  http://bugs.python.org/issue22466
  ___
 

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue22466
 ___


--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22466
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22476] asyncio task chapter confusion about 'task', 'future', and 'schedule'

2014-09-23 Thread R. David Murray

New submission from R. David Murray:

Sorry for creating all these doc issues, but I'm reading these docs for the 
first time, and I figure it is good to capture my confusion now in the hopes 
that they can be clarified for other people's first readthroughs.

In the task chapter, we have Futures introduced.  (As an aside, it is 
interesting that the link to the concurrent.futures.Future docs start by saying 
you should never instantiate this class directly, but the asyncio examples 
show direct instantiation of a future, but this difference is not mentioned in 
the asyncio docs when discussing the differences between them).  We then see an 
example that appears to include scheduling a future via asyncio.async, because 
there is a specific mention of how we can attach a callback after it is 
scheduled but before the event loop is started.

Then tasks are introduced with the text:

  Schedule the execution of a coroutine: wrap it in a future.  A task is a 
subclass of Future.

Now, having read a bit more elsewhere in the docs, I see that a Future is 
scheduled by its creation, and the call to async on the future in the previous 
example is a NOOP.  But that is *not* the implication of the text (see below as 
well).  So, there are several points of dissonance here.  One is that the 
implication is we pass Task a coroutine and it *wraps* it in a Future.  But a 
Task *is* a Future.  So do we have a Future using another Future to wrap a 
coroutine, or what?  Another point of dissonance is that this phrasing implies 
that the *act* of wrapping the coroutine in a Future is what schedules it, yet 
when we introduced Future we apparently had to schedule it explicitly.  So I 
think there needs to be a mention of scheduling in the Future section.

But this then brings up the question of what exactly it is that Task does that 
differs from what a regular Future does, a question that is only partially 
answered by the documentation, because what 'scheduled' means for a regular 
Future isn't spelled out in the Future section.
  
Which I think means that what we really need is an overview document that puts 
all these concepts together into a conceptual framework, so that the 
documentation of the individual pieces makes sense.

As a followon point, the gloss on example of parallel execution of tasks says 
A task is automatically scheduled for execution when it is created.  The event 
loop stops when all tasks are done.  This reads very strangely to me.  The 
first sentence seems to be pointing out the difference between this example and 
the previous one with Future where we had to explicitly schedule it (by calling 
async which creates a task...).  But it seems that that isn't true...so why is 
that sentence there? The second sentence presumably refers to the fact that 
run_until_complete runs the event loop until all scheduled tasks are 
complete..because they are wrapped in 'wait'.  But wait is not cross referenced 
or mentioned in the gloss, so I had to think about it carefully and look up 
wait to conclude that that was what it meant.

Of course, I could be more confused than necessary because I started reading 
with the 'task' chapter, but I don't see an overview chapter in the doc tree.

--
assignee: docs@python
components: Documentation
messages: 227405
nosy: docs@python, r.david.murray
priority: normal
severity: normal
status: open
title: asyncio task chapter confusion about 'task', 'future', and 'schedule'
type: behavior
versions: Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22476
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com