[issue19944] Make importlib.find_spec load packages as needed

2014-01-05 Thread Eric Snow

Eric Snow added the comment:

Brett: What do you think about moving importlib.find_spec() to importlib.util?

--

___
Python tracker 

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



[issue20129] 3.4 on windows 7 can't import IntEnum

2014-01-05 Thread Mark Lawrence

Mark Lawrence added the comment:

Bah humbug just found an old enum.py file hanging around.

--
resolution:  -> 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



[issue19713] Deprecate various things in importlib thanks to PEP 451

2014-01-05 Thread Larry Hastings

Larry Hastings added the comment:

I can accept the fourth patch in its current state.

Is that a rollup patch, including all the previous patches, or is it 
independent?

Is there a patch I can look at for this new API?

--

___
Python tracker 

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



[issue20130] asyncio: implement a synchronous executor if concurrent.futures is missing

2014-01-05 Thread STINNER Victor

New submission from STINNER Victor:

On old FreeBSD platforms (FreeBSD 6), concurrent.futures cannot be used and 
fail with an ImportError because of a limit on POSIX semaphores: see issue 
#10798. (See also maybe issue #10348 "multiprocessing: use SysV semaphores on 
FreeBSD" closed as WONTFIX.)

For asyncio, the test is currently skipped on this platform: see issue #19635.

(See also maybe issue #19295 "Make asyncio work without threads" closed as 
WONTFIX.)

I propose to implement a simple fallback using an synchronous executor (block 
until we get the result) which would be used by getaddrinfo() and getnameinfo() 
methods of EventLoop.

This issue is also motivated by my Trollius project, a backport of asyncio for 
Python 2.7, where concurrent.futures is not available. An optional backport, 
the "futures" project, can be used:
https://pypi.python.org/pypi/futures

Attached patch is a work-in-progress, it removes the dependency to 
concurrent.futures but doesn't implement the synchronous executor yet. It's the 
changes I wrote in Trollius 0.1.
https://pypi.python.org/pypi/trollius

--
files: asyncio_sync.patch
keywords: patch
messages: 207368
nosy: gvanrossum, haypo
priority: normal
severity: normal
status: open
title: asyncio: implement a synchronous executor if concurrent.futures is 
missing
versions: Python 3.4
Added file: http://bugs.python.org/file33317/asyncio_sync.patch

___
Python tracker 

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



[issue20128] Re-enable test_modules_search_builtin() in test_pydoc

2014-01-05 Thread Stefan Krah

Stefan Krah added the comment:

The buildbot runs --without-doc-strings. Usually you just have to add the
@requires_docstrings decorator to some tests.

--

___
Python tracker 

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



[issue13153] IDLE crashes when pasting non-BMP unicode char on Py3

2014-01-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As far as the patch becomes too complicated, I propose minimalist patch which 
fixes only this issue. I.e. IDLE will no longer silently closed when paste some 
unusual text (non-BMP on Windows or illegal UTF-8 on Linux). It fixes 
converting Tcl string to Python string for arguments of Python callback. 
\xc0\x80 is translated to the NUL character (U+) because Tcl uses 
"modified" UTF-8. All other illegal UTF-8 codes are replaced by the replacement 
character (U+FFFD).

--
Added file: http://bugs.python.org/file33318/tkinter_pythoncmd_args.patch

___
Python tracker 

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



[issue13153] IDLE crashes when pasting non-BMP unicode char on Py3

2014-01-05 Thread Martin v . Löwis

Martin v. Löwis added the comment:

I completely lost track which problem is being solved here. Is it still "IDLE 
crashes when pasting non-BMP unicode char on Py3"? If so, how is this patch 
solving it?

IMO, the issue shouhldn't have been reopened. Instead, a new issue should have 
started.

--

___
Python tracker 

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



[issue20131] warnings module offers no documented, programmatic way to reset "seen-warning" flag

2014-01-05 Thread Andreas Kloeckner

New submission from Andreas Kloeckner:

For tests and doctests, it is often desirable to show or verify that a certain 
warning occurs. Unfortunately, if the warning has been hit previously, it will 
not be issued again. It would be great if there were a documented, unified way 
to reset this 'seen' flag.

Related stackoverflow posts showing that I'm not the first person to have this 
need:

* 
https://stackoverflow.com/questions/19428761/python-showing-once-warnings-again-resetting-all-warning-registries
* https://stackoverflow.com/questions/2418570/testing-warnings-with-doctest

