[issue25695] test___all__ and test_support alter execution environment

2015-11-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fb72d6d7703c by Martin Panter in branch 'default':
Issue #25695: Defer creation of TESTDIRN until the test case is run
https://hg.python.org/cpython/rev/fb72d6d7703c

--
nosy: +python-dev

___
Python tracker 

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



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +haypo

___
Python tracker 

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



[issue25715] Python 3.5.1 installer shows wrong upgrade path

2015-11-24 Thread Steve Dower

Steve Dower added the comment:

Launcher detection still isn't quite right - another patch coming.

--

___
Python tracker 

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



[issue25727] os.startfile implementation for other OS'es besides Windows

2015-11-24 Thread Elizabeth Myers

Elizabeth Myers added the comment:

I'm not going to reopen that can of worms.

Sorry to waste your time.

--

___
Python tracker 

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



[issue25668] Deadlock in logging caused by a possible race condition with "format"

2015-11-24 Thread Vinay Sajip

Vinay Sajip added the comment:

handle() and emit() are high level methods of a handler, and format() is at a 
lower level. Not all emit() methods will call format(). For example, 
socket-based and queue-based handlers don't. So it is not in general possible 
to separate format() out - you will need to have a customised handler to deal 
with your somewhat unusual use case, and do whatever you need in there.

Threading is a complex area and while logging is one specific case you may have 
come across, it's entirely possible to have a situation with any other lock 
(e.g. in your application) where acquiring the lock and calling __unicode__() 
on one of your objects will also result in a deadlock. So your proposal 
wouldn't fix the problem in a general way - just move it so that you might 
avoid the problem, but a more esoteric use of locks wouldn't necessarily work. 
In general, to avoid deadlocks, you have to acquire locks in a fixed order, and 
only you know what those locks are - so you can implement the appropriate 
acquisition and release code in your handle().

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



[issue25725] Memory leak on unpickling bogus data

2015-11-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

You patch is just the first version of my patch. :-)  But tests are crashed 
with it.

--

___
Python tracker 

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



[issue25728] email parser ignores inner multipart boundary when outer message duplicates it

2015-11-24 Thread R. David Murray

R. David Murray added the comment:

Who is to say that the outer message is defective and not the inner one?  How 
can a parser decide which part belongs to which message?  It isn't an AI.

The whole message is defective, so all bets are off :)  The library can't 
successfully parse such a message, though it goes to significant pains to make 
sure it never generates one.

--

___
Python tracker 

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



[issue25728] email parser ignores inner multipart boundary when outer message duplicates it

2015-11-24 Thread Forest

Forest added the comment:

RFC 2046 says that the outer message is defective, since it uses a boundary 
delimiter that is quite obviously present inside one of the encapsulated parts:

https://tools.ietf.org/html/rfc2046#section-5.1

"The boundary delimiter MUST NOT appear inside any of the encapsulated parts, 
on a line by itself or as the prefix of any line."

--

___
Python tracker 

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



[issue25728] email parser ignores inner multipart boundary when outer message duplicates it

2015-11-24 Thread Forest

Forest added the comment:

> The library can't successfully parse such a message

It could successfully parse such a message, if it matched against inner message 
boundaries before outer message boundaries.  (One implementation would be to 
keep a list of all ancestor boundaries and traverse the list from most recent 
to least recent, but there might be more efficient ways to do it.)

--

___
Python tracker 

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



[issue25300] Enable Intel MPX (Memory protection Extensions) feature

2015-11-24 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I'm wary of making such extensive changes throughout the codebase for an 
optional processor-specific feature of limited benefit and unproven worth.   

With each new macro and trick (Py_VARIABLE_SIZE and Py_INIT_BOUNDS), we make it 
harder for people to read, create, and maintain our code.  The barrier to entry 
is getting too high IMO.

If this were just a makefile change, it would be different.  But it touches a 
lot of code in ways that will be unfamiliar looking to most C programmers:

  Py_ssize_t ob_array[1] Py_VARIABLE_SIZE;   /* Looks weird and confusing */

A surprising number of files are being modified:
--- a/Include/asdl.hMon Nov 02 09:17:08 2015 -0800
--- a/Include/bytesobject.h Mon Nov 02 09:17:08 2015 -0800
--- a/Include/frameobject.h Mon Nov 02 09:17:08 2015 -0800
--- a/Include/longintrepr.h Mon Nov 02 09:17:08 2015 -0800
--- a/Include/memoryobject.hMon Nov 02 09:17:08 2015 -0800
--- a/Include/object.h  Mon Nov 02 09:17:08 2015 -0800
--- a/Include/objimpl.h Mon Nov 02 09:17:08 2015 -0800
--- a/Include/pyport.h  Mon Nov 02 09:17:08 2015 -0800
--- a/Include/tupleobject.h Mon Nov 02 09:17:08 2015 -0800
--- a/Makefile.pre.in   Mon Nov 02 09:17:08 2015 -0800
--- a/Modules/_ctypes/ctypes.h  Mon Nov 02 09:17:08 2015 -0800
--- a/Modules/_tracemalloc.cMon Nov 02 09:17:08 2015 -0800
--- a/Modules/expat/xmlparse.c  Mon Nov 02 09:17:08 2015 -0800
--- a/Modules/mathmodule.c  Mon Nov 02 09:17:08 2015 -0800
--- a/Modules/sre.h Mon Nov 02 09:17:08 2015 -0800
--- a/Modules/sre_lib.h Mon Nov 02 09:17:08 2015 -0800
--- a/Modules/winreparse.h  Mon Nov 02 09:17:08 2015 -0800
--- a/Objects/dict-common.h Mon Nov 02 09:17:08 2015 -0800
--- a/Objects/dictobject.c  Mon Nov 02 09:17:08 2015 -0800
--- a/Objects/listobject.c  Mon Nov 02 09:17:08 2015 -0800
--- a/Objects/longobject.c  Mon Nov 02 09:17:08 2015 -0800
--- a/Objects/memoryobject.cMon Nov 02 09:17:08 2015 -0800
--- a/Objects/object.c  Mon Nov 02 09:17:08 2015 -0800
--- a/Objects/obmalloc.cMon Nov 02 09:17:08 2015 -0800
--- a/Objects/typeobject.c  Mon Nov 02 09:17:08 2015 -0800
--- a/Objects/unicodeobject.c   Mon Nov 02 09:17:08 2015 -0800
--- a/Parser/grammar.c  Mon Nov 02 09:17:08 2015 -0800
--- a/Python/ast.c  Mon Nov 02 09:17:08 2015 -0800
--- a/Python/dtoa.c Mon Nov 02 09:17:08 2015 -0800
--- a/Python/pyhash.c   Mon Nov 02 09:17:08 2015 -0800
--- a/configure Mon Nov 02 09:17:08 2015 -0800
--- a/configure.ac  Mon Nov 02 09:17:08 2015 -0800
--- a/pyconfig.h.in Mon Nov 02 09:17:08 2015 -0800

