[issue22406] uu-codec trailing garbage workaround is Python 2 code

2014-09-14 Thread Martin Panter

Changes by Martin Panter :


Added file: http://bugs.python.org/file36619/uu_codec

___
Python tracker 

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



[issue22406] uu-codec trailing garbage workaround is Python 2 code

2014-09-14 Thread Martin Panter

Martin Panter added the comment:

Here are two patches: a test and a fix. I’m not sure if it is okay to add a 
test for the “codecs” module with the tests for the “uu” module; it was easier 
that way because I am basically running the same test over the two different 
APIs.

--
Added file: http://bugs.python.org/file36618/test

___
Python tracker 

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



[issue18159] ConfigParser getters not available on SectionProxy

2014-09-14 Thread Łukasz Langa

Changes by Łukasz Langa :


--
versions: +Python 3.5 -Python 3.4

___
Python tracker 

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



[issue22414] I'd like to add you to my professional network on LinkedIn

2014-09-14 Thread Georg Brandl

Changes by Georg Brandl :


--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue22414] I'd like to add you to my professional network on LinkedIn

2014-09-14 Thread VUIUI

New submission from VUIUI:

Hi,

I'd like to add you to my professional network on LinkedIn.

- Sói

Accept: 
http://www.linkedin.com/blink?simpleRedirect=38RdP0VczsRe3gQd38ScjsNejkZh4BKrSBQonhFtCVF9z5KjmdKiiQJfnBBiShBsC5EsOpQsSlRpRZBt6BSrCAZqSkConhzbmlQqnpKqiRQsSlRpORIrmkZpSVFqSdxsDgCpnhFtCV9pSlipn9Mfm4CsPgJc3ByumkPc6AJcSlKoT4PbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I7888360485_1&markAsRead=

You received an invitation to connect. LinkedIn will use your email address to 
make suggestions to our members in features like People You May Know. 
Unsubscribe here: 
http://www.linkedin.com/blink?simpleRedirect=pT9Lhj8BrCZEt7BMhj8BsStRoz0Q9nhOrT1BszRIqm5JpipQs64MczxGcTdSpP9IcDoZp6Bx9z4Sc30OfmhF9z4JfmhFripPd2QMem9VpjcMqiQPpmVzsjcJfmhFpipQsSlRpRZBt6BSrCAZqSkCkjoPp4l7q5p6sCR6kk4ZrClHrRhAqmQCsSVRfngCsPgJc3ByumkPc6AJcSlKoT4PbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I7888360485_1&markAsRead=
 Learn why we included this at the following link: 
http://www.linkedin.com/blink?simpleRedirect=e3wTd3RAimlIoSBQsC4Ct7dBtmtvpnhFtCVFfmJB9CNOlmlzqnpOpldOpmRLt7dRoPRx9DcQbj0VoDBBcP1FbjdBrCdNcOQZpjYOtyZBbSRLoOVKqmhBqSVFr2VTtTsLbPFMt7hE&msgID=I7888360485_1&markAsRead=
© 2014, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043, 
USA

--
messages: 226897
nosy: VUIUI
priority: normal
severity: normal
status: open
title: I'd like to add you to my professional network on LinkedIn

___
Python tracker 

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



[issue15216] Support setting the encoding on a text stream after creation

2014-09-14 Thread Martin Panter

Martin Panter added the comment:

Some more use cases for temporarily switching error handler in the middle of 
writing to a stream:
* Possibly simplify the implementation of sys.displayhook()
* I have done a similar hack at 
,
 to output a comment field with a permissive error handler, while other data is 
output with strict error handling.

A use case for changing a reader’s newline translation mode is to use standard 
input with the built-in “csv” module. My current idea is to do something like 
this:

encoding = sys.stdin.encoding
errors = sys.stdin.errors
line_buffering = sys.stdin.line_buffering
# No way to retain write_through mode, but shouldn’t matter for reading
sys.stdin = TextIOWrapper(sys.stdin.detach(), encoding, errors,
newline="", line_buffering=line_buffering)

for row in csv.reader(sys.stdin):
...

