[issue18170] define built-in exceptions in Python code

2013-06-09 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I suppose you'd better hope that there are no errors loading said frozen 
module. :)

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue18167] cgi.FieldStorage fails to handle multipart/form-data when \r\n appears at end of 65535 bytes without other newlines

2013-06-09 Thread Florent Xicluna

Changes by Florent Xicluna :


--
nosy: +flox

___
Python tracker 

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



[issue18054] Add more exception related assertions to unittest

2013-06-09 Thread Nick Coghlan

Nick Coghlan added the comment:

I think something like "assertThat" could address the problem nicely. Probably 
best to propose it as a separate issue, then we can make this one depend on 
that one if we decide to go that way.

--

___
Python tracker 

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



[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread Pascal Garcia

New submission from Pascal Garcia:

The name of the user contains accents under windows.

This error occurs when using the function. expaduser("~")

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 10: 
ordinal not in range(128)

ascii is the default encoding as sys.getdefaultencoding()
If in site.py "I enable Enable the support locale" then de defaultencoding 
become cp1252 and the function works.

Expand user should use the encoding used by the system (may be 
locale.getdefaultlocale()) to decode path given by the system instead of the 
default encoding the should be the target encoding.

I do beleave some other functions may be concerned by this problem.
I detect the problem on Windows (WP and 7), but I do beleave the problem may 
happen on Linux also.

--
components: Library (Lib)
messages: 190850
nosy: plgarcia
priority: normal
severity: normal
status: open
title: os.path.expanduser does not use the system encoding
versions: Python 2.7

___
Python tracker 

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



[issue18172] New easter egg: insecure string pickle

2013-06-09 Thread flying sheep

New submission from flying sheep:

the second meaning of the error message “insecure string pickle” inspired at 
least two different people independently of drawing it.

i’d wish for a link to one of those pics in the docstring or message of the 
error.

picture: http://i.imgur.com/To3DQ6J.jpg
thread: 
http://www.reddit.com/r/Python/comments/1fymy0/i_got_a_funny_error_trying_to_open_a_file_and/

we’d have to host the pic ourselves since imgur isn’t guaranteed to retain the 
picture (although that’d need many consecutive months of no one following the 
link)

--
components: Library (Lib)
messages: 190851
nosy: flying sheep
priority: normal
severity: normal
status: open
title: New easter egg: insecure string pickle
type: enhancement
versions: Python 3.5

___
Python tracker 

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



[issue18106] There are unused variables in Lib/test/test_collections.py

2013-06-09 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Fixed the test based on Ezio Melotti's advice.

However, Ezio did not comment specifically about whether we should cut or keep 
this line.

self.assertEqual(list(dup.items()), list(od.items()))

After studying the OrderedDict source code, I came to conclusion that if 
"self.assertEqual(dup, od)" is true, so is "self.assertEqual(list(dup.items()), 
list(od.items()))".

But if "self.assertEqual(dup, od)" is false, so is 
"self.assertEqual(list(dup.items()), list(od.items()))".

This is how OrderedDict tests the equality:

def __eq__(self, other):
if isinstance(other, OrderedDict):
return dict.__eq__(self, other) and all(map(_eq, self, other))
return dict.__eq__(self, other)

So I think it should be safe to remove:

self.assertEqual(list(dup.items()), list(od.items()))

--
Added file: http://bugs.python.org/file30513/test_copying_trimmed.patch

___
Python tracker 

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



[issue18172] New easter egg: insecure string pickle

2013-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +alexandre.vassalotti, pitrou

___
Python tracker 

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