--

___
Python tracker 

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



[issue10796] Improve doc for readline.set_completer_delims()

2015-11-24 Thread Martin Panter

Martin Panter added the comment:

I propose to address this with the general documentation bug, Issue 6953

--
dependencies: +readline documenation needs work
nosy: +martin.panter
title: readline completion flaw -> Improve doc for 
readline.set_completer_delims()

___
Python tracker 

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



[issue25664] Unexpected UnicodeDecodeError in logging module

2015-11-24 Thread Zephor Wu

Zephor Wu added the comment:

sorry, i forgot this:

logging.basicConfig(format='%(name)s %(message)s')

the error raised at the processing of the format while the name is 'utf-8' 
encoded and the message is an unicode

--

___
Python tracker 

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



[issue6953] readline documenation needs work

2015-11-24 Thread Martin Panter

Martin Panter added the comment:

This patch addresses the following points:

1: Moved add_history() into new “History file” section with related functions.

2: Documented that remove_ and replace_history_item() are zero-based.

3: Documented that get_history_item() is one-based.

4: Listed the main underlying Readline function or variable that each Python 
function accesses. In many cases it should be fairly obvious because the name 
is essentially the same, but not always. I added them all for consistency.

5: Added six new sections to group functions: Init file, Line buffer, History 
file, History list, Startup hooks, and Completer.

7: Clarify that the parse_and_bind() line comes directly from the string 
argument, not a file.

8: Changed “command line” to “line buffer”.

9: read_init_file() also executes the bindings it reads; it does not return 
anything.

10: read_history_file() appends to the history list, contrary to what Andy 
suggested.

11: write_history_file() overwrites any existing file, and writes the history 
list

12: clear_history() is conditionally compiled in

13: Combined get_ and set_history_length() entries

14: Differentiated lines in the history file from history list items, which can 
be multi-line if an item includes a line break.

15: Added brief description of word completion in the new section. Entry 
get_completion_type() refers to the rl_completion_type variable, so it should 
be refer back to the Gnu documentation. Referred beginning and ending indexes 
to the corresponding callback arguments (these are affected by Issue 16182). 
Suggested that the word delimiters determine the word completion scope.

16: Whether libedit (Editline) is used or not really only depends on the 
-lreadline library at run time (out of Python’s hands). I clarified that its 
detection is what is implemented on OS X. See also Issue 13501 for expanding 
this support.

Another change:

17: Expanded information on setting up the completion word delimiters for a 
custom completer, to address Issue 10796.

Not addressed in my patch:

6: Init file information. May be better to just refer to the Gnu documentation 
 and Editline 
documentation (does this exist?).

8: I do not know what “the last filename used” means for read_init_file(). It 
passes a null pointer as the filename in this case. I suspect the answer may 
actually be it uses the INPUTRC config file instead.

12: I do not know what Readline version clear_history() is available in. 
Anyway, this might vary between Gnu and Editline implementations.

--
keywords: +patch
nosy: +martin.panter
Added file: http://bugs.python.org/file41157/readline-doc.patch

___
Python tracker 

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



[issue6953] readline documenation needs work

2015-11-24 Thread Martin Panter

Changes by Martin Panter :


--
stage:  -> patch review
versions: +Python 3.6

___
Python tracker 

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



[issue25664] Unexpected UnicodeDecodeError in logging module

2015-11-24 Thread Zephor Wu

Zephor Wu added the comment:

here is the case, sorry again for just typing it before and not testing it 
myself :)


# coding=utf-8
import logging

logging.basicConfig(format='%(name)s %(message)s')

logger = logging.getLogger(u'测试')
logger.error(u'测试')


btw, i'm using python2.7.10, mac osx 10.11, but i think this can effect all 
python2

--

___
Python tracker 

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



[issue25705] Fix regex_compile benchmark crash

2015-11-24 Thread Zachary Ware

Zachary Ware added the comment:

Fixed in f7283190e896.

I had actually already fixed this in my sandbox repo for speed.python.org; I 
just went ahead and pushed it (and a couple other very minor changes) to the 
main benchmark repo.

Thanks for the report and patch!

--
nosy: +zach.ware
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions:  -Python 2.7, Python 3.6

___
Python tracker 

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



[issue25719] Deprecate spitfire benchmark

2015-11-24 Thread Zachary Ware

Zachary Ware added the comment:

+1

Unless anybody else objects in the next couple days, I'll commit this.

--
nosy: +zach.ware
stage:  -> commit review
versions:  -Python 2.7

___
Python tracker 

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



[issue25576] Remove “Content-Type: application/x-www-form-urlencoded; charset” advice

2015-11-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 16fec577fd8b by Martin Panter in branch '3.4':
Issue #25576: Remove application/x-www-form-urlencoded charset advice
https://hg.python.org/cpython/rev/16fec577fd8b

New changeset 95ae5262d27c by Martin Panter in branch '3.5':
Issue #25576: Merge www-form-urlencoded doc from 3.4 into 3.5
https://hg.python.org/cpython/rev/95ae5262d27c

New changeset d52521d13a64 by Martin Panter in branch 'default':
Issue #25576: Merge www-form-urlencoded doc from 3.5
https://hg.python.org/cpython/rev/d52521d13a64

New changeset 671429cc1d96 by Martin Panter in branch 'default':
Issue #25576: Apply fix to new urlopen() doc string
https://hg.python.org/cpython/rev/671429cc1d96

--
nosy: +python-dev

___
Python tracker 

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



[issue25508] LogRecord attributes are not tuple, when logging only dict

2015-11-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a365fb0dd5e1 by Vinay Sajip in branch '2.7':
Issue #25508: Clarify documentation on LogRecord args attribute.
https://hg.python.org/cpython/rev/a365fb0dd5e1

New changeset 01998efb605a by Vinay Sajip in branch '3.4':
Issue #25508: Clarify documentation on LogRecord args attribute.
https://hg.python.org/cpython/rev/01998efb605a

New changeset ca512b568368 by Vinay Sajip in branch '3.5':
Issue #25508: Merged documentation fix from 3.4.
https://hg.python.org/cpython/rev/ca512b568368

New changeset 1da622f4630b by Vinay Sajip in branch 'default':
Closes #25508: Merged documentation fix from 3.5.
https://hg.python.org/cpython/rev/1da622f4630b

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



[issue20923] ConfigParser should nested [] in section names.