Neither of these has a satisfactory solution.

--
components: Library (Lib)
messages: 207372
nosy: inducer
priority: normal
severity: normal
status: open
title: warnings module offers no documented, programmatic way to reset 
"seen-warning" flag
versions: Python 2.7, Python 3.4

___
Python tracker 

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



[issue20131] warnings module offers no documented, programmatic way to reset "seen-warning" flag

2014-01-05 Thread Andreas Kloeckner

Changes by Andreas Kloeckner :


--
type:  -> enhancement

___
Python tracker 

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



[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2014-01-05 Thread Martin Panter

Martin Panter added the comment:

The Issue 12692 fix has been backported to the 3.3 branch, and it fixes this 
bug. However here is an updated patch (against revision 28337a8fb502 in the 
“3.3” branch) consisting of two left over bits you might still want to use:

1. My test case

2. Explicitly closing the HTTP connection when an invalid response is received. 
E.g. urlopen("http://google.com:443";) would still leak the connection without 
this.

--
Added file: http://bugs.python.org/file33319/test+except-close.patch

___
Python tracker 

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



[issue13881] Stream encoder for zlib_codec doesn't use the incremental encoder

2014-01-05 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue20132] Many incremental codecs don’t handle fragmented data

2014-01-05 Thread Martin Panter

New submission from Martin Panter:

Many of the incremental codecs do not handle fragmented data very well. In the 
past I think I was interested in using the Base-64 and Quoted-printable codecs, 
and playing with other codecs today reveals many more issues. A lot of the 
issues reflect missing functionality, so maybe the simplest solution would be 
to document the codecs that don’t work.

Incremental decoding issues:

>>> str().join(codecs.iterdecode(iter((b"\\", b"u2013")), "unicode-escape"))
UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 0: 
\ at end of string
# Same deal for raw-unicode-escape.

>>> bytes().join(codecs.iterdecode(iter((b"3", b"3")), "hex-codec"))
binascii.Error: Odd-length string

>>> bytes().join(codecs.iterdecode(iter((b"A", b"A==")), "base64-codec"))
binascii.Error: Incorrect padding

>>> bytes().join(codecs.iterdecode(iter((b"=", b"3D")), "quopri-codec"))
b'3D'  # Should return b"="

>>> codecs.getincrementaldecoder("uu-codec")().decode(b"begin ")
ValueError: Truncated input data

Incremental encoding issues:

>>> e = codecs.getincrementalencoder("base64-codec")(); 
>>> codecs.decode(e.encode(b"1") + e.encode(b"2", final=True), "base64-codec")
b'1'  # Should be b"12"

>>> e = codecs.getincrementalencoder("quopri-codec")(); e.encode(b"1" * 50) + 
>>> e.encode(b"2" * 50, final=True)
b'1122'
# I suspect the line should have been split in two

>>> e = codecs.getincrementalencoder("uu-codec")(); 
>>> codecs.decode(e.encode(b"1") + e.encode(b"2", final=True), "uu-codec")
b'1'  # Should be b"12"

I also noticed iterdecode() does not work with “uu-codec”:

>>> bytes().join(codecs.iterdecode(iter((b"begin 666 \n \nend\n",)), 
>>> "uu-codec"))
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.3/codecs.py", line 1032, in iterdecode
output = decoder.decode(b"", True)
  File "/usr/lib/python3.3/encodings/uu_codec.py", line 80, in decode
return uu_decode(input, self.errors)[0]
  File "/usr/lib/python3.3/encodings/uu_codec.py", line 45, in uu_decode
raise ValueError('Missing "begin" line in input data')
ValueError: Missing "begin" line in input data

And iterencode() does not work with any of the byte encoders, because it does 
not know what kind of empty string to pass to 
IncrementalEncoder.encode(final=True):

>>> bytes().join(codecs.iterencode(iter(()), "base64-codec"))
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.3/codecs.py", line 1014, in iterencode
output = encoder.encode("", True)
  File "/usr/lib/python3.3/encodings/base64_codec.py", line 31, in encode
return base64.encodebytes(input)
  File "/usr/lib/python3.3/base64.py", line 343, in encodebytes
raise TypeError("expected bytes, not %s" % s.__class__.__name__)
TypeError: expected bytes, not str