On the other hand, I wonder about rewinding an input file after already having 
read and buffered text in the wrong encoding. From a distance, the Python 
native version of the code seems rather complex and full of dark magic. Is 
there a use case, or maybe it would be simpler to have it only work when 
nothing has been read or buffered?

--
nosy: +vadmium

___
Python tracker 

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



[issue22413] Bizarre StringIO(newline="\r\n") translation

2014-09-14 Thread Martin Panter

New submission from Martin Panter:

I noticed that the newline translation in the io.StringIO class does not behave 
as I would expect:

>>> text = "NL\n" "CRLF\r\n" "CR\r" "EOF"
>>> s = StringIO(text, newline="\r\n")
>>> s.getvalue()
'NL\r\nCRLF\r\r\nCR\rEOF'  # Why is this not just equal to “text”?
>>> tuple(s)
('NL\r\n', 'CRLF\r\r\n', 'CR\rEOF')  # Too many lines, butchered EOL sequence
>>> tuple(TextIOWrapper(BytesIO(text.encode("ascii")), "ascii", newline="\r\n"))
('NL\nCRLF\r\n', 'CR\rEOF')  # This seems more reasonable

Although I have never had a use for newline="\r", it also seems broken:

>>> tuple(StringIO(text, newline="\r"))
('NL\r', 'CRLF\r', '\r', 'CR\r', 'EOF')  # Way too many lines
>>> tuple(TextIOWrapper(BytesIO(text.encode("ascii")), "ascii", newline="\r"))
('NL\nCRLF\r', '\nCR\r', 'EOF')

The other newline options ("\n", "", and None) seem to behave correctly though. 
There seem to be quite a few bug reports to do with newline translation in 
StringIO, but I couldn’t see anything specifically about this one. However the 
issue was mentioned at .

I noticed there are test cases which appear to bless the current behaviour, as 
seen in the patch for Issue 20498. IMO these tests are wrong.

--
components: IO
messages: 226895
nosy: vadmium
priority: normal
severity: normal
status: open
title: Bizarre StringIO(newline="\r\n") translation
type: behavior
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



[issue17095] Modules/Setup *shared* support broken

2014-09-14 Thread Ned Deily

Changes by Ned Deily :


--
priority: release blocker -> normal

___
Python tracker 

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



[issue17095] Modules/Setup *shared* support broken

2014-09-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 781454f792c4 by Ned Deily in branch '3.4':
Issue #17095: Temporarily revert getpath.c change that added the Modules
https://hg.python.org/cpython/rev/781454f792c4

New changeset d3939f602e1f by Ned Deily in branch 'default':
Issue #17095: merge from 3.4
https://hg.python.org/cpython/rev/d3939f602e1f

--

___
Python tracker 

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



[issue22411] Embedding Python on Windows

2014-09-14 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +loewis

___
Python tracker 

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



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

2014-09-14 Thread Ned Deily

Ned Deily added the comment:

I don't have a real Windows setup to test but I would guess this may be Tk 
behavior.  Perhaps the Tk wiki page on platform-specific keyboard modifier 
behaviors will help:

http://wiki.tcl.tk/28331

--
nosy: +ned.deily

___
Python tracker 

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



[issue21998] asyncio: a new self-pipe should be created in the child process after fork

2014-09-14 Thread Yury Selivanov

Yury Selivanov added the comment:

> Is there a use case for sharing an event loop across forking?

I don't think so.  I use forking mainly for the following two use-cases:

- Socket sharing for web servers. Solution: if you want to have a shared 
sockets between multiple child processes, just open them in master process, 
fork as many times as you want, and start event 
loops in child processes only.

- If sometimes you want to spawn some child process "on demand". Solution: fork 
before having a loop running, and use the child process as a "template", i.e. 
when you need a new child process - just ask the first child to fork it.

It would certainly be handy to have an ability to fork while the loop is 
running and safely close (and reopen) it in the forked child process. But now I 
can see that it's a non-trivial thing to do properly. Probably it's ~somewhat~ 
safe to re-initialize epoll (or whatever selector we use), re-open self-pipe 
etc, drop all queued callbacks and clear Task.all_tasks collection, but even 
then it's easy to miss something.