2015-11-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Discussion continues because my close message was, I now realize, incomplete 
and therefore unsatisfying.  Ditto for the doc.  So I complete my close message 
here and reopen issue to augment the doc.

The discussion has so far has glossed over the key question: "What is a legal 
section name?"  Pulling the answer from the doc was a challenge. It uses 'legal 
section name', once, as if one should already know. Reading further, I found 
the answer: there is no (fixed) answer!

The legal section name for a particular parser is determined by its .SECTCRE 
class attribute.
'''configparser.SECTCRE
A compiled regular expression used to parse section headers. The default 
matches [section] to the name "section".'''  (This neglects to say whether the 
closing ']' is the first or last ']' on the line after the opening '['.) A 
non-verbose version of the default is
re.compile(r"\[(?P[^]]+)\]").

I propose adding near the top of the doc:
"By default, a legal section name can be any string that does not contain '\n' 
or ']'.  To change this, see configparser.SECTCRE."

So my response to Miloš should have been to set SECTCRE to something like p 
below.

>>> p = re.compile(r"\[(?P.*)\]")
>>> m = p.search("[Test[2]_foo]")
>>> m.group('header')
'Test[2]_foo'

Additional note: Postel's principle was formulated for internet protocols, 
which .ini files are not.  In any case, it is not a Python design principle.  
Neither is "always check user input", which amounts to 'look before you leap'.  
So I will not debate these. However, "Errors should never pass silently." is 
#10 on the Zen of Python ('import this') and that I do attend to.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
resolution: rejected -> 
stage: test needed -> needs patch
status: closed -> open
versions: +Python 2.7, Python 3.4, Python 3.6

___
Python tracker 

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



[issue25726] sys.setprofile / sys.getprofile asymetry

2015-11-24 Thread Stefan Seefeld

New submission from Stefan Seefeld:

I'm using the `cProfile` module to profile my code.

I tried to temporarily disable the profiler by using:

  prof = sys.getprofile()
  sys.setprofile(None)
  ...
   sys.setprofile(prof)

resulting in an error.

The reason is that with `cProfile`, `sys.getprofile` returns the profile object 
itself, which isn't suitable as argument for `sys.setprofile` (which expects a 
callable).

Notice that if I use the `profile` module instead of `cProfile`, the above 
works fine.

--
messages: 255301
nosy: stefan
priority: normal
severity: normal
status: open
title: sys.setprofile / sys.getprofile asymetry
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



[issue16198] IDLE - tabbing in a string always brings up file completion window

2015-11-24 Thread Tom F

Tom F added the comment:

I've found this to be annoying as well especially in docstrings, hopefully this 
will help in the meantime.

If you SHIFT + Tab it will at least resolve the problem of bringing up files 
and remains as the usual tab function.

It makes me wonder if it is a bug at all though?

--
nosy: +Tom F

___
Python tracker 

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



[issue25725] Memory leak on unpickling bogus data

2015-11-24 Thread STINNER Victor

STINNER Victor added the comment:

I reviewed load_counted_tuple_leak.patch.

Forget my patch, Serhiy's patch is better.

--

___
Python tracker 

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



[issue25695] test___all__ and test_support alter execution environment

2015-11-24 Thread Martin Panter

Martin Panter added the comment:

This should be fixed now. Thanks for the report Arfrever and the analysis 
Ghost. I still get these warnings, but they are discussed in Issue 18383:

Warning -- warnings.filters was modified by test___all__
Warning -- warnings.filters was modified by test_warnings

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



[issue25576] Remove “Content-Type: application/x-www-form-urlencoded; charset” advice

2015-11-24 Thread Martin Panter

Changes by Martin Panter :


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



[issue25728] email parser ignores inner multipart boundary when outer message duplicates it

2015-11-24 Thread Forest

New submission from Forest:

When a multipart message erroneously defines a boundary string that conflicts 
with an inner message's boundary string, the parser ignores the (correct) inner 
message's boundary, and treats all matching boundary lines as if they belong to 
the (defective) outer message.

This file from the test_email suite demonstrates the problem:
Python-3.5.0/Lib/test/test_email/data/msg_15.txt

Consequentially, the inner multipart/alternative message is parsed with 
is_multipart() returning False, and a truncated payload.

Moreover, unit tests like test_same_boundary_inner_outer() expect to find the 
StartBoundaryNotFoundDefect defect on the inner message in that file, which 
seems wrong to me, since the inner message is not defective.  According to the 
RFCs, the outer message should have been generated with a boundary string that 
does not appear anywhere in its encoded body (including the inner message).  
The outer message is therefore the defective one.

--
components: email
messages: 255309
nosy: barry, forest, r.david.murray
priority: normal
severity: normal
status: open
title: email parser ignores inner multipart boundary when outer message 
duplicates it
type: behavior
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



[issue25728] email parser ignores inner multipart boundary when outer message duplicates it

2015-11-24 Thread Forest

Forest added the comment:

I thought at first that this might be deliberate behavior in order to comply 
with RFC 2046 section 5.1.2.
https://tools.ietf.org/html/rfc2046#section-5.1.2

After carefully re-reading that section, I see that it is just making sure an 
outer message's boundary will still be recognized if an inner multipart message 
is missing its boundary markers (for example if the inner message was 
truncated).  It does not describe any circumstances under which the inner 
message's boundary markers should be ignored when they are present.

--

___
Python tracker 

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



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-24 Thread Martin Panter

Martin Panter added the comment:

This patch restores the previous behaviour of tolerating fstat() failures other 
than EBADF. Hans, if you are able to apply it to your compiled version of 
Python, it might prove that my fstat() theory is correct.

--
keywords: +patch
Added file: http://bugs.python.org/file41155/fstat-failure.patch

___
Python tracker 

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



[issue25725] Memory leak on unpickling bogus data

2015-11-24 Thread STINNER Victor

STINNER Victor added the comment:

Oh... I didn't notice that you wrote a patch :-) I started to write a similar 
patch: see attached pickle.patch.

--
Added file: http://bugs.python.org/file41156/pickle.patch

___
Python tracker 

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



[issue25664] Unexpected UnicodeDecodeError in logging module

2015-11-24 Thread Vinay Sajip

Vinay Sajip added the comment:

I cannot reproduce, see below. Which exact version of Python are you using, and 
on what platform, and with what locale?

$ more logtest9.py
# coding=utf-8
import logging

logger = logging.getLogger(u'测试')
logger.error(u'测试')
$ python2.7 logtest9.py 
No handlers could be found for logger "测试"

--

___
Python tracker 

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



[issue25727] os.startfile implementation for other OS'es besides Windows

2015-11-24 Thread Elizabeth Myers

New submission from Elizabeth Myers:

os.startfile can be implemented on other OS'es besides Windows relatively 
easily (although the operation parameter should probably be limited to Windows; 
it can be implemented elsewhere, but is probably not worth the trouble).

