[issue19717] resolve() fails when the path doesn't exist

2013-12-02 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the preliminary patch. Only tested on Linux. Later I'll test it on 
Windows.

--
keywords: +patch
nosy: +vajrasky
Added file: 
http://bugs.python.org/file32947/add_non_strict_resolve_pathlib.patch

___
Python tracker 

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



[issue19870] Backport Cookie fix to 2.7 (httponly / secure flag)

2013-12-02 Thread Florian Pilz

New submission from Florian Pilz:

Until Python 3.3.3 the Cookie library did not support the httponly and secure 
flag (see Issue 16611). Therefore the library is not RFC conform until then, so 
I think there should be a backport into 2.7 and maybe 3.2 as well.

--
components: Library (Lib)
messages: 205078
nosy: florianpilz
priority: normal
severity: normal
status: open
title: Backport Cookie fix to 2.7 (httponly / secure flag)
type: behavior
versions: Python 2.7, Python 3.3

___
Python tracker 

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



[issue19869] BaseCookie does not complain if a non RFC compliant cookie header was given

2013-12-02 Thread Florian Pilz

New submission from Florian Pilz:

BaseCookie should give an informative error, if a non RFC compliant header was 
given. The problem was, that we thought several cookies are allowed in one 
header in a cookie *response* header. However, this is only allowed in cookie 
*request* headers.

In those cases the output of BaseCookie looks broken, which caused a lot of 
confusion, since a standard library should not have so many flaws.

Example with parsing a response header with several cookies separated by comma 
(not allowed by RFC):

http.cookies.BaseCookie('foo=bar, oof=rab; httponly, bar=baz').output()
'Set-Cookie: bar=baz\r\nSet-Cookie: foo=bar,\r\nSet-Cookie: oof=rab'

Flaws:

* comma after 'foo=bar' in output
* the httponly flag was omitted (it would show up with a semi-colon after it, 
i.e. 'oof=rab; httponly;')
* input and output style are different, i.e. several cookies in one line were 
transformed to several cookies in several lines

I think the best solution is to fail early and hard, if there are several 
cookies in one header. Maybe some problems should be fixed anyway (trailing 
comma, different output style).

--
components: Library (Lib)
messages: 205077
nosy: florianpilz
priority: normal
severity: normal
status: open
title: BaseCookie does not complain if a non RFC compliant cookie header was 
given
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue19868] Importing humanhash and uuid causes a segmentation fault crash

2013-12-02 Thread Ned Deily

Ned Deily added the comment:

If you are running on OS X 10.9 Mavericks, install Python 3.3.3.

--
nosy: +ned.deily
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> interactive interpreter crashes and test_readline fails on OS X 
10.9 Mavericks due to libedit update

___
Python tracker 

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



[issue19868] Importing humanhash and uuid causes a segmentation fault crash

2013-12-02 Thread Drew

New submission from Drew:

$ pip-3.3 install humanhash
$ python3
Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 13:52:24) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import uuid
>>> import humanhash
Segmentation fault: 11

--
assignee: ronaldoussoren
components: Macintosh
files: Python_2013-12-02-231131_shadowfax.crash
messages: 205075
nosy: compaqdrew, ronaldoussoren
priority: normal
severity: normal
status: open
title: Importing humanhash and uuid causes a segmentation fault crash
versions: Python 3.3
Added file: 
http://bugs.python.org/file32946/Python_2013-12-02-231131_shadowfax.crash

___
Python tracker 

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



[issue19858] Make pickletools.optimize aware of the MEMOIZE opcode.

2013-12-02 Thread Alexandre Vassalotti

Alexandre Vassalotti added the comment:

MEMOIZE and PUT can be used together. They just need to not step on each other 
toes when they write to the memo table. As specified by PEP 3154, the memo 
index used by MEMOIZE is the number of elements currently in the memo table. 
This obviously means functions like, pickletools.optimize, have to be more 
careful when they rewrite pickles.

--

___
Python tracker 

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



[issue19801] Concatenating bytes is much slower than concatenating strings

2013-12-02 Thread Sworddragon

Sworddragon added the comment:

> We aren't going to add the optimization shortcut for bytes

There is still the question: Why isn't this going to be optimized?

--

___
Python tracker 

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



[issue19801] Concatenating bytes is much slower than concatenating strings

2013-12-02 Thread R. David Murray

R. David Murray added the comment:

Please take these observations and questions to python-list.  They aren't 
really appropriate for the bug tracker.  We aren't going to add the 
optimization shortcut for bytes unless someone does a bunch of convincing on 
python-ideas, which seems unlikely (but not impossible).

--

___
Python tracker 

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



[issue19858] Make pickletools.optimize aware of the MEMOIZE opcode.

2013-12-02 Thread Tim Peters

Tim Peters added the comment:

Is it _documented_ that MEMOIZE and PUT can't be used together?  If not, it 
should be documented; and pickletools dis() and optimize() should verify that 
this restriction is honored in their inputs.

--

___
Python tracker 

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



[issue19801] Concatenating bytes is much slower than concatenating strings

2013-12-02 Thread Sworddragon

Sworddragon added the comment:

I have extended the benchmark a little and here are my new results:

concatenate_string()   : 0.037489
concatenate_bytes(): 2.920202
concatenate_bytearray(): 0.157311
concatenate_string_io(): 0.035397
concatenate_bytes_io() : 0.032835
concatenate_string_join()  : 0.170623
concatenate_string_and_encode(): 0.037280

- As we already know concatenating bytes is much slower then concatenating 
strings.
- concatenate_bytearray() shows that doing this with bytearrays is 5 times 
slower than concatenating strings. Also it will return a bytearray and I 
couldn't figure out how to convert it simply to a bytes object in this short 
time.
- Interestingly concatenate_string_io() shows that using a StringIO object is 
faster than concatenating strings directly.
- Even more interesting is that concatenate_bytes_io() shows that a BytesIO 
object is the fastest solution of all.
- Using .join in concatenate_string_join() shows that it is slow too.
- Curiously I couldn't test concatenate_bytes_join() as it will result in an 
exception. Searching the documentation resulted that I can't find a join method 
for bytes objects to look what is wrong.
- I have also tested in concatenate_string_and_encode() how fast it is to 
concatenate strings and then simply encode them. The performance impact 
compared to concatenating strings directly is low enough that the test couldn't 
measure it anymore.


Summary: BytesIO is the fastest solution but needs to import an extra library. 
Concatenating strings and then encode them seems to be the most practicable 
solution if io is not already imported.

But I'm wondering why Python can't simply have the string optimization on bytes 
too.

--
Added file: http://bugs.python.org/file32945/test.py

___
Python tracker 

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



[issue9998] ctypes find_library should search LD_LIBRARY_PATH on linux