I think we just need to make sure that we have documented that asyncio loops 
are not fork safe, and forks in running loops should be avoided by all means.

--

___
Python tracker 

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



[issue18844] allow weights in random.choice

2014-09-14 Thread Christian Kleineidam

Christian Kleineidam added the comment:

I like the idea of adding a weights keyword to choice and creating an 
additional choice_generator() that also takes weights.

A choice_generator() could take a further argument to allow unique choices and 
be a generator version of sample().

In some cases you want to draw randomly from a sequence till you draw an item 
that fulfills certain criteria. At the moment neither the sample nor the 
shuffle method seems to be optimal for that use case.

Given that items are commonly drawn from an urn in math, urn seems a good 
alternative for choice_generator().

random.urn(data, *, weights=None, unique=False)

--
nosy: +Christian.Kleineidam

___
Python tracker 

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



[issue11437] IDLE crash on startup with typo in config-keys.cfg

2014-09-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

https://stackoverflow.com/questions/25750477/python-2-7-8-idle-will-not-open-on-mavericks
 -- because one of the two files has 'shift' instead of Shift.  When I make a 
change in either file (with custom keys being used), the traceback ends 
slightly differently until the final message.

  File "C:\Programs\Python34\lib\idlelib\EditorWindow.py", line 1100, in 
apply_bindings
text.event_add(event, *keylist)
  File "C:\Programs\Python34\lib\idlelib\MultiCall.py", line 379, in event_add
widget.event_add(self, virtual, seq)
  File "C:\Programs\Python34\lib\tkinter\__init__.py", line 1441, in event_add
self.tk.call(args)

#21519 is about checking bindings entered in the dialog with either the basic 
or advanced methods.  Bindings also need to be checked when read so we know 
which file is bad.  Exception tracebacks should be replaced by more helpful 
messages that include fix-up instructions and which do not disappear into the 
void when running on pythonw.

--

___
Python tracker 

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



[issue21998] asyncio: a new self-pipe should be created in the child process after fork

2014-09-14 Thread Guido van Rossum

Guido van Rossum added the comment:

Actually I expect that if you share an event loop across different processes 
via form, everything's a mess -- whenever a FD becomes ready, won't both the 
parent and the child be woken up?  Then both would attempt to read from it.  
One would probably get EWOULDBLOCK (assuming all FDs are actually in 
non-blocking mode) but it would still be a mess.  The specific mess for the 
self-pipe would be that the race condition it's intended to solve might come 
back.

It's possible that some polling syscall might have some kind of protection 
against forking, but the Python data structures that map FDs to handlers don't 
know that, so it would still be a mess.

Pretty much the only thing you should expect to be able to do safely after 
forking is closing the event loop -- and I'm not even 100% sure that that's 
safe (I don't know what happens to a forked executor).

Is there a use case for sharing an event loop across forking?

--

___
Python tracker 

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



[issue22412] Towards an asyncio-enabled command line

2014-09-14 Thread Guido van Rossum

Guido van Rossum added the comment:

1. Great that you're trying to implement this!

2. But I really recommend that you try to structure this as a 3rd party module 
first rather than patching the Python distribution -- it's much harder to get 
accepted.  Or as a pure-Python patch to asyncio, rather than patching the 
interpreter's C code.

3. Which Python version did you use as a starting point?  The patch doesn't 
apply cleanly to the repo head for either Python 3.4 or 3.5.  If you used a 
source distribution, please switch to the Mercurial repo.  I recommend 3.5, as 
this is a new feature.

4. If you really want to patch Python, you need to add docs.  In fact, I 
recommend writing the docs first.

5. What on earth is going on in your input() coroutine?  You create a Future 
and then immediately yield from it.  How is it becoming done?

6. Surely all that C code you are adding to readline.c was copied from some 
other place.  From where?  Perhaps it can be refactored rather than copied?

7. See #2.

--

___
Python tracker 

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



[issue22412] Towards an asyncio-enabled command line

2014-09-14 Thread Martin Teichmann

New submission from Martin Teichmann:

This patch is supposed to facilitate using the asyncio 
package on the command line. It contains two things:

First, a coroutine version of builtin.input, so that
it can be called while a asyncio event loop is running.

Secondly, it adds a new flag to builtin.compile which
allows to use the yield and yield from statements on 
the module level, making compile always return a generator.

The latter part will enable us to run commands like the
following on the command line:

>>> from asyncio import sleep
>>> yield from sleep(3)

(This has been discussed on python-ideas,
https://mail.python.org/pipermail/python-ideas/2014-September/029293.html)

--
components: Interpreter Core, asyncio
files: patch
messages: 226887
nosy: Martin.Teichmann, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: Towards an asyncio-enabled command line
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file36617/patch

___
Python tracker 

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



[issue20537] logging exc_info parameter should accept exception instances

2014-09-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9d54903a84b5 by Vinay Sajip in branch 'default':
Closes #20537: logging methods now accept an exception instance as well as a 
Boolean value or exception tuple. Thanks to Yury Selivanov for the patch.
https://hg.python.org/cpython/rev/9d54903a84b5

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue11204] re module: strange behaviour of space inside {m, n}

2014-09-14 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> rejected
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue17668] re.split loses characters matching ungrouped parts of a pattern