On Unix-like operating systems besides OS X, an attempt to use xdg-open can be 
used and will attempt to open the file in a chosen program; this is the 
freedesktop.org standard open utility. See also 
http://linux.die.net/man/1/xdg-open and 
https://wiki.archlinux.org/index.php/Xdg-open (not specific to ArchLinux).

On OS X, open can be used, with similar results to xdg-open (in fact, xdg-open 
seems inspired by it). See also 
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/open.1.html.

--
components: Library (Lib)
messages: 255306
nosy: Elizacat
priority: normal
severity: normal
status: open
title: os.startfile implementation for other OS'es besides Windows
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue25727] os.startfile implementation for other OS'es besides Windows

2015-11-24 Thread R. David Murray

R. David Murray added the comment:

Duplicate of Issue 3177, which has quite a bit of discussion and some patch 
proposals.  You might want to add yourself as nosy to that issue and see what 
you think of the proposals (I did not read through it to see what the status 
is...there hasn't been any activity on it for a long time, so it is ripe for 
someone new to pick it up and carry it forward).

--
nosy: +r.david.murray
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Add shutil.open

___
Python tracker 

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



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-24 Thread Hans Lawrenz

Hans Lawrenz added the comment:

Emanuel, sorry, I missed the request for sys.version earlier.

The tempfile.py I attached earlier is from the python 3.5 pulled from a ppa. I 
wouldn't be surprised if it has some patches applied by debian/ubuntu. To be 
clear though the problem also presents itself with a python 3.5 I compiled. The 
Vagrantfile in the github repository shows exactly how I compiled it.

Here it is from the version from the ppa:

Python 3.5.0 (default, Sep 17 2015, 00:00:00) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version
'3.5.0 (default, Sep 17 2015, 00:00:00) \n[GCC 4.8.4]'
>>> sys.implementation
namespace(_multiarch='x86_64-linux-gnu', cache_tag='cpython-35', 
hexversion=50659568, name='cpython', version=sys.version_info(major=3, minor=5, 
micro=0, releaselevel='final', serial=0))


Here are the same for the version I compiled:
vagrant@vagrant-ubuntu-trusty-64:~$ python3.5
Python 3.5.0 (default, Nov 24 2015, 19:50:42) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version
'3.5.0 (default, Nov 24 2015, 19:50:42) \n[GCC 4.8.4]'
>>> sys.implementation
namespace(cache_tag='cpython-35', hexversion=50659568, name='cpython', 
version=sys.version_info(major=3, minor=5, micro=0, releaselevel='final', 
serial=0))

--

___
Python tracker 

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



[issue25701] Document that tp_setattro and tp_setattr are used for deleting attributes

2015-11-24 Thread Martin Panter

Martin Panter added the comment:

I agree it might be safer not to document that PyObject_SetAttr etc can delete 
(move that change to the tp_setattro etc method slot). I’ll also review the 
other functions you mentioned when I get a chance.

--

___
Python tracker 

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



[issue25725] Memory leak on unpickling bogus data

2015-11-24 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

New tests added in issue23914 exposed memory leak on unpickling TUPLE1..TUPLE3 
opcodes with insufficient stack. Proposed patch fixes the leak.

--
assignee: serhiy.storchaka
components: Library (Lib)
keywords: patch
messages: 255289
nosy: alexandre.vassalotti, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Memory leak on unpickling bogus data
type: resource usage
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41154/load_counted_tuple_leak.patch

___
Python tracker 

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



[issue25725] Memory leak on unpickling bogus data

2015-11-24 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue25725] Memory leak on unpickling bogus data

2015-11-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

$ ./python -m test.regrtest -R 3:3 -m test_bad_stack test_pickle
[1/1] test_pickle
beginning 6 repetitions
123456
..
test_pickle leaked [20, 20, 20] references, sum=60
test_pickle leaked [12, 14, 14] memory blocks, sum=40
1 test failed:
test_pickle

--

___
Python tracker 

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



[issue25723] ConfigParser should never write broken configurations

2015-11-24 Thread STINNER Victor

STINNER Victor added the comment:

Terry: "Since anything else without ']' is valid (...)"

A Python script can be used to generate a configuration read by another 
application. This application can more more strict on the configuration format 
than Python, so I would prefer to deny '\n', '[' and ']' characters in section 
names.

I'm not sure that it's ok to modify Python < 3.6 since it can break 
applications relying on this ugly "feature". I propose to only modify Python 
3.6.

If you need strict ConfigParser, you can inherit from the class to override 
add_section() to add checks on the section name.

@SpaceOne: Are you interested to work on a patch?

--
nosy: +haypo
versions:  -Python 2.7, Python 3.5

___
Python tracker 

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



[issue25729] update pure python datetime.timedelta creation

2015-11-24 Thread Brian Kearns

Changes by Brian Kearns :


Removed file: http://bugs.python.org/file41158/timedelta.patch

___
Python tracker 

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



[issue25729] update pure python datetime.timedelta creation

2015-11-24 Thread Brian Kearns

Changes by Brian Kearns :


Added file: http://bugs.python.org/file41159/timedelta.patch

___
Python tracker 

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



[issue25664] Unexpected UnicodeDecodeError in logging module

2015-11-24 Thread STINNER Victor

STINNER Victor added the comment:

$ cat x.py 
# coding=utf-8
import logging
logging.basicConfig(format='%(name)s %(message)s')
logger = logging.getLogger(u'测试')
logger.error(u'测试')

$ python2.7 x.py 
Traceback (most recent call last):
  File "/usr/lib64/python2.7/logging/__init__.py", line 859, in emit