2013-12-02 Thread Daniel Blanchard

Daniel Blanchard added the comment:

Any chance of this making it into 3.4? This is a rather annoying deficiency of 
find_library().

--
nosy: +Daniel.Blanchard

___
Python tracker 

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



[issue19866] tests aifc, sunau and wave failures on a fresh Win64 installation

2013-12-02 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +loewis, serhiy.storchaka

___
Python tracker 

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



[issue19717] resolve() fails when the path doesn't exist

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

Sure.

--

___
Python tracker 

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



[issue19717] resolve() fails when the path doesn't exist

2013-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think there's value in allowing the "less strict" behaviour with an optional 
arg, though. i.e.:

>>> Path('toto').resolve()
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/antoine/cpython/default/Lib/pathlib.py", line 1024, in resolve
s = self._flavour.resolve(self)
  File "/home/antoine/cpython/default/Lib/pathlib.py", line 282, in resolve
target = accessor.readlink(cur)
  File "/home/antoine/cpython/default/Lib/pathlib.py", line 372, in readlink
return os.readlink(path)
FileNotFoundError: [Errno 2] No such file or directory: 
'/home/antoine/cpython/default/toto'
>>> Path('toto').resolve(strict=False)
PosixPath('/home/antoine/cpython/default/toto')

--

___
Python tracker 

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



[issue19717] resolve() fails when the path doesn't exist

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

Hm, so we can choose to be more like POSIX realpath() or more like 
os.path.realpath().  I guess your original intuition was right.  Close with no 
action is fine.  If I need a partial real path I can always crawl up parents() 
until I find a path that does exist.

--

___
Python tracker 

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



[issue19717] resolve() fails when the path doesn't exist

2013-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

(note that POSIX realpath() fails with ENOENT if the file doesn't exist: 
http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html )

--

___
Python tracker 

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



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

The asyncio patch looks fine, but I'd like to see a unittest that actually 
fails (or mocks failing) the hostname check where it is now performed (in 
wrap_socket() IIUC?), to make sure that the exception is propagated out 
properly.

--

___
Python tracker 

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



[issue19800] Write more detailed framing tests

2013-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch.

--
keywords: +patch
Added file: http://bugs.python.org/file32944/frame_tests.patch

___
Python tracker 

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



[issue19860] asyncio: Add context manager to BaseEventLoop?

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

Well, calling close() is best practice *if you own the loop*.  But the thing is 
that you may not own what get_event_loop() returns, and in fact in most cases 
where it is called you don't own it.  This is very different from files:

  with open(...) as f:
  ...

In that idiom you clearly own f.  Both of these are also very different from 
locks and the like, because you can repeatedly acquire and release a lock (but 
you can only close a file or event loop once).

I tried to come up with a design for a helper that in __enter__() creates a new 
event loop and makes it the current event loop, then in __exit__() closes it 
and sets the current event loop to None.  But this doesn't work well with the 
way get_event_loop() can sometimes auto-creates the loop.

Therefore I am closing this as "rejected".

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

___
Python tracker 

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



[issue19867] pickletools.OpcodeInfo.code is a string

2013-12-02 Thread Antoine Pitrou

New submission from Antoine Pitrou:

It should probably be a bytes object instead:

>>> op

>>> op.code
'\x95'
>>> op.name
'FRAME'
>>> pickle.FRAME
b'\x95'

--
components: Library (Lib)
messages: 205061
nosy: alexandre.vassalotti, pitrou
priority: normal
severity: normal
status: open
title: pickletools.OpcodeInfo.code is a string
type: behavior
versions: Python 3.3, Python 3.4

___
Python tracker 

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



[issue19865] create_unicode_buffer() fails on non-BMP strings on Windows

2013-12-02 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +amaury.forgeotdarc, belopolsky, haypo, meador.inge

___
Python tracker 

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



[issue19866] tests aifc, sunau and wave failures on a fresh Win64 installation

2013-12-02 Thread Zachary Ware

Changes by Zachary Ware :


--
nosy: +zach.ware

___
Python tracker 

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



[issue19850] asyncio: limit EINTR occurrences with SA_RESTART

2013-12-02 Thread Charles-François Natali

Charles-François Natali added the comment:

> Guido van Rossum added the comment:
>
> That's just rhetoric -- I am beginning to believe that nobody has any data.  
> Here's some opposite rhetoric.  If it ain't broke, don't fix it.  Plus, if 
> it's so much better, why isn't it the default?  If you say "for backward 
> compatibility" I will say "exactly!"

Well, it's the default on BSD and Linux, but Python deliberately disables it:
"""
PyOS_setsig(int sig, PyOS_sighandler_t handler)
{
#ifdef HAVE_SIGACTION
/* Some code in Modules/signalmodule.c depends on sigaction() being
 * used here if HAVE_SIGACTION is defined.  Fix that if this code
 * changes to invalidate that assumption.
 */
struct sigaction context, ocontext;
context.sa_handler = handler;
sigemptyset(&context.sa_mask);
context.sa_flags = 0;
if (sigaction(sig, &context, &ocontext) == -1)
return SIG_ERR;
return ocontext.sa_handler;
#else
PyOS_sighandler_t oldhandler;
oldhandler = signal(sig, handler);
#ifdef HAVE_SIGINTERRUPT
siginterrupt(sig, 1);
#endif
return oldhandler;
#endif
}
"""

It's done because we want syscalls to return with EINTR to be able to
run signal handlers, but since asyncio uses a wakeup file descriptor,
it's unnecessary here.

> Any *other* I/O syscalls (unless a program violates the asyncio rules against
> doing your own blocking I/O) would either be disk file I/O, which IIUC cannot
> elicit EINTR, or run in a separate thread, where presumably it wouldn't be
> interrupted by a signal handler, since SIGCHLD is delivered to the main 
> thread.
>  (It's actually the last part I am not 100% sure of.)

In order:
- Linux avoids EINTR on file I/O, but that's not necessarily the case
on other OS (e.g. on NFS)
- Many syscalls can return EINTR, not only I/O related, e.g. waitpid().
- As for threads, there's absolutely no guarantee that the signal will
be delivered to the main thread.

--

___
Python tracker 

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



[issue19866] tests aifc, sunau and wave failures on a fresh Win64 installation

2013-12-02 Thread Francisco Martín Brugué

Changes by Francisco Martín Brugué :


Added file: http://bugs.python.org/file32943/failed_test_wave.txt

___
Python tracker 

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



[issue19866] tests aifc, sunau and wave failures on a fresh Win64 installation

2013-12-02 Thread Francisco Martín Brugué

Changes by Francisco Martín Brugué :


Added file: http://bugs.python.org/file32942/failed_test_sunau.txt

___
Python tracker 

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



[issue19866] tests aifc, sunau and wave failures on a fresh Win64 installation

2013-12-02 Thread Francisco Martín Brugué

New submission from Francisco Martín Brugué:

I've just installed Cpython 2.7.6 32bit on Windows64, run the tests [1]
and some of them failed. Some of them seems related to audiodata not beeing 
installed.

.\python.exe Lib\test\regrtest.py -v
== CPython 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] 
== Windows-7-6.1.7601-SP1 little-endian 
== c:\users\brugue\appdata\local\temp\test_python_1388 
Testing with flags: sys.flags(debug=0, py3k_warning=0, division_warning=0,
division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0,
no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0,
unicode=0, bytes_warning=0, hash_randomization=0) 
... 
test_aifc
...
==
ERROR: test_close (test.test_aifc.AifcPCM8Test)
--
Traceback (most recent call last):
  File "D:\programs\Python27\lib\test\audiotests.py", line 148, in test_close
    with open(self.sndfilepath, 'rb') as testfile:
IOError: [Errno 2] No such file or directory: 'audiodata\\pluck-pcm8.aiff'
...
and more...
FAILED (errors=30)
...
test_sunau
==
ERROR: test_close (test.test_sunau.SunauPCM8Test)
--
Traceback (most recent call last):
  File "D:\programs\Python27\lib\test\audiotests.py", line 148, in test_close
with open(self.sndfilepath, 'rb') as testfile:
IOError: [Errno 2] No such file or directory: 'audiodata\\pluck-pcm8.au'
...
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
Exception AttributeError: "Au_read instance has no attribute '_file'" in > ignored
test test_sunau failed -- multiple errors occurred
...
and more ...
...
FAILED (errors=25)
...
test_wave
...
==
ERROR: test_close (test.test_wave.WavePCM8Test)
--
Traceback (most recent call last):
  File "D:\programs\Python27\lib\test\audiotests.py", line 148, in test_close
with open(self.sndfilepath, 'rb') as testfile:
IOError: [Errno 2] No such file or directory: 'audiodata\\pluck-pcm8.wav'
...
FAILED (errors=20)
...
See attached files

--
components: Windows
files: failed_test_aifc.txt
messages: 205059
nosy: francismb
priority: normal
severity: normal
status: open
title: tests aifc, sunau and wave failures on a fresh Win64 installation
versions: Python 2.7
Added file: http://bugs.python.org/file32941/failed_test_aifc.txt

___
Python tracker 

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



[issue19864] multiprocessing Proxy docs need locking semantics explained

2013-12-02 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +sbt
versions: +Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



[issue19847] Setting the default filesystem-encoding

2013-12-02 Thread Sworddragon

Sworddragon added the comment:

> This idea was already proposed in issue #8622, but it was a big fail.

Not completely: If your locale is utf-8 and you want to operate on an utf-8 
filesystem all is fine. But what if you want then to operate on a ntfs 
(non-utf-8) partition? As I know there is no way to apply Python-environment 
variables on the fly with an effect to the interpreter. In my opinion this is 
the reason why a setter is needed here.

Otherwise the user has to go sure to use .encode() on all filesystem 
operations. Also he must ensure that .encode() doesn't throw any exception if 
the code must be robust. And with issue http://bugs.python.org/issue19846 this 
must likely be done with the content too. This will be really a hell in 
increasing the number of lines due to exception checking.

Is there a special reason that is against such a setter? The current advantage 
would be a huge increasing in maintainability of Python scripts who are relying 
on a high stability.

--

___
Python tracker 

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



[issue19850] asyncio: limit EINTR occurrences with SA_RESTART

2013-12-02 Thread Gregory P. Smith

Gregory P. Smith added the comment:

>
> I believe that the libc and the kernel knows better than Python how to
> restart a syscalls, than Python. I expect more reliable timeout, or
> the kernel may avoid context switches (don't wake up the process).
>

See the man page i linked to, calls like select and poll with timeouts are
not auto-restarted.

--

___
Python tracker 

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



[issue19860] asyncio: Add context manager to BaseEventLoop?

2013-12-02 Thread Larry Hastings

Larry Hastings added the comment:

Okay, yeah.  I assumed calling .close() was best practice.  If it's not, then...

Guido, since this is your library, I delegate the decision to you.  You guys 
can add this any time before I tag beta 2 if Guido's on board.

--

___
Python tracker 

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



[issue19858] Make pickletools.optimize aware of the MEMOIZE opcode.

2013-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

By the way, I was curious if there were many users of pickletools.optimize(), 
so I did a search and most matches seem to be copies of the stdlib source tree:

http://code.ohloh.net/search?s=pickletools%20optimize&p=0&pp=0&fl=Python&mp=1&ml=1&me=1&md=1&ff=1&filterChecked=true

--
nosy: +pitrou

___
Python tracker 

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



[issue19852] Misplaced private API method in pathlib.py

2013-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks! Patch now applied.

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

___
Python tracker 

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



[issue19852] Misplaced private API method in pathlib.py

2013-12-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cd8230437f40 by Antoine Pitrou in branch 'default':
Issue #19852: move Path._raw_open() around, as it is now a private method.
http://hg.python.org/cpython/rev/cd8230437f40

--
nosy: +python-dev

___
Python tracker 

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



[issue19858] Make pickletools.optimize aware of the MEMOIZE opcode.

2013-12-02 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +tim.peters

___
Python tracker 

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



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-02 Thread Christian Heimes

Christian Heimes added the comment:

I have addressed the five libraries in five sub-issues. http.client and 
asyncio.selector_events need small adjustments to use the new feature. Please 
review the patch.

--
nosy: +gvanrossum
Added file: http://bugs.python.org/file32940/check_hostname_adjustments.patch

___
Python tracker 

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



[issue19858] Make pickletools.optimize aware of the MEMOIZE opcode.

2013-12-02 Thread Alexandre Vassalotti

Alexandre Vassalotti added the comment:

Well, that can only happen if MEMOIZE and PUT are both used together, which 
won't happen with the Pickler classes we support. The easiest thing to do here 
is to disable pickletools.optimize on protocol 4.

--

___
Python tracker 

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



[issue19860] asyncio: Add context manager to BaseEventLoop?

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

But there is Antoine's point.  This makes

  with get_event_loop() as loop:
  

an attractive nuisance if it's used in the wrong place.

--

___
Python tracker 

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



[issue19865] create_unicode_buffer() fails on non-BMP strings on Windows

2013-12-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
type: crash -> behavior

___
Python tracker 

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



[issue19863] Missing function attributes in 2.7 docs.

2013-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Then write the double-underscore variants at first place.

--

___
Python tracker 

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



[issue19860] asyncio: Add context manager to BaseEventLoop?

2013-12-02 Thread Larry Hastings

Larry Hastings added the comment:

Since this is a new library in 3.4, I can be more flexible.  And since you're 
talking about adding a new feature (rather than changing or removing an 
existing feature), this has a vanishingly small chance of screwing anything up. 
 Therefore I'm okay with adding this feature.

I suppose Python 3.4 only supports platforms that auto-close sockets at the end 
of a process, but I dimly recall Windows 95/98/ME didn't do that.  And there 
are crazy people porting to platforms like Amiga.  And I can hardly disapprove 
of something as wholesome as making sure people call .close().  So if Guido 
says okay, go ahead and check it in.

--

___
Python tracker 

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



[issue19785] No SSL match_hostname() in smtplib

2013-12-02 Thread Christian Heimes

Changes by Christian Heimes :


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

___
Python tracker 

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



[issue19785] No SSL match_hostname() in smtplib

2013-12-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c0079358e791 by Christian Heimes in branch 'default':
Issue #19785: smtplib now supports SSLContext.check_hostname and server name
http://hg.python.org/cpython/rev/c0079358e791

--
nosy: +python-dev

___
Python tracker 

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



[issue19863] Missing function attributes in 2.7 docs.

2013-12-02 Thread Mark Dickinson

Mark Dickinson added the comment:

Updated patch.

--
Added file: 
http://bugs.python.org/file32939/missing_function_attributes_v2.patch

___
Python tracker 

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



[issue19865] create_unicode_buffer() fails on non-BMP strings on Windows

2013-12-02 Thread Gergely Erdélyi

New submission from Gergely Erdélyi:

create_unicode_buffer() fails on Windows if the initializer string contains 
unicode code points outside of the Basic Multilingual Plane and an explicit 
length is not specified.

The problem appears to be rooted in the fact that, since PEP 393, len() returns 
the number of code points, which does not always correspond to the number of 
16-bit wchar words needed for the encoding on Windows. Because of that, the 
preallocated c_wchar buffer will be too short for the UTF-16 string.

The following small snippet demonstrates the problem:

from ctypes import create_unicode_buffer
b = create_unicode_buffer("\U00028318\U00028319")
print(b)

  File "c:\Python33\lib\ctypes\__init__.py", line 294, in create_unicode_buffer
buf.value = init
ValueError: string too long

--
components: ctypes
messages: 205045
nosy: gergely.erdelyi
priority: normal
severity: normal
status: open
title: create_unicode_buffer() fails on non-BMP strings on Windows
type: crash
versions: Python 3.3, Python 3.4

___
Python tracker 

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



[issue19863] Missing function attributes in 2.7 docs.

2013-12-02 Thread Mark Dickinson

Mark Dickinson added the comment:

> Perhaps aliases should be added in same cell as original names?

That sounds good to me.  Perhaps with a single explanatory line below the table 
to explain that the double-underscore variants were introduced for 
compatibility with Python 3.

--

___
Python tracker 

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



[issue19783] No SSL match_hostname() in nntplib

2013-12-02 Thread Christian Heimes

Changes by Christian Heimes :


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

___
Python tracker 

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



[issue19783] No SSL match_hostname() in nntplib

2013-12-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 42a6919ee7e5 by Christian Heimes in branch 'default':
Issue #19783: nntplib now supports SSLContext.check_hostname and server name
http://hg.python.org/cpython/rev/42a6919ee7e5

--
nosy: +python-dev

___
Python tracker 

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



[issue19784] No SSL match_hostname() in poplib

2013-12-02 Thread Christian Heimes

Changes by Christian Heimes :


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

___
Python tracker 

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



[issue19784] No SSL match_hostname() in poplib

2013-12-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1ce752754280 by Christian Heimes in branch 'default':
Issue #19784: poplib now supports SSLContext.check_hostname and server name
http://hg.python.org/cpython/rev/1ce752754280

--
nosy: +python-dev

___
Python tracker 

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



[issue19782] No SSL match_hostname() in imaplib

2013-12-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 23001d915b39 by Christian Heimes in branch 'default':
Issue #19782: imaplib now supports SSLContext.check_hostname and server name
http://hg.python.org/cpython/rev/23001d915b39

--
nosy: +python-dev

___
Python tracker 

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



[issue19782] No SSL match_hostname() in imaplib

2013-12-02 Thread Christian Heimes

Changes by Christian Heimes :


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

___
Python tracker 

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



[issue19863] Missing function attributes in 2.7 docs.

2013-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Perhaps aliases should be added in same cell as original names?

   +---+---+---+
   | :attr:`func_code`,| The code object representing  | Writable  |
   | :attr:`__code__`  | the compiled function body.   |   |
   +---+---+---+

Or add new "Alias" column?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue19864] multiprocessing Proxy docs need locking semantics explained

2013-12-02 Thread Max Polk

New submission from Max Polk:

In the docs (both Python 2 and 3) for the multiprocessing module, the Proxy 
section needs to be explicit about the fact that is does NOT create locks 
around access to shared objects.

Why?  Because on the same page, we read about 
multiprocessing.managers.SyncManager's Queue method to create a shared 
queue.Queue object and return a proxy for it, next to other methods like 
SyncManager.list to create a "process safe" list.

But later, a willful violation of these semantics exists in the "Using a remote 
manager" section where a Proxy is implicitly created (via the register method 
of multiprocessing.managers.BaseManager) surrounding a Queue.Queue object.

Note that it did not create a proxy around a SyncManager.Queue, it created it 
around a Queue.Queue.  A user who copies this code and replaces Queue.Queue 
with a plain Python list gets the sense that all the needed locks will be 
created to protect the shared list.

However, due to lack of documentation in the Proxy section, the user will not 
know it's an unsafe list, and Proxy isn't helping them.  I'm guessing that 
Queue.Queue has its own locks to protect it in a process-shared setting, and we 
"lucked out" in this example, but an unwary reader's luck runs out if they 
replace it with a plain Python list.

Therefore, may I suggest two changes: (1) replace Queue.Queue with 
SyncManager.Queue in the "Using a remote manager" section to avoid misleading 
readers; and (2) be explicit in Proxy class docs that "no locks are created" to 
protect against concurrent access, and maybe add that the user must go to the 
multiprocessing.managers.SyncManager methods (Queue, list, etc) to get "process 
safe" objects to place behind the Proxy.

--
assignee: docs@python
components: Documentation
messages: 205039
nosy: docs@python, maxpolk
priority: normal
severity: normal
status: open
title: multiprocessing Proxy docs need locking semantics explained

___
Python tracker 

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



[issue19859] functools.lru_cache keeps objects alive forever

2013-12-02 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue19863] Missing function attributes in 2.7 docs.

2013-12-02 Thread Mark Dickinson

New submission from Mark Dickinson:

The attached patch fills in some missing function attributes from the Python 
2.7 datamodel docs.

--
assignee: docs@python
components: Documentation
files: missing_function_attributes.patch
keywords: patch
messages: 205038
nosy: docs@python, mark.dickinson
priority: normal
severity: normal
status: open
title: Missing function attributes in 2.7 docs.
versions: Python 2.7
Added file: http://bugs.python.org/file32938/missing_function_attributes.patch

___
Python tracker 

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



[issue19862] Unclear xpath caching for custom namespaces

2013-12-02 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +eli.bendersky, scoder

___
Python tracker 

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



[issue19803] memoryview complain ctypes byte array are not native single character

2013-12-02 Thread Stefan Krah

Stefan Krah added the comment:

Memoryview sends a *request* to ctypes to fill in a Py_buffer struct according
to the buffer *protocol*.  IOW, memoryview knows nothing about ctypes.

For some reason ctypes fills in 'B' as the format if _pack_ is set.  I do not
know if that is intended, it could be a ctypes issue.

--

___
Python tracker 

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



[issue19803] memoryview complain ctypes byte array are not native single character

2013-12-02 Thread HCT

HCT added the comment:

I wonder why "_pack_ = 1" has significant impact on the behaviour of memoryview 
if memoryview is not a sub class of ctypes structure. unless memoryview was 
specifically coded to understand ctypes structure, I don't see why "_pack_ = 1" 
should make any difference.

--

___
Python tracker 

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



[issue17305] IDNA2008 encoding missing

2013-12-02 Thread Marten Lehmann

Marten Lehmann added the comment:

There's nice library called idna on PyPI doing idna2008: 
https://pypi.python.org/pypi/idna/0.1

I'd however prefer this standard encoding to be part of standard python.

--

___
Python tracker 

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



[issue14455] plistlib unable to read json and binary plist files

2013-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yet one nitpick. Perhaps _write_object() should raise TypeError instead of 
InvalidFileException.

--

___
Python tracker 

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



[issue14455] plistlib unable to read json and binary plist files

2013-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

According to [1] Apple's libraries write any signed 128-bit integers, but read 
only integers from -2**63 to 2**64-1 (e.g. signed and unsigned 64-bit integers).

[1] http://opensource.apple.com/source/CF/CF-550/CFBinaryPList.c

--

___
Python tracker 

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



[issue19858] Make pickletools.optimize aware of the MEMOIZE opcode.

2013-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I afraid this is not a feature, but a bug. pickletools.optimize() can produce 
invalid pickled data when *PUT and MEMOIZE opcodes are used.

>>> import pickle, pickletools
>>> p = b'\x80\x04]\x94(\x8c\x04spamq\x01\x8c\x03ham\x94h\x02e.'
>>> pickle.loads(p)
['spam', 'ham', 'ham']
>>> pickletools.dis(p)
0: \x80 PROTO  4
2: ]EMPTY_LIST
3: \x94 MEMOIZE
4: (MARK
5: \x8c SHORT_BINUNICODE 'spam'
   11: qBINPUT 1
   13: \x8c SHORT_BINUNICODE 'ham'
   18: \x94 MEMOIZE
   19: hBINGET 2
   21: eAPPENDS(MARK at 4)
   22: .STOP
highest protocol among opcodes = 4
>>> p2 = pickletools.optimize(p)
>>> p2
b'\x80\x04\x95\x13\x00\x00\x00\x00\x00\x00\x00]\x94(\x8c\x04spam\x8c\x03ham\x94h\x02e.'
>>> pickle.loads(p2)
Traceback (most recent call last):
  File "", line 1, in 
KeyError: 2
>>> pickletools.dis(p2)
0: \x80 PROTO  4
2: \x95 FRAME  19
   11: ]EMPTY_LIST
   12: \x94 MEMOIZE
   13: (MARK
   14: \x8c SHORT_BINUNICODE 'spam'
   20: \x8c SHORT_BINUNICODE 'ham'
   25: \x94 MEMOIZE
   26: hBINGET 2
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/pickletools.py", line 2458, in dis
raise ValueError(errormsg)
ValueError: memo key 2 has never been stored into

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue19850] asyncio: limit EINTR occurrences with SA_RESTART

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

That's just rhetoric -- I am beginning to believe that nobody has any data.  
Here's some opposite rhetoric.  If it ain't broke, don't fix it.  Plus, if it's 
so much better, why isn't it the default?  If you say "for backward 
compatibility" I will say "exactly!"

--

___
Python tracker 

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



[issue19833] asyncio: patches to document EventLoop and add more examples

2013-12-02 Thread STINNER Victor

STINNER Victor added the comment:

I documented many new classes. I read the source code and copied classes to 
extract docstrings.

Instead of BaseXXX classes, it's maybe better to document AbstractXXX classes.

--

___
Python tracker 

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



[issue19850] asyncio: limit EINTR occurrences with SA_RESTART

2013-12-02 Thread STINNER Victor

STINNER Victor added the comment:

> I have a question. Is there actually any need for this with asyncio?

I believe that the libc and the kernel knows better than Python how to
restart a syscalls, than Python. I expect more reliable timeout, or
the kernel may avoid context switches (don't wake up the process).

In practice, you should not see any difference. Or maybe only on some
corner cases. But do you want to handle these corner cases while there
is already a portable flag for them? :-)

--

___
Python tracker 

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



[issue19860] asyncio: Add context manager to BaseEventLoop?

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

To create a new event loop, use set_event_loop(new_event_loop()).  You have to 
do that if you want an event loop in a thread; it's also handy in unit tests.  
(However asyncio's own unit tests only call new_event_loop() and pass it around 
explicitly with loop=...; they set the default event loop to None with 
set_event_loop(None).)

Creating a second event loop (in the same thread) while you already have an 
event loop is fraught with problems -- while the second one is running any 
events associated with the first one won't fire.

(This API is not random -- it is intentionally restricted to allow certain 
platform event loops to be adapted.)

--

___
Python tracker 

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



[issue19850] asyncio: limit EINTR occurrences with SA_RESTART

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

I have a question. Is there actually any need for this with asyncio? The 
selector already handles EINTR, and all the I/O done by asyncio's transports 
already handles it too (there are "except (BlockingIOError, InterruptedError)" 
clauses all over the place).