2014-09-14 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> not a bug
stage: needs patch -> resolved
status: pending -> closed

___
Python tracker 

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



[issue22384] Tk.report_callback_exception kills process when run with pythonw.exe

2014-09-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Aivar for helpful report.

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

___
Python tracker 

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



[issue22384] Tk.report_callback_exception kills process when run with pythonw.exe

2014-09-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for suggested docstring Terry. There is related question on 
StackOverflow:

http://stackoverflow.com/questions/4770993/silent-exceptions-in-python-tkinter-should-i-make-them-louder-how

--

___
Python tracker 

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



[issue22384] Tk.report_callback_exception kills process when run with pythonw.exe

2014-09-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 994a16b51544 by Serhiy Storchaka in branch '2.7':
Issue #22384: An exception in Tkinter callback no longer crashes the program
https://hg.python.org/cpython/rev/994a16b51544

New changeset c62fad86fac3 by Serhiy Storchaka in branch '3.4':
Issue #22384: An exception in Tkinter callback no longer crashes the program
https://hg.python.org/cpython/rev/c62fad86fac3

New changeset 7191b14ca312 by Serhiy Storchaka in branch 'default':
Issue #22384: An exception in Tkinter callback no longer crashes the program
https://hg.python.org/cpython/rev/7191b14ca312

--
nosy: +python-dev

___
Python tracker 

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



[issue22411] Embedding Python on Windows

2014-09-14 Thread Joakim Karlsson

New submission from Joakim Karlsson:

When I embed Python 3.4 in an existing app, I run in to a few issues when our 
app is built in debug mode. I build against the headers, libs and dlls that I 
get when installing python, I don't build python myself.

1. When I include python.h it will, via pyconfig.h, automatically attempt to 
link to python34_d.lib. This lib, along with its accompanying dll is not 
included in the python installation.

I'd rather explicitly link to the release lib than having header files 
implicitly selecting libs based on the _DEBUG flag. I ended up killing the 
#pragma comment(lib...) statements in pyconfig.h, and I can now link with the 
lib included.

2. Now when I build, I get a linker error telling me that '__imp__Py_RefTotal' 
and '__imp_Py_NegativeRefCount' cannot be found. This seems to be caused by 
Py_DEBUG being defined automatically in pyconfig.h as a result of _DEBUG being 
defined for my application. This causes the reference counting macros to use 
functionality that is only present in the debug version of python34.dll.

I ended up including pyconfig.h first, undefed Py_DEBUG, and then including 
python.h. This seems rather clunky.

Keeping with "explicit is better than implicit", wouldn't it be better to 
having to explicitly link to the desired lib from the embedding app, and 
explicitly set Py_DEBUG without having it inferred from _DEBUG? 