msg = self.format(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 732, in format
return fmt.format(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 474, in format
s = self._fmt % record.__dict__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal 
not in range(128)
Logged from file x.py, line 8

--
nosy: +haypo

___
Python tracker 

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



[issue25729] update pure python datetime.timedelta creation

2015-11-24 Thread Brian Kearns

New submission from Brian Kearns:

Brings timedelta creation up to par with the (simpler) C equivalent. Gives a 
nice speed boost on the pure-py version (not worth much on CPython but useful 
on other implementations like PyPy).

Included in a few other small bug fixes/cleanups, should be self-explanatory.

--
files: timedelta.patch
keywords: patch
messages: 255322
nosy: bdkearns
priority: normal
severity: normal
status: open
title: update pure python datetime.timedelta creation
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41158/timedelta.patch

___
Python tracker 

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



[issue25715] Python 3.5.1 installer shows wrong upgrade path

2015-11-24 Thread Steve Dower

Steve Dower added the comment:

Fix attached:
* moves the UI update to the correct time (*after* we've detected the path)
* fixes a launcher detection issue I noticed
* removes a duplicated function

--
keywords: +patch
Added file: http://bugs.python.org/file41152/25715_1.patch

___
Python tracker 

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



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-24 Thread Hans Lawrenz

Hans Lawrenz added the comment:

Serhiy and Emanuel, I'll paste below the surrounding code and attach the exact 
tempfile.py. It is the version distributed with the 3.5.0 release. If you take 
a look at the github repo I linked in the first comment you can also try it out 
for yourself if you've got vagrant and virtualbox installed. I was able to 
recreate the error with the provisioning compiling python and with it 
installing from a ppa. You can see the details in the Vagrantfile. I also had a 
coworker test in a nearly identical environment and he had the same result.


(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
try:
_os.unlink(name)
return _io.open(fd, mode, buffering=buffering,
newline=newline, encoding=encoding)
except:
_os.close(fd)
raise


One final note. I decided to try this out with a windows host and the only 
clarity this test adds is that the problem doesn't show up there but it fails 
for its own reasons on all the python versions I tried. See below for reference:

Last login: Tue Nov 24 17:16:12 2015 from 10.0.2.2
vagrant@vagrant-ubuntu-trusty-64:~$ cat /vagrant/foo.py
import tempfile

with tempfile.TemporaryFile(dir="/vagrant") as tf:
tf.write("testing testing testing\n".encode('utf-8'))
print("Path 2: worked")
vagrant@vagrant-ubuntu-trusty-64:~$ python /vagrant/foo.py
Traceback (most recent call last):
  File "/vagrant/foo.py", line 4, in 
with tempfile.TemporaryFile(dir="/vagrant") as tf:
  File "/usr/lib/python2.7/tempfile.py", line 495, in TemporaryFile
_os.unlink(name)
OSError: [Errno 26] Text file busy: '/vagrant/tmpvx7Mie'
vagrant@vagrant-ubuntu-trusty-64:~$ python2.7 /vagrant/foo.py
Traceback (most recent call last):
  File "/vagrant/foo.py", line 4, in 
with tempfile.TemporaryFile(dir="/vagrant") as tf:
  File "/usr/lib/python2.7/tempfile.py", line 495, in TemporaryFile
_os.unlink(name)
OSError: [Errno 26] Text file busy: '/vagrant/tmpNXQ6Cf'
vagrant@vagrant-ubuntu-trusty-64:~$ python3.4 /vagrant/foo.py
Traceback (most recent call last):
  File "/vagrant/foo.py", line 4, in 
with tempfile.TemporaryFile(dir="/vagrant") as tf:
  File "/usr/lib/python3.4/tempfile.py", line 638, in TemporaryFile
_os.unlink(name)
OSError: [Errno 26] Text file busy: '/vagrant/tmpfwhj7ip4'
vagrant@vagrant-ubuntu-trusty-64:~$ python3.5 /vagrant/foo.py
Traceback (most recent call last):
  File "/vagrant/foo.py", line 4, in 
with tempfile.TemporaryFile(dir="/vagrant") as tf:
  File "/usr/lib/python3.5/tempfile.py", line 751, in TemporaryFile
_os.unlink(name)
OSError: [Errno 26] Text file busy: '/vagrant/tmp02s19r_a'
vagrant@vagrant-ubuntu-trusty-64:~$ python2.7 --version
Python 2.7.6
vagrant@vagrant-ubuntu-trusty-64:~$ python3.4 --version
Python 3.4.3
vagrant@vagrant-ubuntu-trusty-64:~$ python3.5 --version
Python 3.5.0

--
Added file: http://bugs.python.org/file41153/tempfile.py

___
Python tracker 

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



[issue20923] ConfigParser should nested [] in section names.

2015-11-24 Thread Sebastian Bank

Sebastian Bank added the comment:

Terry: I am not so sure about that interpretation. Do we agree that the 
INI-files are the data/message? ConfigParser refuses to accept dirty INI-Files 
(with ']' in section names) but will produce this kind of files.
I we see the arguments given to ConfigParser as data/message, it does indeed 
accept dirty data as you say, but still it does not emit clean one in that 
case, right?

--

___
Python tracker 

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



[issue20923] ConfigParser should nested [] in section names.

2015-11-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Sebastian: you have it backwards.  A paraphrase of Postel's recommendation 
(calling it a Law is wrong) is 'accept dirty data, emit clean data'.  This is 
the current behavior.  See https://en.wikipedia.org/wiki/Robustness_principle.  
This article also explains the opposite viewpoint, that dirty data should be 
rejected, as SpaceOne is suggesting.

SpaceOne: unless it is your intention to discourage people from volunteering 
their time to respond to issues raised on the tracker, you should read what 
they write more carefully and think more carefully about how you express your 
opinions.  If you really want a ValueError here, open an new enhancement issue 
for 3.6.

--
type: behavior -> enhancement

___
Python tracker 

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



[issue20923] ConfigParser should nested [] in section names.

2015-11-24 Thread SpaceOne

SpaceOne added the comment:

Sorry about that!
I created http://bugs.python.org/issue25723.

--

___
Python tracker 

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



[issue25718] itertools.accumulate __reduce__/__setstate__ bug

2015-11-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

__reduce__() and __setstate__() methods of itertools.accumulate() look correct. 
The problem is not in itertools.accumulate(), but in the copy module. It uses 
the same __reduce__ protocol as pickle, but in different way. In the pickle 
module (in both Python and C implementations) state value is ignored only if it 
is None. In the copy module any state with boolean value is False is ignored.

Proposed patch fixes the copy module.

--
components: +Library (Lib) -Extension Modules
nosy: +alexandre.vassalotti, serhiy.storchaka
stage:  -> patch review
versions: +Python 2.7, 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



[issue25718] itertools.accumulate __reduce__/__setstate__ bug

2015-11-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
keywords: +patch
Added file: http://bugs.python.org/file41151/copy_state_is_false.patch

___
Python tracker 

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



[issue20923] ConfigParser should nested [] in section names.

2015-11-24 Thread Mark Lawrence

Mark Lawrence added the comment:

Why the debate on an issue that was closed over 18 months ago?

--
nosy: +BreamoreBoy

___
Python tracker 

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



[issue25701] Document that tp_setattro and tp_setattr are used for deleting attributes

2015-11-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Martin. In general the patch LGTM, but I'm not expert in English 
writing.

There are other functions and slots with twofold purpose: PyObject_SetItem, 
PySequence_SetItem, PySequence_SetSlice, PyMapping_SetItemString, 
PySequenceMethods.sq_ass_item, PyMappingMethods.mp_ass_subscript. May be 
address them in this issue?

I'm not sure about documenting the deletion for PyObject_SetAttr and like. All 
these functions have Del-counterpart. Deleting by Set-function with NULL may be 
a side effect and be deprecated in future. May be worth to discuss this on 
Python-Dev.

For PySys_SetObject the deletion if value is NULL already is documented, but 
there is no PySys_DelObject.

--

___
Python tracker 

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



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Is your file system NFS?

--

___
Python tracker 

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



[issue25721] Fix pybench always_display error

2015-11-24 Thread Brett Cannon

Changes by Brett Cannon :


--
type: crash -> 

___
Python tracker 

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



[issue25712] Dead link in the PEP-3147

2015-11-24 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon
nosy: +brett.cannon

___
Python tracker 

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



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-24 Thread Emanuel Barry

Emanuel Barry added the comment:

Your file has a lot of shenanigans that are triggered if 'shutil' fails to be 
imported, adding an extra 139 lines at the top of the file, which is exactly 
how offset your traceback is compared to our lines. The rest of the file is 
virtually identical. This makes me wonder, however, why you have these 
differences (and that this might not be the only different file).

I would still like the output of sys.version, which, unlike 'python --version' 
contains the build date and time, among other things. Bonus points for the 
'sys.implementation' output. It's unlikely to be of relevance, but I would 
rather explore every possibility.

--

___
Python tracker 

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



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-24 Thread Hans Lawrenz

Hans Lawrenz added the comment:

The file system causing the problem is of type vboxsf which is the Virtualbox 
shared folder file system type.

--

___
Python tracker 

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



[issue25723] ConfigParser should never write broken configurations

2015-11-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This strikes me as an overt bug.  .add_section should add one new empty 
section, not a section with an item and a second section.  Since a section name 
cannot contain \n, I would agree that passing a string containing \n should 
raise ValueError("Section names cannot contain newlines.").  Since anything 
else without ']' is valid and since even that can be accommodated with a custom 
section name re, that is the only check that should be done.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue25718] itertools.accumulate __reduce__/__setstate__ bug

2015-11-24 Thread Armin Rigo

New submission from Armin Rigo:

itertools.accumulate() has got methods __reduce__() and __setstate__() which 
fail at saving/restoring the state in all cases.  Example:

   >>> a = itertools.accumulate([0.0, 42])
   >>> next(a)
   0.0
   >>> b = copy.deepcopy(a)
   >>> next(a)
   42.0
   >>> next(b)
   42   # should have been the same as the previous result

More precisely, the problem occurs when the C-level "total" field has some 
value whose truth-value is false.  Then __reduce__/__setstate__ will not 
restore the value of this field, but keep it NULL.  That's why in the example 
above the intermediate total of 0.0 is forgotten, and the next(b) call will 
again just pick the next value without doing any addition.  (The problem can 
hurt more than in this example if we use a custom function instead of addition.)

A fix is easy but, as far as I can tell, it requires breaking the pickled 
format of accumulate() iterators that have already started.

--
components: Extension Modules
messages: 255252
nosy: arigo
priority: normal
severity: normal
status: open
title: itertools.accumulate __reduce__/__setstate__ bug
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue21679] Prevent extraneous fstat during open()

2015-11-24 Thread Martin Panter

Martin Panter added the comment:

The change made here no longer tolerates fstat() returning an error, which 
seems to be the cause of Issue 25717.

--
nosy: +martin.panter

___
Python tracker 

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



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-24 Thread Martin Panter

Martin Panter added the comment:

Thanks for the strace output. I think the actual error is the fstat() call a 
bit after that first open() call. FileNotFoundError is ENOENT:

open("/vagrant/tmpy5ioznh4", O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_CLOEXEC, 0600) 
= 4
unlink("/vagrant/tmpy5ioznh4")  = 0
fstat(4, 0x7ffc0b326520)= -1 ENOENT (No such file or directory)
close(4)= 0
write(2, "Traceback (most recent call last"..., 35Traceback (most recent call 
last):

My theory is that the fstat() call at 
 is 
failing, probably because the file entry has been removed from its directory. 
This call was added by revision 3b5279b5bfd1 (Issue 21679). Before this change, 
fstat() was called twice, but in each case an error was tolerated.

Posix does not mention fstat() returning this ENOENT error, so maybe this could 
be a bug with the Virtual Box or Vagrant driver for the mounted filesystem. But 
it might be nice to make Python more permissive if fstat() fails, like it was 
in 3.4.

As a workaround, you may be able to use NamedTemporaryFile, if you are happy 
for the file to have a name and a directory entry.

--

___
Python tracker 

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



[issue25709] Problem with string concatenation and utf-8 cache.

2015-11-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Fixed yet one bug (thanks Victor again). Test is improved, now it doesn't rely 
on implementation detail of particular builtin.

--
Added file: http://bugs.python.org/file41146/issue25709_4.patch

___
Python tracker 

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



[issue25718] itertools.accumulate __reduce__/__setstate__ bug

2015-11-24 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> kristjan.jonsson
nosy: +kristjan.jonsson

___
Python tracker 

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



[issue25714] Consider isinstance(..., numbers.Integral) instead of isinstance(..., int) or isinstance(..., (int, long)) in datetime.py

2015-11-24 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +tim.peters

___
Python tracker 

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



[issue25709] Problem with string concatenation and utf-8 cache.

2015-11-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 24.11.2015 02:30, Steven D'Aprano wrote:
> 
> Steven D'Aprano added the comment:
> 
> On Mon, Nov 23, 2015 at 09:48:46PM +, STINNER Victor wrote:
> 
>> * the string has a cached UTF-8 byte string (ex: int(s) was called before 
>> the resize)
> 
> Why do strings cache their UTF-8 encoding?
> 
> I presume that some of Python's internals rely on the UTF-8 encoding 
> rather than the internal Latin-1/UCS-2/UTF-32 representation (PEP 393). 
> E.g. I infer from the above that int(s) parses the UTF-8 representation 
> of s rather than the internal representation. Is that right?
> 
> Nevertheless, I wonder why the UTF-8 representation is cached. Is it 
> that expensive to generate that it can't be done on the fly, as needed? 
> As it stands now, non-ASCII strings may be up to twice as big as they 
> need be, once you include the UTF-8 cache. And, as this bug painfully 
> shows, the problem with caches is that you run the risk of the cache 
> being out of date.

The cache is needed because it's the only way to get a direct
C char* to the object's UTF-8 representation without having to
worry about memory management on the caller's side. Not having
access to this would break a lot of code using the Python
C API, since the cache is there per design. The speedup aspect
is secondary.

Unicode objects are normally immutable, but there are a few
corner cases during the initialization of the objects where
they are in fact mutable for a short while, e.g. when
creating an empty object which is then filled with data and
resized to the final length before passing it back to
Python.

--

___
Python tracker 

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



[issue25709] Problem with string concatenation and utf-8 cache.

2015-11-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Why do strings cache their UTF-8 encoding?

Mainly for compatibility with existing C API. Common way to parse function 
arguments in implemented in C function is to use special argument parsing API: 
PyArg_ParseTuple, PyArg_ParseTupleAndKeywords, or PyArg_Parse. Most format 
codes for Unicode strings returned a C pointer to char array. For that encoded 
Unicode strings should be kept somewhere at least for the time of executing C 
function. As well as PyArg_Parse* functions doesn't allow user to specify a 
storage for encoded string, it should be saved in Unicode object. That is not 
new to PEP 393 or Python 3, in Python 2 the Unicode objects also keep cached 
encoded version.

--

___
Python tracker 

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



[issue25034] string.Formatter accepts empty fields but displays wrong when nested

2015-11-24 Thread Bill Tutt

Bill Tutt added the comment:

I don't suppose this change could make it into 2.7.11 as well?

Thanks,
Bill

--
nosy: +Bill Tutt

___
Python tracker 

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



[issue25709] Problem with string concatenation and utf-8 cache.

2015-11-24 Thread STINNER Victor

STINNER Victor added the comment:

issue25709_4.patch now looks good to me, but I added some minor comments on the 
review.

--

___
Python tracker 

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



[issue25719] Deprecate spitfire benchmark

2015-11-24 Thread Florin Papa

New submission from Florin Papa:

Hi all,

This is Florin Papa from the Server Languages Optimizations Team at Intel 
Corporation.

The patch submitted here deprecates the spitfire benchmark, which uses psyco. 
Psyco is "unmaintained and dead", according to their website 
(http://psyco.sourceforge.net/) and it has not received any updates since 2012. 
The spitfire benchmark crashes because psyco does not have support for x64 
architectures.

To apply the patch please follow these steps:

hg clone https://hg.python.org/benchmarks
cd benchmarks/
copy deprecate_spitfire.patch to the current directory
hg import --no-commit deprecate_spitfire.patch

Thank you,
Florin Papa

--
components: Benchmarks
files: deprecate_spitfire.patch
keywords: patch
messages: 255260
nosy: brett.cannon, florin.papa, pitrou
priority: normal
severity: normal
status: open
title: Deprecate spitfire benchmark
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file41147/deprecate_spitfire.patch

___
Python tracker 

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



[issue25714] Consider isinstance(..., numbers.Integral) instead of isinstance(..., int) or isinstance(..., (int, long)) in datetime.py

2015-11-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

C implementation almost everywhere (except strftime/strptime) accepts long as 
well as int, but not general integral numbers. Python implementation of the 
datetime module is not entire compatible with C implementation (default in 
CPython), therefore alternative Python implementations that doesn't use an 
accelerator is incompatible with CPython. I consider this as a bug and think 
that we should weak some of checks isinstance(..., int) to isinstance(..., 
(int, long)). numbers.Integral is too wide type, C implementation doesn't 
support it.

--
nosy: +belopolsky, serhiy.storchaka
stage:  -> needs patch
type: enhancement -> behavior

___
Python tracker 

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



[issue25660] tabs don't work correctly in python repl

2015-11-24 Thread R. David Murray

R. David Murray added the comment:

We try our best to support libedit, but support for it did come after readline, 
so there are issues with the support.  However, if we are (as we are) enabling 
completion by default, I think that has to work with libedit, since that's what 
is used on OSX which, as Yury said, is a major platform for Python.

IIRC, on windows one has to install something 3rd party (pyreadline?) to get 
readline support.

--

___
Python tracker 

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



[issue20923] ConfigParser should nested [] in section names.

2015-11-24 Thread R. David Murray

R. David Murray added the comment:

The enhancement request was rejected.  At this point I think it would be better 
to open a new bug requesting that an error be raised if the supplied section 
name contains a ']'.  The question there is if there are backward compatibility 
issues.  That can be discussed on the new issue you open.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue25721] Fix pybench always_display error

2015-11-24 Thread Florin Papa

Changes by Florin Papa :


--
type:  -> crash

___
Python tracker 

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



[issue20923] ConfigParser should nested [] in section names.

2015-11-24 Thread SpaceOne

SpaceOne added the comment:

IMHO your rejection is stupid. User input should always be validated.

At least a ValueError should be raised if add_section() is called with a string 
containing ']\x00\n['. As this will always create a broken configuration.

Otherwise ConfigParser cannot be used to write new config files without having 
deeper knowledge about the implementation.

--
nosy: +spaceone

___
Python tracker 

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



[issue25720] Fix curses module compilation with ncurses6

2015-11-24 Thread Ismail Donmez

New submission from Ismail Donmez:

ncurses6 turned on NCURSES_OPAQUE, so now you have to use some helper functions 
instead of accessing the structs directly. This _should_ be compatible with 
ncurses5 though I didn't test it.

Original patch is from openSUSE.

--
components: Extension Modules
files: curses-ncurses6.patch
keywords: patch
messages: 255261
nosy: donmez
priority: normal
severity: normal
status: open
title: Fix curses module compilation with ncurses6
versions: Python 3.5
Added file: http://bugs.python.org/file41148/curses-ncurses6.patch

___
Python tracker 

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



[issue25721] Fix pybench always_display error

2015-11-24 Thread Florin Papa

New submission from Florin Papa:

Hi all,

This is Florin Papa from the Server Languages Optimizations Team at Intel 
Corporation.

The patch submitted here solves a crash occurring on Python 2.7 after running 
pybench from perf.py (python perf.py -r -b pybench base_python 
modified_python). The error appears when trying to display the results of the 
run because the PyBenchBenchmarkResult class does not include the attribute 
"always_display".

Here is the error message received:
File "../benchmarks/perf.py", line 2574, in main
if result.always_display:
AttributeError: 'PyBenchBenchmarkResult' object has no attribute 
'always_display'

To apply the patch please follow these steps:

hg clone https://hg.python.org/benchmarks
cd benchmarks/
copy fix_pybench_results.patch to the current directory
hg import --no-commit fix_pybench_results.patch

Thank you,
Florin Papa

--
components: Benchmarks
messages: 255262
nosy: brett.cannon, florin.papa, pitrou
priority: normal
severity: normal
status: open
title: Fix pybench always_display error
versions: Python 2.7

___
Python tracker 

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



[issue25721] Fix pybench always_display error

2015-11-24 Thread Florin Papa

Changes by Florin Papa :


--
keywords: +patch
Added file: http://bugs.python.org/file41149/fix_pybench_results.patch

___
Python tracker 

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



[issue25300] Enable Intel MPX (Memory protection Extensions) feature

2015-11-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Hi,

I've reviewed the latest patch.
I have a more general question: the patch sprinkles some Py_INIT_BOUNDS() calls 
in various places. What the macro does is set the pointer's bounds to "INIT", 
which basically means disable any checks (the pointer is allowed to access all 
memory). Is there a reason for that? MPX checks for out-of-bounds accesses, so 
setting pointer bounds to "INIT" seems to defeat the point.

(if MPX otherwise complains about out-of-bounds accesses in CPython, perhaps 
they are genuine bugs that deserve fixing, or perhaps the annotations in the 
patch are not good enough)

--

___
Python tracker 

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



[issue25722] Lib/ssl.py breaks certificate validation for wildcard domains, e.g. *.s3.amazonaws.com

2015-11-24 Thread Alexander Todorov

New submission from Alexander Todorov:

The latest ssl.py file tries to validate hostnames vs certificates but includes 
a faulty regexp which causes any wildcard domains (e.g. *.s3.amazonaws.com) to 
fail validation. 

Steps to Reproduce:
>>> import ssl
>>> ssl._dnsname_match("*.s3.amazonaws.com", 
>>> "planet.sofiavalley.com.s3.amazonaws.com")
>>> 

>From Python's documentation:

[]

Used to indicate a set of characters. In a set:

...
Special characters lose their special meaning inside sets. For example, 
[(+*)] will match any of the literal characters '(', '+', '*', or ')'.


^ this is the cause of the error

I've found this after an upgrade to RHEL 7.2 which contains the faulty code 
broke s3cmd for me. The result - one of my sites was outdated for a couple of 
days.

For more info and proposed patch see:
https://bugzilla.redhat.com/show_bug.cgi?id=1284916
https://bugzilla.redhat.com/show_bug.cgi?id=1284930

Note: As far as I can tell this affects upstream Python 2.7.10 and 3.5.0, 
however in the packages Red Hat distributes the code is different between 2 and 
3 while upstream is more consistent.

--
messages: 255265
nosy: Alexander Todorov
priority: normal
severity: normal
status: open
title: Lib/ssl.py breaks certificate validation for wildcard domains, e.g. 
*.s3.amazonaws.com
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue25722] Lib/ssl.py breaks certificate validation for wildcard domains, e.g. *.s3.amazonaws.com

2015-11-24 Thread Christian Heimes

Christian Heimes added the comment:

This is not a bug. It's actually the way how wildcards in X.509 certificates 
work. For hostnames a wildcard only matches one label. There can only be one 
wildcard and the wildcard must be in the left-most label. 
https://tools.ietf.org/html/rfc6125#section-6.4.3

This means that "*.s3.amazonaws.com" matches "com.s3.amazonaws.com" but doesn't 
match "planet.sofiavalley.com.s3.amazonaws.com".

--
nosy: +christian.heimes
resolution:  -> not a bug
stage:  -> resolved
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



[issue25720] Fix curses module compilation with ncurses6

2015-11-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka, twouters
stage:  -> patch review
type:  -> compile error

___
Python tracker 

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



[issue25709] Problem with string concatenation and utf-8 cache.

2015-11-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Georg, I ask for applying this fix to 3.3.

--
nosy: +georg.brandl
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



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-24 Thread Hans Lawrenz

Hans Lawrenz added the comment:

Unfortunately changing the tempfile call isn't an easy option for me. The 
situation in which I'm encountering the error is running tox on our project 
which is mounted in the /vagrant directory in the VM (this is standard for 
vagrant). Tox makes its own temp directory--presumably for test isolation--in 
the .tox directory in the project root. The actual call to 
tempfile.TemporaryFile() which is triggering the error is in a third party 
library that is called during a test run. 

I was able to work around the issue by changing the tox workdir setting to 
outside the mount. However, I'd like to mention that developing in vagrant in 
this fashion isn't uncommon and once 3.5 gains adoption I would guess this 
issue may affect a good number of people.

I'm happy to take a stab at writing a patch but looking at the code it's 
somewhat out of my comfort zone and I worry I'd make a hash of it.

--

___
Python tracker 

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



[issue25723] ConfigParser should never write broken configurations

2015-11-24 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +lukasz.langa
versions:  -Python 3.2, 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



[issue25724] SSLv3 test failure on Ubuntu 16.04 LTS

2015-11-24 Thread Marc Deslauriers

New submission from Marc Deslauriers:

In order to disable SSLv3 in OpenSSL without breaking ABI, Ubuntu 16.04 LTS 
will ship with OP_NO_SSLv3 forced on by default.

This is causing the test_ssl.py test to fail.
Attached is a patch to fix the issue.

--
components: Tests
files: fix-sslv3-test.diff
keywords: patch
messages: 255274
nosy: mdeslaur
priority: normal
severity: normal
status: open
title: SSLv3 test failure on Ubuntu 16.04 LTS
versions: Python 3.5
Added file: http://bugs.python.org/file41150/fix-sslv3-test.diff

___
Python tracker 

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



[issue25723] ConfigParser should never write broken configurations

2015-11-24 Thread SpaceOne

New submission from SpaceOne:

>>> from configparser import ConfigParser
>>> from io import StringIO
>>> from configparser import ConfigParser
>>> c = ConfigParser()
>>> c.add_section('foo]\nbar=baz\n[bar')
>>> fd = StringIO()
>>> c.write(fd)
>>> print(fd.getvalue())
[foo]
bar=baz
[bar]

User input should always be validated.

At least a ValueError should be raised if add_section() is called with a string 
containing anything like ']\x00\n[' or any other non-printable string. As this 
will always create a broken configuration or might lead to ini-injections.

Otherwise ConfigParser cannot be used to write new config files without having 
deeper knowledge about the implementation.

See also:
http://bugs.python.org/issue23301
http://bugs.python.org/issue20923

--
components: Library (Lib)
messages: 255270
nosy: spaceone
priority: normal
severity: normal
status: open
title: ConfigParser should never write broken configurations
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue25723] ConfigParser should never write broken configurations

2015-11-24 Thread SpaceOne

SpaceOne added the comment:

I would have expected something like ValueError('A section must not contain any 
of ...') or at least that the characters are simply stripped.

--

___
Python tracker 

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



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What is exact version of you Python? I can't identify the line in the 
traceback. There are few lines "newline=newline, encoding=encoding)" in 
tempfile.py, but no one is closer to line 753.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-24 Thread Emanuel Barry

Emanuel Barry added the comment:

I'm with Serhiy, the line number is inane. Could you put the exact contents of 
your /usr/lib/python3.5/tempfile.py file somewhere for us to see? Output of 
sys.version would be nice, too.

--
nosy: +ebarry

___
Python tracker 

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