Any *other* I/O syscalls (unless a program violates the asyncio rules against 
doing your own blocking I/O) would either be disk file I/O, which IIUC cannot 
elicit EINTR, or run in a separate thread, where presumably it wouldn't be 
interrupted by a signal handler, since SIGCHLD is delivered to the main thread. 
 (It's actually the last part I am not 100% sure of.)

--

___
Python tracker 

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



[issue14455] plistlib unable to read json and binary plist files

2013-12-02 Thread Ronald Oussoren

Ronald Oussoren added the comment:

oops... thanks for the patch. I'll review later this week, in particular the 
128 bit integer support because I don't know if Apple's libraries support those.

--

___
Python tracker 

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



[issue19860] asyncio: Add context manager to BaseEventLoop?

2013-12-02 Thread STINNER Victor

STINNER Victor added the comment:

"There's another problem: get_event_loop() returns a persistent object, not a 
new instance every time."

Oh, I didn't know that, but it makes sense. It should be documented.

It is possible to create a second event loop, only used to execute a short 
one-shot task? I don't see how to instanciate a second event loop.

--

___
Python tracker 

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



[issue19837] Wire protocol encoding for the JSON module

2013-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Changing return type based on argument *values* is still a bad idea in
> general.

However load() and loads() do this. ;)

> It also makes it hard to plug the API in to generic code that is designed
> to work with any dump/load based serialisation protocol.

For dumps() it will be simple -- `lambda x: json.dumps(x, encoding='utf-8')`. 
For loads() it will be even simpler -- loads() will accept both strings and 
bytes.

Note that dumps() with the encoding parameter will be more 2.x compatible than 
current implementation. This will help in writing compatible code.

--

___
Python tracker 

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



[issue19834] Unpickling exceptions pickled by Python 2

2013-12-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a270370ec487 by Walter Doerwald in branch '3.3':
Add NEWS entry for issue #19834.
http://hg.python.org/cpython/rev/a270370ec487

New changeset ef6ad7172d50 by Walter Doerwald in branch 'default':
Add NEWS entry for issue #19834: merge with 3.3.
http://hg.python.org/cpython/rev/ef6ad7172d50

--

___
Python tracker 

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



[issue11410] Use GCC visibility attrs in PyAPI_*

2013-12-02 Thread Tom Tromey

Changes by Tom Tromey :


--
nosy: +tromey

___
Python tracker 

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



[issue19860] asyncio: Add context manager to BaseEventLoop?

2013-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

There's another problem: get_event_loop() returns a persistent object, not a 
new instance every time. So you can't write:

  with get_event_loop() as loop:
  # ...

twice in a row if the loop is closed at the end of the "with" block.

--

___
Python tracker 

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



[issue19860] asyncio: Add context manager to BaseEventLoop?

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

Isn't this mostly political correctness? The hello world programs really don't 
need to worry about closing the socket pair. Most real-world programs don't 
either -- the recommended pattern is just to loop until the end of the world, 
and then exit the program.

I'd like to counter with some political correctness of my own -- this smells 
like a new feature and therefore shouldn't be added to 3.4.  (Adding Larry -- 
if Larry is fine with making small additions to asyncio during the beta, I am 
also okay with adding this.)

--
nosy: +larry

___
Python tracker 

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



[issue14787] pkgutil.walk_packages returns extra modules

2013-12-02 Thread Martijn Faassen

Martijn Faassen added the comment:

I just ran into this bug myself with namespace packages (in Python 2.7). When 
you have multiple packages (ns.a, ns.b) under a namespace package (ns), and 
constrain the paths in walk_packages so it should only pick up ns.a, it will 
pick up ns.b as well.

Any hope for a fix or workaround?

--
nosy: +faassen

___
Python tracker 

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



[issue7105] weak dict iterators are fragile because of unpredictable GC runs

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

I'm with Antoine.  Have we heard of any problems with the 3.x version of the 
patch?  How different is it?

--

___
Python tracker 

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



[issue14455] plistlib unable to read json and binary plist files

2013-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Currently negative integers are not supported in binary format. Here is a patch 
which adds support for negative integers and large integers up to 128 bit.

--
Added file: http://bugs.python.org/file32937/plistlib_int.patch

___
Python tracker 

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2013-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Perhaps the versionchanged tag for format() is more suitable than versionadded.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue19707] Check if unittest.mock needs updating for PEP 451

2013-12-02 Thread Brett Cannon

Brett Cannon added the comment:

Based on what Michael said there is nothing to update.

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

___
Python tracker 

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



[issue19862] Unclear xpath caching for custom namespaces

2013-12-02 Thread Валерий

New submission from Валерий:

Consider repeated executions of a code like this:
>tree = xml.etree.ElementTree.parse( full_name ) # many different files
>report_type = tree.getroot().attrib['Name'] # something changing
>tree.getroot().find( ".//t:Detail", {'t' : report_type} )

There is a _cache variable in \Lib\xml\etree\ElementPath.py:
>def iterfind(elem, path, namespaces=None):
>// ...
>try:
>selector = _cache[path]
>except KeyError:
>// ...

In my code I use the same path (".//t:Detail"), so no KeyError exception is 
raised and cached (the same) value is used, but full path should be different 
('.//{url_one}Detail', './/{url_two}Detail', etc) depending on namespaces 
dictionary.

--
components: XML
messages: 205015
nosy: valeriy.nov
priority: normal
severity: normal
status: open
title: Unclear xpath caching for custom  namespaces
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue19781] No SSL match_hostname() in ftplib

2013-12-02 Thread Christian Heimes

Changes by Christian Heimes :


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

___
Python tracker 

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



[issue7105] weak dict iterators are fragile because of unpredictable GC runs

2013-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Anyway, it's not for me to decide.  We have currently three options:
> a) my first patch, which is a duplication of the 3.x work but is
> non-trivial and could bring stability issues
> b) my second patch, which will increase memory use, but to no more
> than previous versions of python used while iterating
> c) do nothing and have iterations over weak dicts randomly break when
> an underlying cycle is unraveled during iteration.

Either a) or c), for me. We shouldn't change semantics in bugfix
releases.

--

___
Python tracker 

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



[issue7105] weak dict iterators are fragile because of unpredictable GC runs

2013-12-02 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

Yes, the old memory argument.
But is it valid? Is there a conceivable application where a dict of weak 
references would be storing a large chunk of the application memory?
Remember, all of the data must be referred to from elsewhere, or else, the weak 
refs would not exist.  An extra list of pointers is unlikely to make a 
difference.
I think the chief reason to use iterators has to do with performance by 
avoiding the creation of temporary objects, not saving memory per-se.

Before the invention of "iteritems()" and friends, all such iteration was by 
lists (and hence, memory usage).  We should try to remain nimble enough so that 
we can undo an optimization previously done, if the requirements merit us doing 
so.

As a completely unrelated example of such nimbleness:  Faced with stricter 
regulations in the 70s, american car makers had to sell their muscle cars with 
increasingly less powerful engines, efectively rolling back previous 
optimizations :)

Anyway, it's not for me to decide.  We have currently three options:
a) my first patch, which is a duplication of the 3.x work but is non-trivial 
and could bring stability issues
b) my second patch, which will increase memory use, but to no more than 
previous versions of python used while iterating
c) do nothing and have iterations over weak dicts randomly break when an 
underlying cycle is unraveled during iteration.