That way the provided headers and libs would work right out of the box while 
still leaving me the option to get the debug behaviour if I need to.

--
components: Windows
messages: 226882
nosy: Joakim.Karlsson
priority: normal
severity: normal
status: open
title: Embedding Python on Windows
type: compile error
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



[issue22384] Tk.report_callback_exception kills process when run with pythonw.exe

2014-09-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

And yes, I am thinking about a broader fix for Idle -- replacing stderr None 
with something writable.

--

___
Python tracker 

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



[issue22384] Tk.report_callback_exception kills process when run with pythonw.exe

2014-09-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Since traceback.print_exception already uses print statememts, your patch *is* 
sufficient to trap the remaining stderr exception. Go ahead.

The doctring for report_callback_exception calls it an 'internal function'.  To 
me, that implies 'ignore this' rather than 'override this'.  I suggest changing 
the docstring to

"""Report callback exception on sys.stderr.

Applications may want to override this internal function, and should when 
sys.stderr is None.
"""

--

___
Python tracker 

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



[issue22409] namedtuples bug between 3.3.2 and 3.4.1

2014-09-14 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> third party
stage:  -> resolved

___
Python tracker 

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



[issue22409] namedtuples bug between 3.3.2 and 3.4.1

2014-09-14 Thread Brynjar Smári Bjarnason

Changes by Brynjar Smári Bjarnason :


--
status: open -> closed

___
Python tracker 

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



[issue22409] namedtuples bug between 3.3.2 and 3.4.1

2014-09-14 Thread Brynjar Smári Bjarnason

Brynjar Smári Bjarnason added the comment:

Thanks, I'll report it to Continuum IO.

--

___
Python tracker 

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



[issue22410] Locale dependent regexps on different locales

2014-09-14 Thread Matthew Barnett

Matthew Barnett added the comment:

The support for locales in the re module is limited to those with 1 byte per 
character, and only for a few properties (those provided by the underlying C 
library), so maybe it could do the following:

If the LOCALE flag is set, then read the current locale and build a table of 
its properties.

Let the compiled pattern refer to the property table.

When matching, use the property table referred to by the pattern.

--

___
Python tracker 

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



[issue22406] uu-codec trailing garbage workaround is Python 2 code

2014-09-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Do you want to provide a patch Martin?

--

___
Python tracker 

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



[issue22406] uu-codec trailing garbage workaround is Python 2 code

2014-09-14 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
keywords: +easy
nosy: +doerwalter, lemburg, serhiy.storchaka
priority: normal -> low
stage:  -> needs patch
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



[issue22384] Tk.report_callback_exception kills process when run with pythonw.exe

2014-09-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Error messages are already silenced if sys.stderr is None or closed.

>>> sys.stderr.close()
>>> 1/0
>>> 

>>> sys.stderr = None
>>> 1/0
>>> 

I think that such things as _Errbox are application level solutions. 
report_callback_exception() is designed to be overwritten for this purpose. 
Application can decide to pop up message box always, not only when sys.stderr 
is None, or tracebacks to a log, or add application icon and scrollbar on 
message box, or output error on special area on main windows.

Definitely it would be good to add something like _Errbox to IDLE. But this 
will be other issue. This issue is only about "crashing" of default 
implementation, and if my patch fixes it, I want to commit it and close the 
issue.

--

___
Python tracker 

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



[issue22409] namedtuples bug between 3.3.2 and 3.4.1

2014-09-14 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> so the result is an empty dict.

It works fine for me in the standard distribution:

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> from collections import namedtuple
>>> NT = namedtuple("NT",["a","b"])
>>> nt = NT(1,2)
>>> print(vars(nt))
OrderedDict([('a', 1), ('b', 2)])

There may be something amiss with the Anaconda distribution.  I suggest 
reporting this to Continuum IO (the producers of that distribution).

--

___
Python tracker 

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



[issue22410] Locale dependent regexps on different locales

2014-09-14 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Locale-specific case-insensitive regular expression matching works only when 
the pattern was compiled on the same locale as used for matching. Due to 
caching this can cause unexpected result.