[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread R. David Murray

R. David Murray added the comment:

I could not reproduce this error on Linux with python2.7.

--
nosy: +haypo, r.david.murray

___
Python tracker 

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



[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread R. David Murray

R. David Murray added the comment:

Also, it would be helpful for you to show a full traceback, since there can be 
spurrious sources of unicode errors on Windows depending on how you execute 
your code.

--

___
Python tracker 

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



[issue18173] Add MixedTypeKey to reprlib

2013-06-09 Thread Nick Coghlan

New submission from Nick Coghlan:

Armin Ronacher pointed out that one downside of the removal of implicit 
cross-type comparisons in Python 3 is that it makes it harder to produce a 
stable repr for mixed-type containers.

This seems like a valid point to me, so I propose adding a suitable 
"MixedTypeKey" definition to reprlib. Passing "key=reprlib.MixedTypeKey" would 
then reproduce the old Python 2. sorting behaviour.

We can actually improve on the Python 2 approach by basing the fallback 
comparison on fully qualified type names rather than on the type id.

Proposed implementation (see https://gist.github.com/ncoghlan/5743523):

>>> class MixedTypeKey:
... """Sort key for mixed type lists in Python 3
... 
... >>> sorted([None, ..., 1, 1j, "", (), {}, []])
... Traceback (most recent call last):
...   File "", line 1, in 
... TypeError: unorderable types: ellipsis() < NoneType()
... >>> sorted([None, ..., 1, 1j, "", (), {}, []], key=MixedTypeKey)
... [None, Ellipsis, 1, 1j, '', (), {}, []]
... """
... def __init__(self, k):
... self._sort_key = k
... self._type_name = self._get_fully_qualified_name(k)
... def _get_fully_qualified_name(self, k):
... k_type = type(k)
... # Use __qualname__ if available, __name__ otherwise
... try:
... k_name = k_type.__qualname__
... except AttributeError:
... k_name = k_type.__name__
... return k_type.__module__ + "." + k_name
... def __lt__(self, other):
... # Try standard sorting first
... sort_key = self._sort_key
... try:
... other_sort_key = other._sort_key
... except AttributeError:
... other_sort_key = other
... try:
... return sort_key < other_sort_key
... except TypeError:
... pass
... # If that fails, sort by the fully qualified type names
... try:
... other_type_name = other._type_name
... except AttributeError:
... other_type_name = self._get_fully_qualified_name(other)
... return self._type_name < other_type_name
... 
>>> sorted([None, ..., 1, 1j, "", (), {}, []])
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unorderable types: ellipsis() < NoneType()
>>> sorted([None, ..., 1, 1j, "", (), {}, []], key=MixedTypeKey)
[None, 1j, {}, Ellipsis, 1, [], '', ()]
>>> MixedTypeKey(None) < ...
True

The stdlib version could omit the fallback to __name__ (since it doesn't need 
to cope with old versions of Python)

Support for other comparisons could theoretically be added, but I advise 
against it without a solid use case (sorting only needs __lt__).

--
components: Library (Lib)
messages: 190855
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Add MixedTypeKey to reprlib
type: enhancement
versions: Python 3.4

___
Python tracker 

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



[issue18038] Unhelpful error message on invalid encoding specification

2013-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 15aa786b723b by Serhiy Storchaka in branch '3.3':
Issue #18038: SyntaxError raised during compilation sources with illegal
http://hg.python.org/cpython/rev/15aa786b723b

New changeset 39e2f0059ee2 by Serhiy Storchaka in branch 'default':
Issue #18038: SyntaxError raised during compilation sources with illegal
http://hg.python.org/cpython/rev/39e2f0059ee2

New changeset 570b5b4040b1 by Serhiy Storchaka in branch '2.7':
Issue #18038: SyntaxError raised during compilation sources with illegal
http://hg.python.org/cpython/rev/570b5b4040b1

--
nosy: +python-dev

___
Python tracker 

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



[issue15239] Abandoned Tools/unicode/mkstringprep.py

2013-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8f95d77443da by Serhiy Storchaka in branch '3.3':
Issue #15239: Make mkstringprep.py work again on Python 3.
http://hg.python.org/cpython/rev/8f95d77443da

New changeset 4abe61a412be by Serhiy Storchaka in branch 'default':
Issue #15239: Make mkstringprep.py work again on Python 3.
http://hg.python.org/cpython/rev/4abe61a412be

--
nosy: +python-dev

___
Python tracker 

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



[issue18038] Unhelpful error message on invalid encoding specification

2013-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue15239] Abandoned Tools/unicode/mkstringprep.py

2013-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread Pascal Garcia

Pascal Garcia added the comment:

Here are 2 logs one with the default site.py forcing defaultencoding to ascii, 
and the other to utf8.
You can see that the home dir includes accents : Pépé Not an insult to anybody 
but this stupid computer :)

When I force using the locale.getdefaultlocale() as encoding then the function 
works, but, after having called expanduser, I need to make an explicit 
decode(locale.getdefaultlocale()), or else the string can not be used to build 
path to files.

==> with ASCII

C:\Users\pépé>D:\DevelopmentWorkspaces\SCOLASYNC\ScolaSyncNG\scolasync-ng\src\scolasync.py
Traceback (most recent call last):
  File 
"D:\DevelopmentWorkspaces\SCOLASYNC\ScolaSyncNG\scolasync-ng\src\scolasync.py", 
line 329, in 
run()
  File 
"D:\DevelopmentWorkspaces\SCOLASYNC\ScolaSyncNG\scolasync-ng\src\scolasync.py", 
line 206, in run
globaldef.initDefs(wd, force)
  File 
"D:\DevelopmentWorkspaces\SCOLASYNC\ScolaSyncNG\scolasync-ng\src\globaldef.py", 
line 80, in initDefs
wrkdir= os.path.expanduser(u"~"+os.sep)
  File "C:\Python27\lib\ntpath.py", line 301, in expanduser
return userhome + path[i:]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 10: 
ordinal not in range(128)

WITH UTF8 :
C:\Users\pépé>D:\DevelopmentWorkspaces\SCOLASYNC\ScolaSyncNG\scolasync-ng\src\scolasync.py
Traceback (most recent call last):
  File 
"D:\DevelopmentWorkspaces\SCOLASYNC\ScolaSyncNG\scolasync-ng\src\scolasync.py", 
line 329, in 
run()
  File 
"D:\DevelopmentWorkspaces\SCOLASYNC\ScolaSyncNG\scolasync-ng\src\scolasync.py", 
line 206, in run
globaldef.initDefs(wd, force)
  File 
"D:\DevelopmentWorkspaces\SCOLASYNC\ScolaSyncNG\scolasync-ng\src\globaldef.py", 
line 80, in initDefs
wrkdir= os.path.expanduser(u"~"+os.sep)
  File "C:\Python27\lib\ntpath.py", line 301, in expanduser
return userhome + path[i:]
  File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 10: invalid 
continuation byte

--

___
Python tracker 

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



[issue18143] ssl.get_default_verify_paths()

2013-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a4d31e56075d by Christian Heimes in branch 'default':
Issue #18143: Implement ssl.get_default_verify_paths() in order to debug
http://hg.python.org/cpython/rev/a4d31e56075d

--
nosy: +python-dev

___
Python tracker 

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



[issue14015] surrogateescape largely missing from documentation

2013-06-09 Thread A.M. Kuchling

A.M. Kuchling added the comment:

Here's a proposed patch that touches the Sphinx documentation and a docstring 
in codecs.py.  The text is slightly revised from my current revisions to the 
Unicode howto.

help(open) says "See the documentation for codecs.register for a list of the 
permitted encoding error strings".  This is strictly correct: the Sphinx 
documentation features this info.  But help(codecs.register) doesn't; it's more 
helpful to look at help(codecs.Codec).  

So maybe the docstring for open() should say: "See help(codecs.Codec) for a 
list of the permitted..." instead.

--
Added file: http://bugs.python.org/file30514/patch14015.txt

___
Python tracker 

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



[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread R. David Murray

R. David Murray added the comment:

On linux as well this fails:

  os.path.expanduser(u'~' + os.sep)

But this works:

  os.path.expanduser('~' + os.sep)

Counterintuitive, to say the least.  The reason is that the value of the HOME 
environment variable is read as a byte string, but when that byte string value 
is added to the unicode u'~/', unicode coercion attempts to decode the byte 
string as an ASCII string, which fails.

So, you must manipulate paths as byte strings in python2, decoding them 
yourself with the appropriate codec if needed.

This stuff is handled automatically in Python3, using the default encoding as 
you suggest (plus the surrogateescape error handler to handle unknown bytes on 
linux/unix).  Fixes for stuff like this is a large part of the purpose of 
Python3.  

So, in Python2 this is working as expected.

--
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-06-09 Thread Eli Bendersky

Eli Bendersky added the comment:

LGTM.

I suggest you wait for a couple of days to see if others have any critical 
comments and then commit.

--

___
Python tracker 

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



[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread Pascal Garcia

Pascal Garcia added the comment:

Sorry for this error.
Thanks for the solution.

Here is the code as I modify it.
wrkdir= os.path.expanduser("~"+os.sep)
loc = locale.getdefaultlocale()
if loc[1]:
encoding = loc[1]
wrkdir= wrkdir.decode(encoding)

I need to explicitally decode the string if I want to use it and have the next 
sentence working a bit further.
os.path.join(wrkdir, u"Tango\\")

Encodding is a very good motivation to go to python3, and if i didn't have 
other constraints it would be done for ages.

For this special case I think that function should return strings with the 
default encoding, and the programmer should not have to know about the 
underground to make the right decode.

But it works, thanks again.
Pascal

--
resolution: invalid -> 
status: closed -> open
type: behavior -> 

___
Python tracker 

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



[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread R. David Murray

Changes by R. David Murray :


--
resolution:  -> invalid
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue17134] Use Windows' certificate store for CA certs

2013-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 10d325f674f5 by Christian Heimes in branch 'default':
Issue #17134: Add ssl.enum_cert_store() as interface to Windows' cert store.
http://hg.python.org/cpython/rev/10d325f674f5

--
nosy: +python-dev

___
Python tracker 

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



[issue17134] Use Windows' certificate store for CA certs

2013-06-09 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> New changeset 10d325f674f5 by Christian Heimes in branch 'default':
> Issue #17134: Add ssl.enum_cert_store() as interface to Windows' cert store.
> http://hg.python.org/cpython/rev/10d325f674f5

I don't want to sound annoying, but I would have liked to review this 
before it goes in. Could it wait a few days? (I'm sure it can :-))

--

___
Python tracker 

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



[issue18101] Tk.split() doesn't work with nested Unicode strings

2013-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ezio, have you reviewed the main code?

--

___
Python tracker 

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



[issue16741] `int()`, `float()`, etc think python strings are null-terminated

2013-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Patch updated. It now reuses code for bytes->int in longobject.c and 
abstract.c, doesn't raise UnicodeDecodeError for non-utf-8 bytes, and always 
reports an invalid bytes literal as a bytes object.

--
Added file: http://bugs.python.org/file30515/int_from_str-3.3_2.patch

___
Python tracker 

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



[issue18101] Tk.split() doesn't work with nested Unicode strings

2013-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here are patches with updated tests as Ezio suggested.

--
Added file: 
http://bugs.python.org/file30516/tkinter_split_nested_unicode_2.patch

___
Python tracker 

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



[issue18101] Tk.split() doesn't work with nested Unicode strings

2013-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: 
http://bugs.python.org/file30517/tkinter_split_nested_unicode-2.7_2.patch

___
Python tracker 

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



[issue16102] uuid._netbios_getnode() is outdated

2013-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 27f55ff12f41 by Serhiy Storchaka in branch '3.3':
Issue #16102: Make uuid._netbios_getnode() work again on Python 3.
http://hg.python.org/cpython/rev/27f55ff12f41

New changeset 4a0017722910 by Serhiy Storchaka in branch 'default':
Issue #16102: Make uuid._netbios_getnode() work again on Python 3.
http://hg.python.org/cpython/rev/4a0017722910

--
nosy: +python-dev

___
Python tracker 

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



[issue16102] uuid._netbios_getnode() is outdated

2013-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: commit review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-06-09 Thread Zachary Ware

Zachary Ware added the comment:

enum.rst will need to be added to a table of contents page somewhere, I would 
guess possibly Development Tools (Doc/library/development.rst) or maybe Data 
Types (Doc/library/datatypes.rst).  I would trust almost anybody else's opinion 
over mine on where it should go, though :)

--

___
Python tracker 

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



[issue17944] Refactor test_zipfile

2013-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue18174] Make regrtest with --huntrleaks check for fd leaks

2013-06-09 Thread Richard Oudkerk

New submission from Richard Oudkerk:

regrtest already tests for refcount leaks and memory allocation leaks.  It can 
also be made to check for file descriptor leaks (and perhaps also handles on 
Windows).

Running with the attached patch makes it look like test_openpty, test_shutil, 
test_subprocess, test_uuid all leak fds on Linux, but I have not investigated:

$ ./python -m test.regrtest -R 3:3 test_openpty test_shutil test_subprocess 
test_uuid
[1/4] test_openpty
123456
..
test_openpty leaked [2, 2, 2] fds, sum=6
[2/4/1] test_shutil
beginning 6 repetitions
123456
..
test_shutil leaked [4, 4, 4] fds, sum=12
[3/4/2] test_subprocess
beginning 6 repetitions
123456
..
test_subprocess leaked [5, 5, 5] fds, sum=15
[4/4/3] test_uuid
beginning 6 repetitions
123456
..
test_uuid leaked [1, 1, 1] fds, sum=3
4 tests failed:
test_openpty test_shutil test_subprocess test_uuid

--
files: fdleak.patch
keywords: patch
messages: 190871
nosy: sbt
priority: normal
severity: normal
status: open
title: Make regrtest with --huntrleaks check for fd leaks
Added file: http://bugs.python.org/file30518/fdleak.patch

___
Python tracker 

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



[issue18138] ssl.SSLContext.add_cert()

2013-06-09 Thread Christian Heimes

Christian Heimes added the comment:

New patch:

* rename function to add_ca_cert()
* only accept CA certs, no other certs
* raise an error if extra data is found after cert (e.g. two certs). 
PEM_read_bio_X509() silently ignores extra data
* fixes from Ezio's code review
* documentation

--
nosy: +ezio.melotti, pitrou
Added file: http://bugs.python.org/file30519/sslctx_add_cert2.patch

___
Python tracker 

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



[issue17394] Add slicing support to collections.deque

2013-06-09 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The slicing support can be implemented using just rotates, appends, and pops.

--
assignee: rhettinger -> 
nosy: +serhiy.storchaka
priority: low -> normal
stage:  -> needs patch
type:  -> enhancement

___
Python tracker 

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



[issue18022] Inconsistency between quopri.decodestring() and email.quoprimime.decode()

2013-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There are other inconsistencies. email.quoprimime.decode(), binascii.a2b_qp() 
and pure Python (by default binascii used) quopri.decodestring() returns 
different results for following data:

   quoprimime  binascii  quopri

 b'='  ''  b''   b'='
 b'==' '=' b'='  b'=='
 b'= ' ''  b'= ' b'= '
 b'= \n'   ''  b'= \n'   b''
 b'=\r'''  b''   b'=\r'
 b'==41'   '=A'b'=41'b'=A'

--

___
Python tracker 

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



[issue18175] os.listdir(fd) leaks fd on error

2013-06-09 Thread Richard Oudkerk

New submission from Richard Oudkerk:

If os.listdir() is used with an fd, but fdopendir() fails (e.g. if the the fd 
is a normal file) then a duplicated fd is leaked.

This explains the leaks in test_shutil mentioned in #18174.

--
messages: 190875
nosy: sbt
priority: normal
severity: normal
status: open
title: os.listdir(fd) leaks fd on error

___
Python tracker 

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



[issue18022] Inconsistency between quopri.decodestring() and email.quoprimime.decode()

2013-06-09 Thread R. David Murray

R. David Murray added the comment:

Most of the variations represent different invalid-input recovery choices.  I 
believe binascii's decoding of b'= \n' is incorrect, as is its decoding of 
b'==41'.  quopri's decoding of b'=\r' is arguably incorrect as well, given that 
python generally supports universal line ends.  Otherwise the decodings are all 
responses to erroneous input for which the behavior is not specified.

That said, we ought to pick one error recovery scheme and implement it in all 
places, and IMO it shouldn't be exactly any of the ones we've got.  Or better 
yet, use one common implementation.  Untangling quopri is on my (too large) 
List of Things To Do :)

--

___
Python tracker 

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



[issue18175] os.listdir(fd) leaks fd on error

2013-06-09 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +larry

___
Python tracker 

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



[issue6632] Include more chars in the decimal codec

2013-06-09 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

I am changing the title slightly to include '\N{MINUS SIGN}' in the scope of 
this issues. See [1]:

"Unless anyone can point me to a case where \N{MINUS SIGN} should not be 
treated as a (duh) minus sign, we should go and try to make life easier for our 
users by adopting at least a few of such characters." (Łukasz Langa)

[1] http://mail.python.org/pipermail/python-ideas/2013-June/021243.html

--
title: Include more fullwidth chars in the decimal codec -> Include more chars 
in the decimal codec

___
Python tracker 

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



[issue18176] Builtins documentation refers to old version of UCD.

2013-06-09 Thread Alexander Belopolsky

New submission from Alexander Belopolsky:

Reference to 
http://www.unicode.org/Public/6.0.0/ucd/extracted/DerivedNumericType.txt in 
http://docs.python.org/3.4/library/stdtypes.html#numeric-types-int-float-complex
 should be changed to 
http://www.unicode.org/Public/6.1.0/ucd/extracted/DerivedNumericType.txt for 
3.3 and to 
http://www.unicode.org/Public/6.2.0/ucd/extracted/DerivedNumericType.txt for 
3.4.

Note that the change from 6.1 to 6.2 is immaterial because it did not involve 
the Nd category, but a change from 6.0 to 6.1 introduced several new ranges:

+110F0..110F9  ; Decimal # Nd  [10] SORA SOMPENG DIGIT ZERO..SORA SOMPENG DIGIT 
NINE
+11136..1113F  ; Decimal # Nd  [10] CHAKMA DIGIT ZERO..CHAKMA DIGIT NINE
+111D0..111D9  ; Decimal # Nd  [10] SHARADA DIGIT ZERO..SHARADA DIGIT NINE
+116C0..116C9  ; Decimal # Nd  [10] TAKRI DIGIT ZERO..TAKRI DIGIT NINE

--
messages: 190878
nosy: belopolsky
priority: normal
severity: normal
status: open
title: Builtins documentation refers to old version of UCD.
versions: Python 3.3, Python 3.4

___
Python tracker 

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



[issue18162] Add index attribute to IndexError

2013-06-09 Thread Brett Cannon

Brett Cannon added the comment:

Yes, I mean weakref.

--

___
Python tracker 

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



[issue18170] define built-in exceptions in Python code

2013-06-09 Thread Brett Cannon

Brett Cannon added the comment:

Yeah, that's the tricky bit. =) That's why I was thinking of starting with the 
leaf exceptions and then just slowly working down the hierarchy until I hit 
exceptions that just had to exist in C code (e.g. BaseException, Exception, and 
maybe SyntaxError). The rest could be made fake with Exception to start and 
then replace after the module was loaded.

--

___
Python tracker 

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



[issue6632] Include more chars in the decimal codec

2013-06-09 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

As a design principle, "accept what's unambiguous in any locale" is reasonable, 
but it is hard to apply consistently.  I would agree that the status quo is 
hard to defend.  After a long discussion, it has been accepted that fullwidth 
digits should be accepted and now float(u'123') is valid, but not 
float('+123'), float('-123') or float('12⒊'). The last example is

>>> '\N{FULLWIDTH DIGIT ONE}\N{FULLWIDTH DIGIT TWO}\N{DIGIT THREE FULL STOP}'
'12⒊'

All these variations can be neatly addressed by applying NFKC or NFKD 
normalization to unicode data before conversion:

>>> float(unicodedata.normalize('NFKD', '+123'))
123.0
>>> float(unicodedata.normalize('NFKD', '-123'))
-123.0
>>> float(unicodedata.normalize('NFKC', '12⒊'))
123.0

This would even allow parsing fullwidth hexadecimal numbers:

>>> float.fromhex(unicodedata.normalize('NFKC', '0x⒈7p3'))
11.5
>>> int(unicodedata.normalize('NFKC', '7F'), 16)
127

but would not help with the MINUS SIGN.

Allowing '\N{MINUS SIGN}' is particularly attractive because arguably unicode 
text should prefer it to ambiguous '\N{HYPHEN-MINUS}', but on the same token 
fractions.Fraction() should accept '\N{FRACTION SLASH}' in addition to the 
legacy '\N{SOLIDUS}'.

Overall, I think this situation calls for a PEP-size proposal and discussion 
about handling unicode numerical data throughout stdlib rather that a case by 
case discussion of the various quirks in the curent version.

--

___
Python tracker 

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



[issue18177] Typo in Documents

2013-06-09 Thread icedream91

New submission from icedream91:

In library.pdf file(Release 3.3.2, June 09, 2013), I found a typo in page 149: 
I think the quotation marks are wrong in "datetime.isoformat(sep=’T’)" 
sentence, they should both be "'".
But it's right in online documents 
(http://docs.python.org/3/library/datetime.html#datetime.datetime.isoformat).

Thanks.

--
assignee: docs@python
components: Documentation
messages: 190882
nosy: docs@python, icedream91
priority: normal
severity: normal
status: open
title: Typo in Documents
versions: Python 3.3

___
Python tracker 

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



[issue18175] os.listdir(fd) leaks fd on error

2013-06-09 Thread Larry Hastings

Larry Hastings added the comment:

Duplicate of #17899.

--
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
type:  -> resource usage

___
Python tracker 

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



[issue18172] New easter egg: insecure string pickle

2013-06-09 Thread Brian Curtin

Brian Curtin added the comment:

Sorry, I don't think this is something we can do. We're not going to put an 
image link into an exception message or docstring.

--
nosy: +brian.curtin
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue17899] os.listdir() leaks FDs if invoked on FD pointing to a non-directory

2013-06-09 Thread Larry Hastings

Larry Hastings added the comment:

Second rev incorporating a suggestion from the ever-present Serhiy.  Also, for 
what it's worth, I walked through this with the debugger when using 
os.listdir(0) and it worked fine.

--
Added file: 
http://bugs.python.org/file30520/larry.listdir.fd.leakage.bug.2.patch

___
Python tracker 

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



[issue17899] os.listdir() leaks FDs if invoked on FD pointing to a non-directory

2013-06-09 Thread Larry Hastings

Larry Hastings added the comment:

Here's a patch for 3.3.  There's been enough churn around listdir in trunk that 
I was gonna have to write the patches separately anyway.

--
Added file: 
http://bugs.python.org/file30521/larry.3.3.listdir.fd.leakage.bug.1.patch

___
Python tracker 

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



[issue18172] New easter egg: insecure string pickle

2013-06-09 Thread Ezio Melotti

Changes by Ezio Melotti :


--
resolution:  -> rejected
versions: +Python 3.4 -Python 3.5

___
Python tracker 

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



[issue17899] os.listdir() leaks FDs if invoked on FD pointing to a non-directory

2013-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

rewinddir() is called only when dirp != NULL && fd > -1. fdopendir() is called 
when fd != -1. close() is called when dirp == NULL && fd != -1. Therefore 
rewinddir() and fdopendir() with close() can't be called in the same time. And 
you can move block

if (dirp == NULL)
close(fd);

up, just after fdopendir(). In all other branches fd == -1 and close() is not 
called. You will save #ifdef HAVE_FDOPENDIR/#endif and 
Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS lines.

--

___
Python tracker 

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



[issue18168] plistlib output self-sorted dictionary

2013-06-09 Thread Ronald Oussoren

Ronald Oussoren added the comment:

I'm reworking the patch in #14455 and one of the things I intend to do is to 
add a keyword argument that controls whether or not the keys in dictionaries 
will be sorted by plistlib.

--

___
Python tracker 

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



[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-06-09 Thread Stefan Drees

Changes by Stefan Drees :


--
nosy: +dilettant

___
Python tracker 

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



[issue18022] Inconsistency between quopri.decodestring() and email.quoprimime.decode()

2013-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Perl's MIME::QuotedPrint produces same result as pure Python quopri. konwert 
qp-8bit produces same result as binascii (except '==41' it decodes as '=A').

RFC 2045 says:

"""A
  reasonable approach by a robust implementation might be
  to include the "=" character and the following
  character in the decoded data without any
  transformation and, if possible, indicate to the user
  that proper decoding was not possible at this point in
  the data.
"""

--

___
Python tracker 

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