Cheers!

--

___
Python tracker 

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



[issue14455] plistlib unable to read json and binary plist files

2013-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

These changes are worth to mention in What's News.

"versionchanged" below writePlistToBytes() is wrong. Perhaps below dump() too. 
"versionadded" is needed for new functions: dump(), dumps(), load(), loads().

--

___
Python tracker 

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



[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args

2013-12-02 Thread Eli Bendersky

Changes by Eli Bendersky :


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

___
Python tracker 

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



[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args

2013-12-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 181ced5bf0be by Eli Bendersky in branch '2.7':
Issue #19814: Clarify argparse's docs w.r.t prefix matching
http://hg.python.org/cpython/rev/181ced5bf0be

--

___
Python tracker 

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



[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args

2013-12-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c457bd1935f9 by Eli Bendersky in branch '3.3':
Issue #19814: Clarify argparse's docs w.r.t prefix matching
http://hg.python.org/cpython/rev/c457bd1935f9

New changeset 46976bd44bfc by Eli Bendersky in branch 'default':
Issue #19814: Clarify argparse's docs w.r.t prefix matching
http://hg.python.org/cpython/rev/46976bd44bfc

--
nosy: +python-dev

___
Python tracker 

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



[issue17305] IDNA2008 encoding missing

2013-12-02 Thread era

era added the comment:

At least the following existing domain names are rejected by the current 
implementation, apparently because they are not IDNA2003-compatible.

XNNNC9BXA1KSA.COM
XN--14-CUD4D3A.COM
XN--YGB4AR5HPA.COM
XN---14-00E9E9A.COM
XN--MGB2DAM4BK.COM
XN--6-ZHCPPA1B7A.COM
XN--3-YMCCH8IVAY.COM
XN--3-YMCLXLE2A3F.COM
XN--4-ZHCJXA0E.COM
XN--014-QQEUW.COM
XN--118-Y2EK60DC2ZB.COM

As a workaround, in the code where I needed to process these, I used a fallback 
to string[4:].decode('punycode'); this was in a code path where I had already 
lowercased the string and established that string[0:4] == 'xn--'.

As a partial remedy, supporting a relaxed interpretation of the spec somehow 
would be useful; see also (tangentially) issue #12263.

--
nosy: +era

___
Python tracker 

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



[issue19847] Setting the default filesystem-encoding

2013-12-02 Thread STINNER Victor

STINNER Victor added the comment:

"It is nice that you could fixed the documentation due to this report but this 
was just a sideeffect - so closing this report and moving it to "Documentation" 
was maybe wrong."

Oh sorry, I read the issue too quickly, I stopped at the first sentence. I 
reopen the issue the reply to the other points.


"In my opinion relying on the locale environment is risky since 
filesystem-encoding != locale. This is especially the case if working on a 
filesystem from an external media like an external hard disk drive. Operating 
on multiple media can also result in different filesystem-encodings."

This issue is not specific to Python. If you mount an USB key formated in VFAT 
with the wrong encoding on Linux, you will get mojibake in your file explorer. 
Same issue if you connect a network share (ex: NFS) using a different encoding 
than the server. You can find many other examples (hint: Mac OS X and Unicode 
normalization).

There is no good compromise here. The only two safe options are:

(A) convert filenames of your filesystem to the same encoding than your 
computer (there are tools for that, like convmv)

(B) use raw bytes instead of Unicode, Python 3 should accept bytes anywhere 
that OS data is expected (filenames, command line arguments, environment 
variables)

All operating systems (except Windows) are now using UTF-8 by default for the 
locale encoding. So slowly, mojibake issues on filename should become very rare.


"It would be useful if the user can make his own checks and change the default 
filesystem-encoding if needed."

This idea was already proposed in issue #8622, but it was a big fail. Please 
read my following email for more information:
https://mail.python.org/pipermail/python-dev/2010-October/104509.html

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue18073] pickle.Unpickler may read too many bytes, causing hangs with blocking input stream

2013-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If issue17897 fixes this bug (I'm not absolutely sure), perhaps it should be 
backported to 3.3.

--

___
Python tracker 

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



[issue19847] Setting the default filesystem-encoding

2013-12-02 Thread STINNER Victor

STINNER Victor added the comment:

(Oops, I specified the wrong issue number in my commits.)

New changeset b231e0c3fd26 by Victor Stinner in branch '3.3':
Issue #19728: Fix sys.getfilesystemencoding() documentation
http://hg.python.org/cpython/rev/b231e0c3fd26

New changeset e3c48bddf621 by Victor Stinner in branch 'default':
(Merge 3.3) Issue #19728: Fix sys.getfilesystemencoding() documentation
http://hg.python.org/cpython/rev/e3c48bddf621

--

___
Python tracker 

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



[issue19728] PEP 453: enable pip by default in the Windows binary installers

2013-12-02 Thread STINNER Victor

Changes by STINNER Victor :


--
Removed message: http://bugs.python.org/msg204999

___
Python tracker 

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



[issue19861] Update What's New for Python 3.4

2013-12-02 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Many features and changes were not mentioned in What's New (especially added 
early). Here is main features which possible worth to mention:

abc:  The ABC class, the get_cache_token function.

aifc:  Any bytes-like objects are now accepted.

audioop:  Any bytes-like objects are now accepted.  Strings no more supported.

base64:  ascii85/base85 codecs.

bz2:  The 'x' mode.

codecs:  The cp1125 encoding.

collections:  New optional parameter in ChainMap.new_child().

dbm:  Support for the context management protocol.

dis:  Added the file parameter to many functions. Added the stack_effect() 
function.

email:  The policy keyword argument was added in email.message.Message 
constructor. The replace keyword argument was added in the set_param() 
method. 
The EmailPolicy.content_manager attribute was added 

filecmp:  Added the clear_cache() function and the dircmp.DEFAULT_IGNORES 
attribute.

functools:  total_ordering now supports the NotImplemented value.

gc:  Added the get_stats() function.

glob:  Added the escape() function.

gzip: The 'x' mode.

http:  HTTP 0.9-style "Simple Responses" are not supported. Added the explain 
argument in BaseHTTPRequestHandler.send_error(). Added the --bind option in 
the http.server module CLI.

ipaddress:  Added the IPv4Address.is_global attribute.

json:  Used ``(',', ': ')`` as default in dump() and dumps() if indent is not 
None. I.e. trailing spaces no more produced by default.

logging:  An instance of a subclass of RawConfigParser is now accepted as a 
value for fname in the fileConfig() function. The verify argument was added in 
the listen() function. The atTime parameter was added in 
TimedRotatingFileHandler constructor.  Added support of Unix domain sockets 
in SocketHandler and DatagramHandler.

lzma:  The 'x' mode.

multiprocessing:  Added following functions: get_all_start_methods(), 
get_context(), get_start_method(), and set_start_method(). set_executable() 
is now supported on Unix when the 'spawn' start method is used. Added the 
context parameter in Pool constructor.

operator:  Added the length_hint() function.

os.path:  samestat() now is supported on Windows.

os:  Add O_TMPFILE constant on Linux.

plistlib:  Added support for binary format. Added load(), loads(), dump(), and 
dumps() functions. Deprecated readPlist(), writePlist() readPlistFromBytes(), 
and writePlistToBytes() functions, the Data class.

select:  epoll() now supports the context management protocol. Added the 
close() and fileno() methods and the closed attribute in the devpoll class.

shelve:  Added context manager support.

shutil:  Added the SameFileError exception.

smtpd:  The map argument was added in SMTPServer constructor.

socket:  The CAN_BCM protocol was added. The AF_LINK family was added.

sqlite3:  Added support for URI.

subprocess: The input parameter was added in the check_output() function.

sunau:  Added support for 24-bit samples. Any bytes-like objects are now 
accepted.

sys:  Added the getallocatedblocks() function. Added the __interactivehook__ 
hook.

tarfile:  Added command-line interface.

textwrap:  Added support for truncating.

threading:  Added the main_thread() function.

unittest:  Added the TestCase.assertLogs() method. The TestSuite no more held 
references to each TestCase after TestSuite.run(). Modules that raise SkipTest 
on import are recorded as skips, not errors. Paths are sorted before being 
imported to ensure execution order for a given test suite is the same.

urllib:  Added the HTTPError.headers attribute. Added the Request.full_url 
attribute and the Request.remove_header() and Request.get_full_url() methods. 
Default Request.method may be indicated at the class level.

venv:  Added the ``with_pip`` parameter in EnvBuilder.

wave:  Any bytes-like objects are now accepted. Added support for unseekable 
files.

xml.etree.elementtree:  Added support to output empty elements in short form.

zipfile:  ZIP64 extensions are enabled by default.


Other enhancements:le.

memoryview is now registered automatically with collections.abc.Sequence.

Deprecations:

The 'U' mode in open() for file objects, in the fileinput and zipfile modules. 
A couple of plistlib functions. The html argument of XMLParser() and the parser 
argument of iterparse() in the xml.etree.elementtree module.

--
assignee: docs@python
components: Documentation
messages: 205005
nosy: docs@python, larry, serhiy.storchaka
priority: release blocker
severity: normal
status: open
title: Update What's New for Python 3.4
type: enhancement
versions: Python 3.4

___
Python tracker 

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



[issue19860] asyncio: Add context manager to BaseEventLoop?

2013-12-02 Thread STINNER Victor

New submission from STINNER Victor:

The BaseSelectorEventLoop class (inherited by UnixSelectorEventLoop) creates a 
socketpair in its constructor. So if you don't call close(), the socketpair may 
stay alive.

It would be convinient to support the context manager to be able to write:

with asyncio.get_event_loop() as loop
   # ... prepare loop ...
   loop.run_forever()
# KeyboardInterrupt or SystemExit: loop.close() is called

Hello World examples don't call close(), so the sockets are not closed when the 
example is stopped using CTRL+c.

Attached patch adds __enter__/__exit__ methods to BaseEventLoop and use it in 
the two Hello World examples.

--
files: eventloop_context_manager.patch
keywords: patch
messages: 205004
nosy: gvanrossum, haypo, pitrou
priority: normal
severity: normal
status: open
title: asyncio: Add context manager to BaseEventLoop?
versions: Python 3.4
Added file: http://bugs.python.org/file32936/eventloop_context_manager.patch

___
Python tracker 

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



[issue19833] asyncio: patches to document EventLoop and add more examples

2013-12-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7b4d046dbf56 by Victor Stinner in branch 'default':
Issue #19833: asyncio doc: add class name to methods
http://hg.python.org/cpython/rev/7b4d046dbf56

New changeset b25458022965 by Victor Stinner in branch 'default':
Issue #19833: add 2 examples to asyncio doc (hello world)
http://hg.python.org/cpython/rev/b25458022965

New changeset 5e4ea92f9a9b by Victor Stinner in branch 'default':
Issue #19833: Document more asyncio.BaseEventLoop methods
http://hg.python.org/cpython/rev/5e4ea92f9a9b

--
nosy: +python-dev

___
Python tracker 

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



[issue19847] Setting the default filesystem-encoding

2013-12-02 Thread Sworddragon

Sworddragon added the comment:

It is nice that you could fixed the documentation due to this report but this 
was just a sideeffect - so closing this report and moving it to "Documentation" 
was maybe wrong.

--

___
Python tracker 

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



[issue19847] Setting the default filesystem-encoding

2013-12-02 Thread STINNER Victor

STINNER Victor added the comment:

Code in Python 3.4.

initfsencoding():
http://hg.python.org/cpython/file/e3c48bddf621/Python/pythonrun.c#l965

get_locale_encoding():
http://hg.python.org/cpython/file/e3c48bddf621/Python/pythonrun.c#l250

--

___
Python tracker 

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



[issue19847] Setting the default filesystem-encoding

2013-12-02 Thread STINNER Victor

STINNER Victor added the comment:

I fixed the documentation, thanks for your report!

--
assignee:  -> docs@python
components: +Documentation -IO
nosy: +docs@python
resolution:  -> fixed
status: open -> closed
versions: +Python 3.4

___
Python tracker 

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



[issue19728] PEP 453: enable pip by default in the Windows binary installers

2013-12-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b231e0c3fd26 by Victor Stinner in branch '3.3':
Issue #19728: Fix sys.getfilesystemencoding() documentation
http://hg.python.org/cpython/rev/b231e0c3fd26

New changeset e3c48bddf621 by Victor Stinner in branch 'default':
(Merge 3.3) Issue #19728: Fix sys.getfilesystemencoding() documentation
http://hg.python.org/cpython/rev/e3c48bddf621

--

___
Python tracker 

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



[issue19847] Setting the default filesystem-encoding

2013-12-02 Thread STINNER Victor

STINNER Victor added the comment:

"sys.getfilesystemencoding() says for Unix: On Unix, the encoding is the user’s 
preference according to the result of nl_langinfo(CODESET), or 'utf-8' if 
nl_langinfo(CODESET) failed."

Oh, this documentation is wrong since at least Python 3.2: if 
nl_langinfo(CODESET) fails, Python exits immediatly with a (fatal) error.

There is no (more?) such fallback to "utf-8".

--
nosy: +haypo

___
Python tracker 

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



  1   2   >