Attached script demonstrates this (it requires two locales: ru_RU.koi8-r and 
ru_RU.cp1251). The output is:

locale ru_RU.koi8-r
  b'1\xa3' ('1ё') matches b'1\xb3' ('1Ё')
  b'1\xa3' ('1ё') doesn't match b'1\xbc' ('1╪')
locale ru_RU.cp1251
  b'1\xa3' ('1Ј') doesn't match b'1\xb3' ('1і')
  b'1\xa3' ('1Ј') matches b'1\xbc' ('1ј')
locale ru_RU.cp1251
  b'2\xa3' ('2Ј') doesn't match b'2\xb3' ('2і')
  b'2\xa3' ('2Ј') matches b'2\xbc' ('2ј')
locale ru_RU.koi8-r
  b'2\xa3' ('2ё') doesn't match b'2\xb3' ('2Ё')
  b'2\xa3' ('2ё') matches b'2\xbc' ('2╪')

b'\xa3' matches b'\xb3' on KOI8-R locale if the pattern was compiled on KOI8-R 
locale and matches b'\xb3' if the pattern was compiled on CP1251 locale.

I see three possible ways to solve this issue:

1. Avoid caching of locale-depending case-insensitive patterns. This definitely 
will decrease performance of the use of locale-depending case-insensitive 
regexps (if user don't use own caching) and may be slightly decrease 
performance of the use of other regexps.

2. Clear precompiled regexps cache on every locale change. This can look 
simpler, but is vulnerable to locale changes from extensions.

3. Do not lowercase characters at compile time (in locale-depending 
case-insensitive patterns). This needs to introduce new opcode for 
case-insensitivity matching or at least rewriting implementation of current 
opcodes (less efficient). On other way, this is more correct implementation 
than current one. The problem is that this is incompatible with those 
distributions which updates only Python library but not statically linked 
binary (e.g. Vim with Python support). May be there are some workarounds.

--
components: Extension Modules, Library (Lib), Regular Expressions
files: re_locale_caching.py
messages: 226874
nosy: ezio.melotti, mrabarnett, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Locale dependent regexps on different locales
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36616/re_locale_caching.py

___
Python tracker 

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



[issue22409] namedtuples bug between 3.3.2 and 3.4.1

2014-09-14 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue22409] namedtuples bug between 3.3.2 and 3.4.1

2014-09-14 Thread Brynjar Smári Bjarnason

New submission from Brynjar Smári Bjarnason:

In Python 3.4.1 installed with Anaconda. I tried the following
(expecting an OrderedDict as result):

>>>from collections import namedtuple
>>>NT = namedtuple("NT",["a","b"])
>>>nt = NT(1,2)
>>>print(vars(nt))
{}

so the result is an empty dict. In Python 3.3.2 (downgraded in the
same Anaconda environment) results in:

>>>print(vars(nt))
OrderedDict([('a', 1), ('b', 2)])

--
components: Distutils
messages: 226873
nosy: binnisb, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: namedtuples bug between 3.3.2 and 3.4.1
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



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

2014-09-14 Thread Drekin

New submission from Drekin:

Key events produced on Windows handles Unicode incorrectly when Unicode 
character is produced by dead-key combination.

On my keyboard, (AltGr + M, a) produces several key events, last of which 
contains char=="a", however, it should contain "∀". Also dead-key sequence (\, 
a) should produce event.char=="α", however contains "?".

--
components: Tkinter, Unicode, Windows
messages: 226872
nosy: Drekin, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: Tkinter doesn't handle Unicode key events on Windows
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



[issue22407] re.LOCALE is nonsensical for Unicode

2014-09-14 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Current implementation of re.LOCALE support for Unicode strings is nonsensical. 
It correctly works only on Latin1 locales (because Unicode string interpreted 
as Latin1 decoded bytes string. all characters outside UCS1 range considered as 
non-words), on other locales it got strange and useless results.