Finally, incremental UTF-7 encoding is suboptimal, and the decoder seems to 
buffer unlimited data, both defeating the purpose of using an incremental codec:

>>> bytes().join(codecs.iterencode("\xA9" * 2, "utf-7"))
b'+AKk-+AKk-'  # b"+AKkAqQ-" would be better

>>> d = codecs.getincrementaldecoder("utf-7")()
>>> d.decode(b"+")
b''
>>> any(d.decode(b"" * 10) for _ in range(10))
False  # No data returned: everything must be buffered
>>> d.decode(b"-") == "\x00" * 300
True  # Returned all buffered data in one go

--
components: Library (Lib)
messages: 207374
nosy: vadmium
priority: normal
severity: normal
status: open
title: Many incremental codecs don’t handle fragmented data
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



[issue8796] Deprecate codecs.open()

2014-01-05 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue19548] 'codecs' module docs improvements

2014-01-05 Thread Martin Panter

Martin Panter added the comment:

Addition to the list of improvements:

* Under codecs.IncrementalEncoder.reset() it mentions calling encode('', 
final=True). This call does not work as written for the byte encoders in my 
experience, because they do not accept empty text strings. Perhaps it should 
just say to use the final=True flag with no data.

--
nosy: +vadmium

___
Python tracker 

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



[issue19885] lzma segfault when __init__ with non-existent file after executing the constructor (Python 2.7)

2014-01-05 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Okay, sorry guys. The python 2.7 lzma binding is Fedora specific one. I already 
submitted bug there: https://bugzilla.redhat.com/show_bug.cgi?id=1048581

--
resolution:  -> invalid
status: pending -> open

___
Python tracker 

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



[issue19885] lzma segfault when __init__ with non-existent file after executing the constructor (Python 2.7)

2014-01-05 Thread Vajrasky Kok

Changes by Vajrasky Kok :


--
status: open -> closed

___
Python tracker 

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



[issue20130] asyncio: implement a synchronous executor if concurrent.futures is missing

2014-01-05 Thread Antoine Pitrou

Antoine Pitrou added the comment:

That doesn't sound like a very good idea, only to support FreeBSD 6. 
Synchronous execution blocks the event loop waiting for I/O, which basically 
destroys the point of having an event loop.
Let users of FreeBSD 6 upgrade their systems instead, IMHO.

--
nosy: +pitrou

___
Python tracker 

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