>>> import re, locale
>>> locale.setlocale(locale.LC_CTYPE, 'ru_RU.cp1251')
'ru_RU.cp1251'
>>> re.match(br'\w', 'µ'.encode('cp1251'), re.L)
<_sre.SRE_Match object; span=(0, 1), match=b'\xb5'>
>>> re.match(r'\w', 'µ', re.L)
<_sre.SRE_Match object; span=(0, 1), match='µ'>
>>> re.match(br'\w', 'ё'.encode('cp1251'), re.L)
<_sre.SRE_Match object; span=(0, 1), match=b'\xb8'>
>>> re.match(r'\w', 'ё', re.L)

Proposed patch fixes re.LOCALE support for Unicode strings. It uses the 
wide-character equivalents of C characters functions (towlower(), iswalpha(), 
etc).

The problem is that these functions are not exists in C89, they are introduced 
only in C99. Gcc understand them, we should check other compilers. However 
these functions are already used on FreeBSD and MacOS.

--
components: Extension Modules, Library (Lib), Regular Expressions
files: re_unicode_locale.patch
keywords: patch
messages: 226871
nosy: ezio.melotti, mrabarnett, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: re.LOCALE is nonsensical for Unicode
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36615/re_unicode_locale.patch

___
Python tracker 

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



[issue22406] uu-codec trailing garbage workaround is Python 2 code

2014-09-14 Thread Martin Panter

New submission from Martin Panter:

The handler for the “Trailing garbage” error for “uu-codec” uses Python 2 code, 
while the copy in the "uu” module has the correct Python 3 code.

Please change the line at

https://hg.python.org/cpython/file/775453a7b85d/Lib/encodings/uu_codec.py#l57

to look like

https://hg.python.org/cpython/file/775453a7b85d/Lib/uu.py#l148

In particular, drop ord() and use floor division. Better yet, maybe the code 
could be reused so that there is less duplication!

Demonstration:

>>> codecs.decode(b"begin 666 \n!,___\n \nend\n", "uu-codec")
Traceback (most recent call last):
  File "/usr/lib/python3.4/encodings/uu_codec.py", line 54, in uu_decode
data = binascii.a2b_uu(s)
binascii.Error: Trailing garbage

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/encodings/uu_codec.py", line 57, in uu_decode
nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3
TypeError: ord() expected string of length 1, but int found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "", line 1, in 
TypeError: decoding with 'uu-codec' codec failed (TypeError: ord() expected 
string of length 1, but int found)
>>> codecs.decode(b"begin 666 \n!,P  \n \nend\n", "uu-codec")
b'3'  # Expected output for both cases

--
components: Library (Lib)
messages: 226870
nosy: vadmium
priority: normal
severity: normal
status: open
title: uu-codec trailing garbage workaround is Python 2 code
type: behavior
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



[issue2771] Test issue

2014-09-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e79d1244d887 by Georg Brandl in branch 'default':
#2771: test baseurl change.
https://hg.python.org/test/rev/e79d1244d887

--

___
Python tracker 

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



[issue2771] Test issue

2014-09-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8510224e05dc by Georg Brandl in branch 'default':
Closes #2771: test.
http://hg.python.org/test/rev/8510224e05dc

--
resolution:  -> fixed
stage: test needed -> resolved
status: open -> closed

___
Python tracker 

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



[issue2771] Test issue

2014-09-14 Thread Georg Brandl

Changes by Georg Brandl :


--
status: closed -> open

___
Python tracker 

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



[issue22168] Turtle Graphics RawTurtle problem

2014-09-14 Thread Ned Deily

Ned Deily added the comment:

The changesets below should prevent the problem in 3.4.2 and 3.5.0.  Since 
there are no standard tests for turtle at the moment, there is no testcase for 
using a non-default Canvas but one should be added when turtle tests are 
(Issue21914 and Issue21916). 

New changset fac17d06e01d by Ned Deily in branch '3.4':
Issue #22168: Prevent turtle AttributeError with non-default Canvas on OS X.
https://hg.python.org/cpython/rev/fac17d06e01d

New changeset 775453a7b85d by Ned Deily in branch 'default':
Issue #22168: Prevent turtle AttributeError with non-default Canvas on OS X.
https://hg.python.org/cpython/rev/775453a7b85d

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

___
Python tracker 

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