[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2f81f0e331f6 by Ethan Furman in branch 'default':
Issue19995: %o, %x, %X now only accept ints
http://hg.python.org/cpython/rev/2f81f0e331f6

--
nosy: +python-dev

___
Python tracker 

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



[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Ethan Furman

Ethan Furman added the comment:

I was travelling yesterday and wasn't sure about the time stamp.  Looks like I 
missed the 12-hour cutoff.  Let me know if I should backout the commit.

--

___
Python tracker 

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



[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ethan, I thought we were going the deprecation route?
This *will* break code.

--

___
Python tracker 

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



[issue13153] IDLE crashes when pasting non-BMP unicode char on Py3

2014-01-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, it is still the same issue. The root of issue is in converting strings 
when passed to Python-implemented callbacks. When a text is pasted in IDLE 
window, the callback is called (for highlighting). The callback is a command 
created by Tcl_CreateCommand from PythonCmd. PythonCmd is a wrapper which 
converts arguments (char*) to Python strings and then pass them to Python 
command. Arguments are encoded in "modified UTF-8" [1], i.e. the NUL character 
is represented as \xc0\x80, they can contains other invalid UTF-8 sequences 
(such as encoded surrogates). When decoding arguments to Python strings are 
failed, main Tcl loop is broken and IDLE silently closed.

When astral character is pasted on Windows, it first encoded to UTF-16 by 
Windows, then Tcl encodes every 16-bit surrogate to modified UTF-8. The result 
is not valid UTF-8. On X Window systems the X selection value usually is UTF-8 
encoded (the type is UTF8_STRING), but can contains invalid UTF-8 sequences.

I will open separate issue to fix other bugs related to Tcl <-> Python string 
conversions. The last patch fixes only initial issue which is most important.

[1] http://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8

--

___
Python tracker 

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



[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Antoine Pitrou

Antoine Pitrou added the comment:

(also, there are typos: "shuld", "psuedo")

--

___
Python tracker 

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



[issue20132] Many incremental codecs don’t handle fragmented data

2014-01-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +doerwalter, haypo, lemburg, loewis, ncoghlan

___
Python tracker 

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



[issue19548] 'codecs' module docs improvements

2014-01-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +doerwalter

___
Python tracker 

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



[issue13881] Stream encoder for zlib_codec doesn't use the incremental encoder

2014-01-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +doerwalter, lemburg, loewis

___
Python tracker 

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



[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Larry Hastings

Larry Hastings added the comment:

Antoine: I made the call to bite the bullet and fix it.  If that's a terrible 
idea we can change it before RC1.  But from my (admittedly dim) understanding 
of the issue, we're going to have to fix this sooner or later, and sooner is 
probably better.

If by permitting this I've made a terrible mistake, could you do me a favor and 
summarize the issue and the alternatives so I can understand it?

--

___
Python tracker 

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



[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Larry Hastings

Larry Hastings added the comment:

And, yes, Ethan's checkin missed the cutoff for beta 2.

--

___
Python tracker 

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



[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Ethan Furman

Ethan Furman added the comment:

I think the code-breakage issue is that although this is a bug now, it did not 
use to be a bug.  (Or maybe it was always a bug, but nobody noticed -- I don't 
know when hex() and oct() were introduced.)

Basically, having %o and %x work with floats was the intended behavior, as 
there were tests to make sure it worked.

But hex() and oct() were designed to only work with integer types, resulting in 
two ways to get an octal or hexadecimal string, one of which worked with 
non-ints, and one which didn't.

tarfile.py, for example, was using %o to convert a stat member (a timestamp?) 
from int/float to octal.

It is agreed that working with non-ints is no longer the intended behavior, but 
there is undoubtedly code that uses it -- especially in cases where the return 
value could be either an int or a float.

--

___
Python tracker 

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



[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread R. David Murray

R. David Murray added the comment:

Given that even the stdlib used it, there is no question in my mind that a 
deprecation period is required.  We don't just arbitrarily break peoples code 
on purpose, we give them at least a release in which to fix it first.

--

___
Python tracker 

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



[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Keep in mind that with new-style division, it's easy to get a float even if all 
your inputs are ints.

--

___
Python tracker 

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



[issue20130] asyncio: implement a synchronous executor if concurrent.futures is missing

2014-01-05 Thread STINNER Victor

STINNER Victor added the comment:

2014/1/5 Antoine Pitrou :
> That doesn't sound like a very good idea, only to support FreeBSD 6.

Well, if the patch is rejected here, I will propose it in Tulip, or I
will keep it only in Trollius (the port on Python 2.7).

The idea of this issue was discussed on the python-tulip group and
approved by Guido van Rossum:
https://groups.google.com/forum/#!msg/python-tulip/1CbjmZTXINM/pR-_CVga7bUJ

> Synchronous execution blocks the event loop waiting for I/O, which basically 
> destroys the point of having an event loop.

asyncio only uses the executor to resolve host names. Resolution is
usually fast, and you may only resolve a name once at startup. But I
agree that it's slower than supporting asynchronous resolution.

I hope that asyncio will get its down asynchronous DNS resolver! There
are existing projects:
https://pyuv.readthedocs.org/en/release-0.6.1/dns.html (Asynchronous
DNS resolver using c-ares for pyuv)
http://code.google.com/p/asyncdns/
https://code.google.com/p/adns-python/ (Python interface to GNU adns
asynchronous resolver library)
etc.

> Let users of FreeBSD 6 upgrade their systems instead, IMHO.

Well, sometimes you don't have the choice of your OS :-)

--

___
Python tracker 

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



[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Ethan Furman

Ethan Furman added the comment:

I'll switch it to a deprecation warning instead sometime this week.

The changes to datamodel.rst and tarfile.py should stay, I think.

test_format and test_unicode will both verify current* behavior and check for 
the deprecation warning, and unicodeobject.c will generate the warning but keep 
current behavior.

Once 3.5 is tagged I'll put the updates to these three files there.


* By 'current' I mean accepting non-ints.

--
versions: +Python 3.5

___
Python tracker 

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



[issue20131] warnings module offers no documented, programmatic way to reset "seen-warning" flag

2014-01-05 Thread R. David Murray

R. David Murray added the comment:

The easy answer for unittest is to use assertWarns.  For versions where that 
doesn't exist you could implement the same technique yourself.  Exposing a 
'clear everything' function in the warnings module might not be a bad idea, but 
otherwise for doctest I'd think the catch_warnings context manager would be the 
correct answer, and that is documented.

Given the above, I guess this issue is a request to expose a "clear everything" 
function in the warnings module, which I think is a reasonable idea.

(I think it would be nice to add some support stuff to doctest to make things 
like this easier, but that is a totally separate issue.)

--
nosy: +brett.cannon, r.david.murray
versions: +Python 3.5 -Python 2.7, Python 3.4

___
Python tracker 

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



[issue20126] sched doesn't handle events added after scheduler starts

2014-01-05 Thread lo...@blossomhillranch.com

lo...@blossomhillranch.com added the comment:

i saw that issue before i submitted this one, but it says it was fixed a year 
ago. i assumed a patch from a year ago would be in 3.3.1.

when i see an issue closed with a patch accepted, how do i determine which 
python version will contain that patch?

--

___
Python tracker 

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



[issue20130] asyncio: implement a synchronous executor if concurrent.futures is missing

2014-01-05 Thread STINNER Victor

STINNER Victor added the comment:

Here is an implementation of a synchrounous executor:
https://bitbucket.org/haypo/trollius/commits/1bc2c23854e6717007a5a6df42470afa49c79b99

The changes are larger than what I expected. On Python 3.4, if 
concurrent.futures is only missing on FreeBSD 6, I agree that it's ok to ask 
users to upgrade their OS.

@Guido: Are you interested by this change, since Tulip requires at least Python 
3.3 which has also concurrent.futures?

The fallback is probably only needed by the Trollius project in practice.

--

___
Python tracker 

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



[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Merely from reading the docs, including the hex() and {}.format sections, I 
consider the current
  '%x' % 1.5 == '1'
a bug in that I would expect either a Type or Value Error
or a hex fraction(!) ('1,8') matching the core of the output of float.hex(1.5). 
But given the history, I agree that a deprecation notice is needed first.

In 3.3 section 6.1.3.1. Format Specification Mini-Language, integer and float 
conversions are in separate tables, so no confusion is possible. In 3.3 section 
4.7.2. printf-style String Formatting there is just one table with all 
conversion chars. I think the table would be clearer if it were somehow split 
into three sections: perhaps 3 otherwise blank rows containing  'integer', 
'float', and 'other' in the Conversion column. (I don't know if this works for 
.rst tables.)

I think I would change the table for 3.4 with a note 8 that 'o', 'x', and 'X' 
currently accept floats by calling int() on the value, but that this implicit 
behavior is deprecated, so one should be explicit. The DeprecationWarning 
should also give the same remedy.

--

___
Python tracker 

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



[issue20130] asyncio: implement a synchronous executor if concurrent.futures is missing

2014-01-05 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Here is an implementation of a synchrounous executor:
> https://bitbucket.org/haypo/trollius/commits/1bc2c23854e6717007a5a6df42470afa49c79b99

Where is executor.py?

--

___
Python tracker 

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



[issue20130] asyncio: implement a synchronous executor if concurrent.futures is missing

2014-01-05 Thread STINNER Victor

STINNER Victor added the comment:

> Where is executor.py?

Hum, maybe I forgot to push it :-)

https://bitbucket.org/haypo/trollius/src/tip/asyncio/executor.py?at=trollius

Code of the synchronous executor:

https://bitbucket.org/haypo/trollius/src/8f28756d63c2c9f09c3a7c1df420796eca9ff08b/asyncio/executor.py?at=trollius#cl-60

I only defined methods used by asyncio. I didn't try to implement the full API 
(ex: it's not possible to cancel a Future).

--

___
Python tracker 

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



[issue20130] asyncio: implement a synchronous executor if concurrent.futures is missing

2014-01-05 Thread STINNER Victor

STINNER Victor added the comment:

> https://bitbucket.org/haypo/trollius/src/8f28756d63c2c9f09c3a7c1df420796eca9ff08b/asyncio/executor.py?at=trollius#cl-60

Oh, there was a forgotten "raise" instruction. I added it to test the
exception case, but it looks like this case is not tested by asyncio
test suite. (I just removed the "raise" instruction.)

--

___
Python tracker 

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



[issue1322] platform.dist() has unpredictable result under Linux

2014-01-05 Thread Matthias Klose

Matthias Klose added the comment:

Victor, what should be returned if the code name is not set? None, empty 
string, or the description field of the lsb-release file?

--

___
Python tracker 

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



[issue19732] python fails to build when configured with --with-system-libmpdec

2014-01-05 Thread Stefan Krah

Stefan Krah added the comment:

I’ve released mpdecimal-2.4.0:

http://www.bytereef.org/mpdecimal/download.html


sha256sum:
==

996c73b63868699c4f86694671bd7ff3d1a8a88d8af2c22a5abe0c9a5845cf75  
mpdecimal-2.4.0.tar.gz


On obscure architectures I would recommend to run `make check` (leaves asserts 
in!).


The fastest binaries are generated with:

./configure CFLAGS=-DNDEBUG
make profile


The -flto option appears to slow things down, -O3 instead of -O2
is the same or slightly worse in my experience.

--

___
Python tracker 

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



[issue19732] python fails to build when configured with --with-system-libmpdec

2014-01-05 Thread Stefan Krah

Changes by Stefan Krah :


--
resolution:  -> fixed
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



[issue1065986] Fix pydoc crashing on unicode strings

2014-01-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bf077fc97fdd by R David Murray in branch '2.7':
#1065986: Make pydoc handle unicode strings.
http://hg.python.org/cpython/rev/bf077fc97fdd

--
nosy: +python-dev

___
Python tracker 

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



[issue1065986] Fix pydoc crashing on unicode strings

2014-01-05 Thread R. David Murray

R. David Murray added the comment:

Committed, thanks Akira.

The support for --disable-unicode is not fully tested.  I tried running the 
tests but the _io module wasn't built, so regrtest doesn't work.  A command 
line invocation of pydoc worked fine, though.

--
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



[issue20133] Convert the audioop module to use Argument Clinic

2014-01-05 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Here is a patch which converts the audioop module to use Argument Clinic. 26 
functions are converted. Also it adds docstrings for audioop functions.

There are two problems:

* Test test_string crashes. Perhaps here is a bug in Argument Clinic (Py_buffer 
arguments are not initialized).

* Pydoc for ratecv (and only for this function) returns:

ratecv = 

--
components: Extension Modules
files: audioop_clinic.patch
keywords: patch
messages: 207401
nosy: larry, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Convert the audioop module to use Argument Clinic
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file33320/audioop_clinic.patch

___
Python tracker 

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



[issue19944] Make importlib.find_spec load packages as needed

2014-01-05 Thread Brett Cannon

Brett Cannon added the comment:

Moving to importlib.util is fine by me. I put find_loader() to mirror 
import_module(), but honestly the former is much less used compared to the 
latter, so moving it to importlib.util makes sense.

--

___
Python tracker 

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



[issue1065986] Fix pydoc crashing on unicode strings

2014-01-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e57660acc6d4 by R David Murray in branch '2.7':
#1065986: add missing error handler in pydoc unicode fix.
http://hg.python.org/cpython/rev/e57660acc6d4

--

___
Python tracker 

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



[issue20125] We need a good replacement for direct use of load_module(), post-PEP 451

2014-01-05 Thread Brett Cannon

Brett Cannon added the comment:

I say just be patient and wait. No need to rush this as load_module() is still 
allowed to exist and be used. And if I manage to create SpecLoader than even 
new-fangled loaders and get load_module() for free.

--

___
Python tracker 

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



[issue20126] sched doesn't handle events added after scheduler starts

2014-01-05 Thread R. David Murray

R. David Murray added the comment:

Search for the issue number in Misc/NEWS.  It looks like it was indeed included 
in 3.3.1.  Can you figure out why that fix didn't fix your problem?

--
resolution: duplicate -> 
stage: committed/rejected -> 
status: closed -> open
superseder: sched.scheduler.run() blocks scheduler -> 

___
Python tracker 

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



[issue20126] sched doesn't handle events added after scheduler starts

2014-01-05 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue20126] sched doesn't handle events added after scheduler starts

2014-01-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is because the scheduler already has executed first event and slept on 
delaying second event before you have added third event. This is unavoidable 
for this implementation.  sched.scheduler can't be waked when sleep.

--

___
Python tracker 

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



[issue20126] sched doesn't handle events added after scheduler starts

2014-01-05 Thread lo...@blossomhillranch.com

lo...@blossomhillranch.com added the comment:

i looks like a different issue. 16165 says you can't add events while the 
scheduler is running. in my case, i can add them, but they don't run at the 
correct time.

i'll guess at what the problem is... when you start the scheduler, the thread 
sleeps until the first scheduled event. when you add an event after the 
scheduler is running, the scheduler doesn't re-evaluate how long it should 
sleep. sched.enter(), sched.enterabs(), and sched.cancel() should probably send 
a signal to the scheduler thread to recalculate the time of the next event.

--

___
Python tracker 

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



[issue20126] sched doesn't handle events added after scheduler starts

2014-01-05 Thread lo...@blossomhillranch.com

lo...@blossomhillranch.com added the comment:

ok, makes sense. can we put a note in the manual about this limitation?

--

___
Python tracker 

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



[issue20134] typo: s/coping/copying/

2014-01-05 Thread INADA Naoki

New submission from INADA Naoki:

http://docs.python.org/3.3/library/unittest.mock-examples.html#coping-with-mutable-arguments
"coping" should be "copying"?

--
assignee: docs@python
components: Documentation
messages: 207409
nosy: docs@python, naoki
priority: normal
severity: normal
status: open
title: typo: s/coping/copying/
versions: Python 2.7, 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



[issue20135] mutate list

2014-01-05 Thread Xiaoqing Rong

New submission from Xiaoqing Rong:

I was using IDLE (Python GUI) for Python 3.3.3. I don't know if this is a bug 
or you guys intend it to be this way:

>>> x=[1,2]
>>> y=x
>>> y.append(3)
>>> x
[1, 2, 3]

personally i'd prefer x stays as [1,2] when i'm trying to mutate y

also:
>>> def f1(m,n=['haha']):
if m==n:
print('m==n')
else:
print('m!=n')
n.append('yaya')

>>> f1(['haha'])
m==n
>>> f1(['haha'])
m!=n

I'd prefer getting consistent results when calling functions like f1

--
messages: 207410
nosy: m123orning
priority: normal
severity: normal
status: open
title: mutate list
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



[issue20135] mutate list

2014-01-05 Thread R. David Murray

R. David Murray added the comment:

Both of these are FAQs, but to my surprise there don't seem to be answers to 
them in the FAQ list.  We should add some.

Yes, both of these behaviors is intentional.  The first is an important part of 
the language design: 'variable' names are just pointers to objects, so x and y 
point to the same object.  The second is the same issue combined with another 
design feature: the objects on the right side of the = in a def statement are 
evaluated/created at the time the def statement is executed, not at the time 
the function is called.  So 'n' points to the same object every time the 
function is called.

I'm going to leave this open until someone either points me to the FAQ entries 
I missed, or we add them.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, r.david.murray
versions: +Python 2.7, Python 3.4

___
Python tracker 

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



[issue20134] typo: s/coping/copying/

2014-01-05 Thread Benjamin Peterson

Benjamin Peterson added the comment:

No, see https://en.wiktionary.org/wiki/cope

--
nosy: +benjamin.peterson
resolution:  -> later
status: open -> closed

___
Python tracker 

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



[issue20134] typo: s/coping/copying/

2014-01-05 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
resolution: later -> invalid

___
Python tracker 

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



[issue20121] quopri_codec newline handling

2014-01-05 Thread Vajrasky Kok

Vajrasky Kok added the comment:

The quopri_codec uses binascii.b2a_qp method.

>>> binascii.b2a_qp('\r\n\n\n\n')
'\r\n\r\n\r\n\r\n'

The logic in b2a_qp when dealing with newlines is check whether the first line 
uses \r\n or \n.

If it uses \r\n, then all remaning lines' new lines will be converted to \r\n. 
if it uses \n, then all remaning lines' new lines will be converted to \n.

It has comment on the source code.

/* See if this string is using CRLF line ends */
/* XXX: this function has the side effect of converting all of
 * the end of lines to be the same depending on this detection
 * here */

I am not sure what the appropriate action here. But doc fix should be 
acceptable.

--
nosy: +vajrasky

___
Python tracker 

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



[issue19977] Use "surrogateescape" error handler for sys.stdin and sys.stdout on UNIX for the C locale

2014-01-05 Thread Bohuslav "Slavek" Kabrda

Bohuslav "Slavek" Kabrda added the comment:

Nick: Sure, once there is an upstream solution that people have agreed on, I'll 
look into backporting it, NP. Thanks for letting me know about this.

--

___
Python tracker 

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