[issue28180] sys.getfilesystemencoding() should default to utf-8

2016-12-16 Thread Nick Coghlan

Nick Coghlan added the comment:

Making an explicit note of this so I remember to mention it in the draft PEP: 
one of the biggest problems that arises in any attempt at a Python-only 
solution to overriding the locale is that we can end up disagreeing with C/C++ 
extensions, and this is *especially* a problem when sharing a process with GUI 
frameworks like Tcl/Tk, Qt, and GTK (since they tend to read the process-wide 
settings, rather than querying anything that CPython configures during normal 
operation).

So the approach I'm proposing is to implement a C->C.UTF-8 locale override in 
the *actual python CLI executable*, and then in the dynamically linked library 
we only emit a warning if we detect the C locale, we don't actually do anything 
to change it.

--

___
Python tracker 

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



[issue28972] Document all "python -m" utilities

2016-12-16 Thread Miki Tebeka

Miki Tebeka added the comment:

Eric - sorry I wasn't clear. I'm not talking about the -m behavior in general 
but on the modules in the standard library that can be used with it. A lot of 
windows are happy to know about "python -m tarfile" to they can extract tar 
files without installing an extra tool and some Linux people are happy to know 
on "python -m zipfile" so they don't have to install the "zip" utility to 
extract/create zip archives. etc ...

--

___
Python tracker 

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



[issue28180] sys.getfilesystemencoding() should default to utf-8

2016-12-16 Thread Nick Coghlan

Nick Coghlan added the comment:

We've been discussing this further downstream in the Fedora Python SIG, and we 
have a draft approach that we're pretty sure will work for us (based in turn on 
the approach Armin Ronacher came up with for click), and we think it should 
work for other distros as well (as long as they already ship the C.UTF-8 
locale, and if they don't, they should fix that limitation anyway).

So I'm assigning this to myself as I think the next step will be to write a PEP 
that both proposes the specific idea as the default behaviour in 3.7, and also 
encourages distros to opt-in to trialling it as a downstream patch for 3.6.

--
assignee:  -> ncoghlan

___
Python tracker 

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



[issue13051] Infinite recursion in curses.textpad.Textbox

2016-12-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28147] Unbounded memory growth resizing split-table dicts

2016-12-16 Thread Ned Deily

Ned Deily added the comment:

So now that a fix has been released with 3.6.0rc2, what else needs to be done 
to close this issue?  Why is 3.5 selected in the applicable versions?

--

___
Python tracker 

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



[issue28770] Update python-gdb.py for fastcalls

2016-12-16 Thread Ned Deily

Ned Deily added the comment:

[cherrypicked for 3.6.0rc2]

--
priority: release blocker -> 
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



[issue28990] asyncio SSL hangs if connection is closed before handshake completed

2016-12-16 Thread Ned Deily

Ned Deily added the comment:

[cherrypicked for 3.6.0rc2]

--
priority: release blocker -> 
status: open -> closed

___
Python tracker 

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



[issue28990] asyncio SSL hangs if connection is closed before handshake completed

2016-12-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bfd4f13b478b by Yury Selivanov in branch '3.6':
Merge 3.5 (issue #28990)
https://hg.python.org/cpython/rev/bfd4f13b478b

--

___
Python tracker 

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



[issue28770] Update python-gdb.py for fastcalls

2016-12-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b0efa88c4cf4 by Victor Stinner in branch '3.6':
Issue #28770: Update python-gdb.py for fastcalls
https://hg.python.org/cpython/rev/b0efa88c4cf4

--

___
Python tracker 

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



[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2016-12-16 Thread Evan

Evan added the comment:

This issue is relevant to Python 2 on Windows since you need to disable the EOL 
conversion if you're trying to receive binary data on stdin.

See: http://stackoverflow.com/questions/2850893/reading-binary-data-from-stdin

--
nosy: +evan_

___
Python tracker 

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



[issue28951] re.flags not documented in Module Contents as promised.

2016-12-16 Thread kevin

kevin added the comment:

Ordinarily when I see a cross-reference like that "the flags are described
in foo" I expect foo to have a heading "FLAGS" so I can tell I'm looking at
what was promised.  Not knowing much about flags, it was not clear to me
that those scattered lines re.A through re.X were the promised
descriptions.  I didn't even notice them until now, partly because it's
made more confusing by all the stuff that's out of alphabetic order.  Or I
think it is -- it's hard to tell because of things like re.S and re.DOTALL
being together.  My current guess is that the uppercase things come before
lowercase, but those odd pairings are definitely messing with my mind.

All of which is just to say it probably makes perfect sense to someone
who's used to it, but it's hard on someone new to these docs, and I'm not
even new to Python, just to the re module.

On Mon, Dec 12, 2016 at 11:03 AM, R. David Murray 
wrote:

>
> R. David Murray added the comment:
>
> When I follow the link to module contents, I find a list of the flags with
> their descriptions.  (re.A, re.I, etc, etc).  Perhaps you are confusing the
> letters used in the regular expression to represent the flags with the
> flags themselves?  I'm not sure how we could make that clearer.
>
> --
> nosy: +r.david.murray
>
> ___
> Python tracker 
> 
> ___
>

-- 
Kevin O'Gorman
#define QUESTION ((bb) || (!bb))   /* Shakespeare */

Please consider the environment before printing this email.

--
Added file: http://bugs.python.org/file45934/unnamed

___
Python tracker 

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



[issue28972] Document all "python -m" utilities

2016-12-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

+1 for Miki's idea.  It would be nice if there were a single page that 
collected together all the command-line tools (with examples).  It should 
include a 2to3 example as well.  Also, there should be some indication of which 
tools we guarantee to be available (2to3 json.tool) versus those that just 
happen to be exposed but are subject to change (possibly because they were just 
used for testing, or because they have a crummy API, or because Guido has said 
that we are in the library business, not the command-line tool business).

See also:  http://bugs.python.org/issue26488

--
assignee: docs@python -> 
nosy: +gvanrossum, rhettinger

___
Python tracker 

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



[issue28957] undefined symbol: PyUnicodeUCS2_FromUnicode when executing any command with pip2.7

2016-12-16 Thread Berker Peksag

Berker Peksag added the comment:

I think there are two different Python installations in your $PATH (the one you 
compiled with UCS4 and the other one is compiled with UCS2 - probably the 
system Python)

Anyway, like Terry said, this is out of scope for this tracker.

--
nosy: +berker.peksag
resolution:  -> not a bug
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



[issue28987] Remove typo in whats new entry on Descriptor Protocol Enhancements

2016-12-16 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +Elvis.Pranskevichus, yselivanov

___
Python tracker 

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



[issue25782] CPython hangs on error __context__ set to the error itself

2016-12-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Issue #28962 appears to be an example of this issue.  It uses 'raise e from e' 
to create the loop.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue13051] Infinite recursion in curses.textpad.Textbox

2016-12-16 Thread Berker Peksag

Berker Peksag added the comment:

The patch doesn't apply cleanly anymore so the next step would be to provide an 
updated patch.

By the way, I can reproduce the first bug, but not the second one. If the 
second bug can't be reproducible anymore, we might need a simpler patch.

--
nosy: +berker.peksag
type: crash -> behavior
versions: +Python 3.5, Python 3.6, Python 3.7 -Python 3.2

___
Python tracker 

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



[issue28927] bytes.fromhex should ignore all whitespace

2016-12-16 Thread Robert Xiao

Robert Xiao added the comment:

Sorry, I should have clarified that these methods consider *ASCII whitespace* 
equivalent - just like my proposed patch.

--

___
Python tracker 

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



[issue28927] bytes.fromhex should ignore all whitespace

2016-12-16 Thread Robert Xiao

Robert Xiao added the comment:

Terry, can you elaborate what you mean by a tradeoff? I feel like such a patch 
makes .fromhex more consistent with other string methods like .split() and 
.strip() which implicitly consider all whitespace equivalent.

Martin, I've updated the patch to include documentation updates and more 
testcases.

--
Added file: http://bugs.python.org/file45933/fromhex.patch

___
Python tracker 

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



[issue28957] undefined symbol: PyUnicodeUCS2_FromUnicode when executing any command with pip2.7

2016-12-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

PS, for future reference, 'crash' here means hanging or exiting *without* a 
traceback.

--

___
Python tracker 

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



[issue28957] undefined symbol: PyUnicodeUCS2_FromUnicode when executing any command with pip2.7

2016-12-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This tracker is for fixing Python and CPython.  There are other forums 
(python-list, StackOverflow, for instance) for help with user errors.  I 
believe that there are people on python-list with experience building on Ubuntu 
and variants, so I suggest asking there.  Include details on exactly how you 
retrieved the source onto your machine.

--
nosy: +terry.reedy
type: crash -> behavior

___
Python tracker 

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



[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError

2016-12-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Srikanth, when you reply by email, please remove the quotation of the previous 
message.  On the web page, it is just noise.  The only exception should be when 
you reply to a specific sentence and need to quote that sentence for context.

In my particular experience, mode() is unusally reserved for crudely describing 
unordered categorical data, where the concept of 'minimum' does not apply.

Mode is useful for determining the winner of a vote (or other decision 
process), but in general, it is not a substitute for a more comprehensive look 
at a dataset.

Problems with possibly returning a tuple of data items instead of a data item 
include:

1. The user then has to be prepared to handle a tuple instead of a data item.  
It would be better then to always return a tuple, even for 1 item.

2. Data items can be tuples, making a tuple return ambiguous.  Example use 
case: planar points with int coordinates.

>>> mode(((0,0), (0,0), (0,1)))
(0, 0)

So, while StatisticsError is a nuisance, so are the apparent alternatives.  I 
think we should leave mode alone and close this.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue28995] pathlib.WindowsPath.resolve() test expects short path

2016-12-16 Thread Steve Dower

New submission from Steve Dower:

With issue19717, WindowsPath.resolve() now properly resolves the filename using 
the Windows APIs.

However, this may cause parts of the path to be replaced with their full name 
when provided as the 8.3 short name. The test was not updated for this:

Traceback (most recent call last):
  File "C:\build\cpython36\lib\test\test_pathlib.py", line 1547, in 
test_resolve_common
self._check_resolve_relative(p, P(d, 'foo'), False)
  File "C:\build\cpython36\lib\test\test_pathlib.py", line 1491, in 
_check_resolve
self.assertEqual(q, expected)
AssertionError: 
WindowsPath('C:/Users/steve.dower/AppData/Local/Temp/2/tmptnm6y2cm-dirD/foo') 
!= WindowsPath('C:/Users/STEVE~1.DOW/AppData/Local/Temp/2/tmptnm6y2cm-dirD/foo')

We should make sure the test is referring to the same file rather than doing a 
direct path comparison. Maybe write a UUID into a file and read it out?

--
components: Tests, Windows
keywords: 3.6regression
messages: 283452
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: pathlib.WindowsPath.resolve() test expects short path
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue28994] Misc fixes and cleanups in error handling C code

2016-12-16 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch makes few minor changes related to handling errors in C.

* Fixed possible NULL dereference in PyErr_NormalizeException().

* Fixed error checking in atexit._run_exitfuncs().

* Fixed possible memory leaks in _Py_FatalError_PrintExc().

* PyErr_NormalizeException() no longer recursive.

* If an error is occurred during handling other error, the original exception 
is chained as the __contex__ attribute to the new exception instead of just be 
dropped.

* PyTraceBack_Print() no longer fails OverflowError if tracebacklimit is very 
large negative or positive value.

* ctype error message now include the name of the initial exception instead of 
the repr of its class.

* Py_XDECREFs is replaced with Py_DECREFs if this is safe.

* Added few asserts.

* Other minor cleanups.

--
components: Interpreter Core
files: errors.diff
keywords: patch
messages: 283451
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Misc fixes and cleanups in error handling C code
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45932/errors.diff

___
Python tracker 

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



[issue28929] Provide a link from documentation back to its source file

2016-12-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Nice idea.  I agree with an updated sidebar link, both aesthetically and as a 
practical matter for doc maintainers.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue28927] bytes.fromhex should ignore all whitespace

2016-12-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am a bit dubious about this.  There is a tradeoff here between convenience 
and bug detection.  The patch is not strictly necessary.

>>> bytes.fromhex('ab\ncd'.replace('\n', ''))
b'\xab\xcd'

Bytes (and bytearray) .fromhex already ignores spaces.  Not ignoring newlines, 
by default, may have been intentional.  Nick, you wrote the doc entry for 
'fromhex'.  Do you know anything about the design intention?

--
nosy: +ncoghlan, terry.reedy

___
Python tracker 

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



[issue28969] lru_cache is not threadsafe

2016-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

An alternative patch changes semantic of _PyDict_Pop() with deflt == NULL, but 
makes the code simpler.

--
Added file: 
http://bugs.python.org/file45931/lru_cache-dict-pop-simpler-3.5.patch

___
Python tracker 

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



[issue28991] Fix obscure lru_cache reentrancy bug

2016-12-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5ec5bfcf0089 by Raymond Hettinger in branch 'default':
Issue #28991:  Address comment that the __len__ call looked unattractive
https://hg.python.org/cpython/rev/5ec5bfcf0089

--

___
Python tracker 

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



[issue28816] Document if zipimport can respect import hooks to load custom files from zip.

2016-12-16 Thread Decorater

Decorater added the comment:

Well, Will there be any documentations for this before 3.6 final release or no 
because this would be nice to know for other people who would like to do 
something similar.

--

___
Python tracker 

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



[issue28991] Fix obscure lru_cache reentrancy bug

2016-12-16 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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

___
Python tracker 

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



[issue28991] Fix obscure lru_cache reentrancy bug

2016-12-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c23f8614151d by Raymond Hettinger in branch '3.5':
Issue #28991:  Fix obscure reentrancy bug in functools.lru_cache().
https://hg.python.org/cpython/rev/c23f8614151d

--
nosy: +python-dev

___
Python tracker 

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



[issue28991] Fix obscure lru_cache reentrancy bug

2016-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> How does the patch look to you?

It looks ugly, but technically correct. Push it if you like.

--
assignee: serhiy.storchaka -> rhettinger
stage: patch review -> commit review

___
Python tracker 

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



[issue24383] consider implementing __await__ on concurrent.futures.Future

2016-12-16 Thread Yury Selivanov

Yury Selivanov added the comment:

I think we should close this one.  Making concurrent.futures awaitable will 
likely only complicate things for end-users.

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



[issue26342] Faster bit ops for single-digit positive longs

2016-12-16 Thread Yury Selivanov

Yury Selivanov added the comment:

Closing this one, as we decided to not to micro-optimize int ops.

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



[issue28765] _sre.compile(): be more strict on types of indexgroup and groupindex

2016-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Hum, sorry, I don't understand what is the issue with adding a few addition 
> checks in the constructor? Is it a matter of speed?

It is a matter of readability and maintainability. Additional checks adds 21 
lines of the code, and they hardcode error messages. I copied currently 
produced error messages, with hardcoded function name and argument numbers. 
Changes in PyArg* functions or Argument Clinic that could globally enhance 
error messages would not affect these ones. Changing the function name or the 
arguments order would need to change error messages.

> I don't understand your "unpythonic" argument.

Sorry, I used bad wording. I meant that this doesn't follow the practice of 
CPython code. Builtins and extensions often ignore subclassing and use concrete 
API for simplicity and speed. Especially in internal functions. The interface 
of _sre.compile() already is made less general, it no longer works with general 
sequences and mappings. Ignoring subclassing don't make it much worse.

--

___
Python tracker 

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



[issue28969] lru_cache is not threadsafe

2016-12-16 Thread Ned Deily

Ned Deily added the comment:

Before it could be considered for 3.6.0, it needs to be reviewed, pushed to the 
3.6 branch for 3.6.1, and have some buildbot exposure.  3.6.0rc2 is in the 
process of manufacturing already.  Since this is a fairly extensive change, I 
think it would not be appropriate to throw it into a final release without 
prior release exposure.  Since it's also a bug in 3.5 and not a 3.6 release 
regression, I think it should wait for 3.6.1 unless we have a compelling reason 
to do a 3.6.0rc3.

--

___
Python tracker 

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



[issue28969] lru_cache is not threadsafe

2016-12-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Ned, can this be considered for inclusion in Python 3.6?   ISTM that this 
problematic in that it may already be causing hard-to-diagnose bugs in existing 
applications.

--
nosy: +ned.deily

___
Python tracker 

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



[issue28986] Docs should say set.update takes iterable

2016-12-16 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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



[issue28991] Fix obscure lru_cache reentrancy bug

2016-12-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

It is effortless to make this change and is consistent with all the other 
efforts taken to to protect against reentrancy, so yes, I think it should be 
done.  It isn't so much that I want this to be a use case, I would just like 
the implementation to be as sound as reasonably possible so that we don't find 
the LRU cache to be at heart of some future hard-to-find bug in a complex 
application.

How does the patch look to you?

--

___
Python tracker 

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



[issue28936] test_global_err_then_warn in test_syntax is no longer valid

2016-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't know what should we do with this. Is there a bug that needs to be 
fixed? Or maybe the test can be just removed?

--

___
Python tracker 

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



[issue28879] smtplib send_message should add Date header if it is missing, per RFC5322

2016-12-16 Thread R. David Murray

R. David Murray added the comment:

The signature of send_message cannot be changed for backward compatibility 
reasons.  It's signature was not intended to be an extension of the sendmail 
signature.

send_message cannot accept a dictionary, as then it would have to know how to 
format that dictionary into an RFC5322 compliant text string.  Nor can a 
dictionary represent a collection of email headers accurate.  Representing the 
headers and doing the serialization is the email package's job.

It is true that the ehlo_or_helo_if_needed is technically redundant, however, 
what it means is that once you've called any smtplib command you know that has 
been done, even if the subcommand raises an error.  This can make debuging 
easier (consistency of state), at a trivial cost.

The "more than one Resent block" error is explained in the comments.  If you 
want to write the heuristics to remove it, go ahead :)

Looking at that code, I see that I misremembered what it was doing.  I thought 
it was adding Resent-Date if it was missing, but it is instead determining what 
form of address headers it needs to add if Reset-Date is present.  That doesn't 
change the analysis in this issue, though.

--

___
Python tracker 

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



[issue28993] math.ceil() python 2.7

2016-12-16 Thread Zachary Ware

Zachary Ware added the comment:

The `/` operator in Python 2 does integer division.  `math.ceil(10/3)` in 
Python 2 is equivalent to `math.ceil(3)`.

--
nosy: +zach.ware
resolution:  -> not a bug
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



[issue28993] math.ceil() python 2.7

2016-12-16 Thread femi

New submission from femi:

math.ceil(10/3) python 2.7.12 returns 3

--
messages: 283434
nosy: akinfemi09
priority: normal
severity: normal
status: open
title: math.ceil() python 2.7
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



[issue28992] Use bytes.fromhex()

2016-12-16 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch makes the code and tests using bytes.fromhex(). The benefit of 
bytes.fromhex() over manual converting hexadecimals to bytes:

1. This is the one obvious way to do it.

2. This is the fastest way to do it.

--
components: Library (Lib)
files: use_bytes_fromhex.patch
keywords: patch
messages: 283433
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Use bytes.fromhex()
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file45930/use_bytes_fromhex.patch

___
Python tracker 

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



[issue28982] multiprocessing.Queue.get(block=True, timeout=0) always raises queue.Empty

2016-12-16 Thread Ryan Brindley

Ryan Brindley added the comment:

In addition, queue.Queue supports timeout value of 0 and its documentation says 
"non-negative number".

--

___
Python tracker 

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



[issue28879] smtplib send_message should add Date header if it is missing, per RFC5322

2016-12-16 Thread Eric Lafontaine

Eric Lafontaine added the comment:

Hi all, I was looking at the code of the function and also noticed multiple 
"itching".

1- Why raise an error when 2 resent-date exist?  it may exist and completely 
legitimate as per RFC5322.  The code should always take the first one it sees 
as per the RFC.
2- Also, there was an "ehlo_or_helo_if_needed", but it's done in sendmail 
function so makes it always irrelevant.
3- The signature of the function is different from the one of sendmail 
function.  My understanding is that send_message is a replacement of sendmail 
with more feature (praticality) and should be simple to change by just swaping 
the 2 of them. 
4- This "send_message" shouldn't be dependant on the email.message.Message 
class.  It should allow a dictionary to be passed as well.  So I removed the 
"get_all" to be replaced with a "get" method (which align with what 
dictionaries do. 


I have addressed 1,2 and 4 in my patch (modified the test case as well) and my 
efforts to make this better and clearer, but number 3 seems to be something 
that may be a big change for clients... Should we handle it at all?

Please review and give me feedbacks please, I'm open to negative ones as well 
;).  I need to know if I'm doing something wrong and I don't know all the 
principle (as you may have noticed).  

I've ran the "python -m test" & "./python -m smtplib" command, but is there 
something else I should've done?

List of things to do :
- Implement a patch for the code to add a missing "Date" field if it doesn't 
exist .   (in review)
- Modify the documentation at the SMTPLib for the send_message to mention that 
it add missing date using the email.utils.formatdate
- Modify the comment of the send_message code to mention RFC 5322 in there 
(ideally with the section of the RFC).  ( in review)
- Modify the example of Python 2 to present a RFC 5322 examples

Thanks Henning von Bargen, David, maciej.  I appreciate your support.  

Regards,
Eric Lafontaine

--
keywords: +patch
Added file: http://bugs.python.org/file45929/issue_28879.patch

___
Python tracker 

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



[issue28971] nntplib is broken when responses are longer than _MAXLINE

2016-12-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1386795d266e by Xavier de Gaye in branch '3.5':
Issue #28971: Temporarily skip test_over until a permanent solution is found
https://hg.python.org/cpython/rev/1386795d266e

New changeset a33047e08711 by Xavier de Gaye in branch '3.6':
Issue #28971: Merge 3.5
https://hg.python.org/cpython/rev/a33047e08711

New changeset b51914417b41 by Xavier de Gaye in branch 'default':
Issue #28971: Merge 3.6
https://hg.python.org/cpython/rev/b51914417b41

--
nosy: +python-dev

___
Python tracker 

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



[issue28971] nntplib is broken when responses are longer than _MAXLINE

2016-12-16 Thread Xavier de Gaye

Xavier de Gaye added the comment:

> I'd be in favor of temporarily skipping the affected tests with a message 
> that points back to here until we have a permanent solution.

I am working on it.

--

___
Python tracker 

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



[issue22135] allow to break into pdb with Ctrl-C for all the commands that resume execution

2016-12-16 Thread Chun-Yu Tseng

Chun-Yu Tseng added the comment:

Appreciate for your quick response. I have already left the reply in Rietveld.

I have uploaded a new patch with revised tests. In fact, the tests I wrote in 
the first patch are based on the style of `test_pdb2.py` in #7245 . But I am 
sure that now the new tests are better than the old because they run faster and 
source code looks simpler. (Note that these tests are still skipped to run on 
Windows)

Please tell me what can I do next :)

--
Added file: http://bugs.python.org/file45928/fix-cc-and-add-tests-v2.patch

___
Python tracker 

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



[issue28991] Fix obscure lru_cache reentrancy bug

2016-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Wrapping len() in an lru_cache is bad idea, because this brakes len() of lists, 
dicts and other non-hashable collections.

Should we support this doubtful case?

--

___
Python tracker 

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



[issue28991] Fix obscure lru_cache reentrancy bug

2016-12-16 Thread Raymond Hettinger

New submission from Raymond Hettinger:

Call __len__ directly inside the LRU cache code rather than using len().  This 
helps further encapsulate the cache internals making it less dependent on parts 
of the environment that are subject to change.

--
assignee: serhiy.storchaka
components: Library (Lib)
files: fix_lru_len_reentrancy.diff
keywords: patch
messages: 283426
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Fix obscure lru_cache reentrancy bug
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45927/fix_lru_len_reentrancy.diff

___
Python tracker 

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



[issue28971] nntplib is broken when responses are longer than _MAXLINE

2016-12-16 Thread Christian Heimes

Christian Heimes added the comment:

A larger limit is totally fine. The check protects against DoS with hundreds of 
MB.

I'm currently travelling and won't be available much until next week.

Am 16. Dezember 2016 19:37:03 MEZ, schrieb Xiang Zhang :
>
>Xiang Zhang added the comment:
>
>Xavier's plan sounds good. We could increase the line length limitation
>to 64K and add another limitation of the maximum lines a multi-line
>block could contain. Any limitation is violated the connection is
>refused. This situation seems quite similar to
>http.client.parse_headers, which doesn't get a standard length
>limitation or number limitation either.
>
>--
>nosy: +xiang.zhang
>
>___
>Python tracker 
>
>___

--

___
Python tracker 

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



[issue28971] nntplib is broken when responses are longer than _MAXLINE

2016-12-16 Thread Xiang Zhang

Xiang Zhang added the comment:

Xavier's plan sounds good. We could increase the line length limitation to 64K 
and add another limitation of the maximum lines a multi-line block could 
contain. Any limitation is violated the connection is refused. This situation 
seems quite similar to http.client.parse_headers, which doesn't get a standard 
length limitation or number limitation either.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue28909] Adding LTTng-UST tracing support

2016-12-16 Thread Francis Deslauriers

Changes by Francis Deslauriers :


--
nosy: +jcea

___
Python tracker 

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



[issue28971] nntplib is broken when responses are longer than _MAXLINE

2016-12-16 Thread Zachary Ware

Zachary Ware added the comment:

This is causing all buildbots to fail again; I'd be in favor of temporarily 
skipping the affected tests with a message that points back to here until we 
have a permanent solution.

--
keywords: +buildbot
priority: normal -> high

___
Python tracker 

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



[issue28982] multiprocessing.Queue.get(block=True, timeout=0) always raises queue.Empty

2016-12-16 Thread Ryan Brindley

Ryan Brindley added the comment:

So, the code handles timeout = 0 on systems where time.time() returns an int. 
Look at the following snippet and consider 2 assumptions: (1) time.time() 
returns an int, and (2) self._rlock.acquire call takes less than a second

if block:
deadline = time.time() + timeout
if not self._rlock.acquire(block, timeout):
raise Empty
try:
if block:
timeout = deadline - time.time()
if timeout < 0 or not self._poll(timeout):
raise Empty


The problem for the timeout = 0 case happens on systems where time.time() 
returns a floating point number and the acquire lock takes enough time to cause 
a diff in time.time() result between the deadline instantiation line and the 
timeout update line.

Given that, especially the `if timeout < 0 ...` line, I thought it may have 
been in the original intent for the function to handle 0 timeout when block 
truthy.

That side, the whole concept of having a separate block bool arg in the first 
place is a tad strange for me. Isn't it a bit redundant?

Why not just follow the underlying poll/select timeout arg logic as follows:

timeout = None, block indefinitely
timeout <= 0, non-block
timeout > 0, block timeout length

We could simplify this interaction by just removing that block arg all 
together. Not that I'm asking to do that here though, but maybe in the future?

If we go down the suggested error-raising path though, I would ask that the 
error not be queue.Empty -- which is misleading.

--

___
Python tracker 

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



[issue14061] Misc fixes and cleanups in archiving code in shutil and test_shutil

2016-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Martin for your review.

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



[issue18896] Remove namedtuple 255 arguments restriction

2016-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Raymond for your review.

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



[issue18896] Remove namedtuple 255 arguments restriction

2016-12-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7454ca88aacb by Serhiy Storchaka in branch 'default':
Issue #18896: Python function can now have more than 255 parameters.
https://hg.python.org/cpython/rev/7454ca88aacb

--
nosy: +python-dev

___
Python tracker 

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



[issue28180] sys.getfilesystemencoding() should default to utf-8

2016-12-16 Thread Chi Hsuan Yen

Changes by Chi Hsuan Yen :


--
nosy: +Chi Hsuan Yen

___
Python tracker 

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



[issue23262] webbrowser module broken with Firefox 36+

2016-12-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee: serhiy.storchaka -> 

___
Python tracker 

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



[issue14061] Misc fixes and cleanups in archiving code in shutil and test_shutil

2016-12-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 929c2d076a85 by Serhiy Storchaka in branch '3.5':
Issue #14061: Misc fixes and cleanups in archiving code in shutil.
https://hg.python.org/cpython/rev/929c2d076a85

New changeset 268d3763bb07 by Serhiy Storchaka in branch '3.6':
Issue #14061: Misc fixes and cleanups in archiving code in shutil.
https://hg.python.org/cpython/rev/268d3763bb07

New changeset 5fd772a20f25 by Serhiy Storchaka in branch 'default':
Issue #14061: Misc fixes and cleanups in archiving code in shutil.
https://hg.python.org/cpython/rev/5fd772a20f25

New changeset eb02db65e148 by Serhiy Storchaka in branch '2.7':
Issue #14061: Misc fixes and cleanups in archiving code in shutil.
https://hg.python.org/cpython/rev/eb02db65e148

--
nosy: +python-dev

___
Python tracker 

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



[issue28990] asyncio SSL hangs if connection is closed before handshake completed

2016-12-16 Thread Yury Selivanov

Yury Selivanov added the comment:

Ned, would you be able to cherry-pick this in 3.6.0?  Guido approved this.

--
resolution:  -> fixed
stage:  -> resolved
type:  -> behavior

___
Python tracker 

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



[issue28990] asyncio SSL hangs if connection is closed before handshake completed

2016-12-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fcba55d649ea by Yury Selivanov in branch '3.5':
Issue #28990: Fix SSL hanging if connection is closed before handshake 
completed.
https://hg.python.org/cpython/rev/fcba55d649ea

New changeset fcc642bf88c1 by Yury Selivanov in branch '3.6':
Merge 3.5 (issue #28990)
https://hg.python.org/cpython/rev/fcc642bf88c1

New changeset 59eea8122df6 by Yury Selivanov in branch 'default':
Merge 3.6 (issue #28990)
https://hg.python.org/cpython/rev/59eea8122df6

--
nosy: +python-dev

___
Python tracker 

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



[issue28990] asyncio SSL hangs if connection is closed before handshake completed

2016-12-16 Thread Yury Selivanov

New submission from Yury Selivanov:

Upstream link: https://github.com/python/asyncio/pull/476

--

___
Python tracker 

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



[issue28989] .dll files missing

2016-12-16 Thread Brendan Donegan

Brendan Donegan added the comment:

This more likely to be a system misconfiguration issue than a Python one. 
Following 
http://stackoverflow.com/questions/33265663/api-ms-win-crt-runtime-l1-1-0-dll-is-missing-when-opening-microsoft-office-file
 will probably fix the issue for you.

--
nosy: +brendan-donegan

___
Python tracker 

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



[issue28990] asyncio SSL hangs if connection is closed before handshake completed

2016-12-16 Thread Yury Selivanov

Changes by Yury Selivanov :


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

___
Python tracker 

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



[issue28990] asyncio SSL hangs if connection is closed before handshake completed

2016-12-16 Thread Yury Selivanov

New submission from Yury Selivanov:

Resolved: https://github.com/python/asyncio/issues/472

--
assignee: yselivanov
components: asyncio
messages: 283413
nosy: gvanrossum, larry, ned.deily, yselivanov
priority: release blocker
severity: normal
status: open
title: asyncio SSL hangs if connection is closed before handshake completed
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue28989] .dll files missing

2016-12-16 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue28879] smtplib send_message should add Date header if it is missing, per RFC5322

2016-12-16 Thread Henning von Bargen

Henning von Bargen added the comment:

OK, I understand the arguments. 
If I understand correctly, this will be fixed in one way or another in Python 
3.6 or 3.7.
For Python 2.7, this will not be fixed (so I have to work around this somehow, 
should be quite easy).
I think that at least the documentation and the examples for smtplib should be 
updated.

The doc should make it clear that the message is passed "as-is" and it's the 
caller's reponsibility to create a valid message string.

The examples at https://docs.python.org/2/library/email-examples.html should 
note which header fields are required by RFC 5322 and provide an example.

--

___
Python tracker 

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



[issue28989] .dll files missing

2016-12-16 Thread Gabriel Lopez

New submission from Gabriel Lopez:

Every time I try loading Python 3.5, it says "The program can't start because 
api-ms-win-crt-runtime-l1-1-0.dll is missing from your computer." How can I fix 
this?

--
messages: 283411
nosy: Gabriel Lopez
priority: normal
severity: normal
status: open
title: .dll files missing

___
Python tracker 

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



[issue28446] pyvenv generates malformed hashbangs for scripts

2016-12-16 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Seems there are quite a few typos/copy-paste errors in the original 
steps-to-reproduce. Here are my steps on macOS:

$ ./python-build/python.exe -m venv 'aaa bbb'
$ source ./aaa\ bbb/bin/activate
$ pip
zsh: /Users/yen/tmp/aaa bbb/bin/pip: bad interpreter: "/Users/yen/tmp/aaa: no 
such file or directory

The result is similar on Linux.

Like Alex said, I don't think there's a portable solution, either, so here's a 
patch to warn users for possibly broken paths.

macOS kernel has another bug/limitation. In XNU, '#' symbol also breaks shebang:

$ ./python-build/python.exe -m venv 'aaa#bbb'
$ source ./aaa\#bbb/bin/activate
$ pip
zsh: /Users/yen/tmp/aaa#bbb/bin/pip: bad interpreter: 
/Users/yen/tmp/aaa#bbb/bin/python: no such file or directory

This is even confusing as the kernel thinks the interpreter is 
/Users/yen/tmp/aaa (everything after the first # is thrown away, see [1]) while 
zsh/bash thinks it's /Users/yen/tmp/aaa#bbb/bin/python. As a result, I add a 
warning for #, too

Some related discussions:
1. https://github.com/pypa/pip/issues/923 (pip does not support spaces in 
directories names)
2. https://github.com/pypa/virtualenv/issues/53 (Whitespace in root path of 
virtualenv breaks scripts)
3. https://github.com/pypa/virtualenv/issues/973 (bad interpreter error when 
creating virtualenv's in directories with '#' in name)

Adding venv maintainer and some macOS experts

[1] 
https://opensource.apple.com/source/xnu/xnu-3789.21.4/bsd/kern/kern_exec.c.auto.html,
 line 511

--
components: +Library (Lib)
keywords: +patch
nosy: +Chi Hsuan Yen, ned.deily, ronaldoussoren, vinay.sajip
versions: +Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45926/venv-check-path.patch

___
Python tracker 

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



[issue28180] sys.getfilesystemencoding() should default to utf-8

2016-12-16 Thread STINNER Victor

STINNER Victor added the comment:

> I believe Victor put quite a bit of time into trying to get more selective 
> approaches to work reliably and eventually gave up.

Yeah, it just doesn't work to use more than one encoding per process. You 
should use the same encoding for the whole lifetime of a process.

If you decode early data from an encoding A and later encode it back to 
encoding B, you get mojibake. The problem is simple.

Using more than one encoding per process means starting to make assumtpions on 
how data is used. For example, consider that environment variables use the 
encoding A, but filenames should use the encoding B. Or, but what if an 
environment variable contains a filename? Similar issues for command line 
arguments, subprocess pipes, standard streams (sys.std*), etc.

--

___
Python tracker 

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



[issue28180] sys.getfilesystemencoding() should default to utf-8

2016-12-16 Thread STINNER Victor

STINNER Victor added the comment:

Victor>> I proposed to add "-X utf8" command line option for UNIX to force utf8 
encoding. Would it work for you?

Jan Niklas Hasse> Unfortunately no, as this would mean I'll have to change all 
my python invocations in my scripts and it wouldn't work for executable files 
with "#!/usr/bin/env python3" would it?

Usually, when a new option is added to Python, we add a command line option (-X 
utf8) but also an environment variable: I propose PYTHONUTF8=1.

Use your favorite method to define the env var "system wide" in your docker 
containers.

Note: Technically, I'm not sure that it's possible to support -E option with 
PYTHONUTF8, since -E comes from the command line, and we first need to decode 
command line arguments with an encoding to parse these options 
Chicken-and-egg issue ;-)

--

___
Python tracker 

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



[issue28770] Update python-gdb.py for fastcalls

2016-12-16 Thread Ned Deily

Ned Deily added the comment:

Please leave this open until the cherry picking is completed.

--
status: closed -> open

___
Python tracker 

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



[issue28959] Add a macro for dict size

2016-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

After further analysis I conclude that instance dict can be only NULL or a 
dict. Therefore PyDict_Size() is correctly used in typeobject.c and 
_datetimemodule.c. It never fails, and additional PyDict_Check() is not needed.

Committed changes don't include switching a dict structure to PyVarObject. 
Separate issue28988 is opened for this.

Thanks Raymond, Inada and Victor for your reviews.

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



[issue28988] Switch dict and set structures to PyVarObject

2016-12-16 Thread STINNER Victor

STINNER Victor added the comment:

Copy/paste of my msg283176:

> dict doesn't end with array.

Right, but...

Recently I looked at dict internals. As a newcomer, I have to confess that it's 
currently really hard to understand the purpose of each dict field: they are 
many "sizes": size of the hash table, number of usable entries, number of used 
entries, number of items in the dictionary, etc.

I like the idea of using the standard ob_size field (PyVarObject) to make it 
more explicitl that this field is the expected result of len(obj).

Technically, I don't know any function inside Python core which rely on the 
fact that object data is at the end of the main memory block.

Other builtin Python types:

* tuple: PyVarObject
* list: PyVarObject
* bytes: PyVarObject
* bytearray: PyVarObject
* memoryview: PyVarObject
* set: "used" field
* str: "length" field

The str type is super optimized for memory footprint, there are technical 
reasons for not used PyVarObject here, like backward compatibility.

It may make sense to modify PySetObject to use PyVarObject as well, but that's 
a different topic :-)

--

___
Python tracker 

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



[issue28988] Switch dict and set structures to PyVarObject

2016-12-16 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

In issue28959 Raymond said that a dict structure can be switched to 
PyVarObject. Victor guessed that it makes sense to switch a set structure too. 
Proposed patch implements this. The layout of a dict structure is not changed. 
The number of used and filled entries in a set structure are swapped, therefore 
extensions that use PySet_GET_SIZE or access fields of PySetObject directly 
(both are not in a stable API) should be recompiled.

I don't see a benefit from this patch except some unification.

--
assignee: rhettinger
components: Extension Modules
files: dict-set-var-object.patch
keywords: patch
messages: 283404
nosy: haypo, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Switch dict and set structures to PyVarObject
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file45925/dict-set-var-object.patch

___
Python tracker 

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



[issue28838] Using consistent naming for arguments of "call" functions (C API)

2016-12-16 Thread STINNER Victor

STINNER Victor added the comment:

I consider that the cleanup itself is done, so I close the issue. For further 
enhancements, I will open new issues.

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

___
Python tracker 

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



[issue28770] Update python-gdb.py for fastcalls

2016-12-16 Thread STINNER Victor

STINNER Victor added the comment:

The change was cherry-picked in Python 3.6.0RC2.

The issue is now fixed, so I close the issue.

--
status: open -> closed

___
Python tracker 

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



[issue28987] Remove typo in whats new entry on Descriptor Protocol Enhancements

2016-12-16 Thread Jim Fasarakis-Hilliard

New submission from Jim Fasarakis-Hilliard:

Attached patch removes small typo ('has') from text:

extends the descriptor protocol has to include the new optional

--
assignee: docs@python
components: Documentation
files: whatsnew_typo.patch
keywords: patch
messages: 283401
nosy: Jim Fasarakis-Hilliard, docs@python
priority: normal
severity: normal
status: open
title: Remove typo in whats new entry on Descriptor Protocol Enhancements
versions: Python 3.6
Added file: http://bugs.python.org/file45924/whatsnew_typo.patch

___
Python tracker 

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



[issue28959] Add a macro for dict size

2016-12-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dbf72357cb4a by Serhiy Storchaka in branch 'default':
Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of 
dict.
https://hg.python.org/cpython/rev/dbf72357cb4a

--
nosy: +python-dev

___
Python tracker 

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



[issue28986] Docs should say set.update takes iterable

2016-12-16 Thread R. David Murray

R. David Murray added the comment:

update([iterable]) is a specific case of update(*others).  udpate([1, 2], [3, 
4]) is another specific case.

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



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2016-12-16 Thread Nick Coghlan

Changes by Nick Coghlan :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue28518] execute("begin immediate") throwing OperationalError

2016-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a little simplified version. No need to handle a single "begin".

--
Added file: http://bugs.python.org/file45923/sqlite-explicit-begin2.patch

___
Python tracker 

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



[issue20191] resource.prlimit(int, int, str) crashs

2016-12-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue13051] Infinite recursion in curses.textpad.Textbox

2016-12-16 Thread David Andersen

David Andersen added the comment:

Any progress on this? Its Dec 2016 and this bug is still around. There's a 
patch and a patch with tests. The problem is well-understood. I'm not sure what 
the holdup is, but it would be great to get fixed!

--
nosy: +rxcomm

___
Python tracker 

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



[issue28984] json.dump + indent creates trailing extra spaces

2016-12-16 Thread Knut

Knut added the comment:

sorry, I missed that point in the docs.

--

___
Python tracker 

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



[issue28147] Unbounded memory growth resizing split-table dicts

2016-12-16 Thread STINNER Victor

STINNER Victor added the comment:

> Oh, I'm sorry.  It seems I had failed to push the commit yesterday.

No problem. Thanks for your fix! I prefer to not see the bug in Python
3.6.0 final!

--

___
Python tracker 

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



[issue28986] Docs should say set.update takes iterable

2016-12-16 Thread Nick Evans

New submission from Nick Evans:

The docs say that set.update takes *args:

  update(*others)

But actually set.update takes an optional iterable:

  update([iterable])

--
assignee: docs@python
components: Documentation
messages: 283394
nosy: docs@python, nre3976
priority: normal
severity: normal
status: open
title: Docs should say set.update takes iterable
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



[issue28977] Document PyObject_CallFunction() special case more explicitly

2016-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> All other format codes are illegal for single argument.

I was wrong. PyObject_CallFunction() handles correctly a single non-tuple 
argument. The problem is only with tuple result of Py_BuildValue().

> What do you mean exactly by deprecating the feature? Emit a warning if and
> only if te format string is "O" (or "S" or "N") and Py_BuildValue() returns
> a tuple?

Emit a FutureWarning if the format string contains the single format code and 
Py_BuildValue() returns a tuple. In 3.8 or 3.9 the behavior will be changed.

> I dislike this path
> because developers would try to make the warning quiet in Python 3.7, for
> example use "(O)" format string, which is less obvious and looks like a
> hack to me.

PyObject_CallFunctionObjArgs(func, arg, NULL) seems obvious and perhaps even 
more efficient in all versions.

> More and more applications use Python bleeding edge (the development branch,
> default), and more and more developers quickly test their application on
> the new Python stable release. Maybe we can "simply" fix the behaviour of
> PyObject_CallFunction() with no transition period:

Ask on Python-Dev. I afraid this is too dangerous. We should have at least one 
release with a FutureWarning.

> Most developers don't expect the feature and so write
> code which doesn't work with tuple arguments.

That is why we should add a FutureWarning. If the code doesn't fail by 
accident, but just works incorrectly, this can be unnoticed. FutureWarning 
could help to fix possible bugs in older Python versions.

--

___
Python tracker 

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



[issue28147] Unbounded memory growth resizing split-table dicts

2016-12-16 Thread INADA Naoki

INADA Naoki added the comment:

Oh, I'm sorry.  It seems I had failed to push the commit yesterday.

--

___
Python tracker 

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



[issue28770] Update python-gdb.py for fastcalls

2016-12-16 Thread Ned Deily

Changes by Ned Deily :


--
status: closed -> open

___
Python tracker 

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



[issue28770] Update python-gdb.py for fastcalls

2016-12-16 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +ned.deily
priority: normal -> release blocker

___
Python tracker 

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



[issue28977] Document PyObject_CallFunction() special case more explicitly

2016-12-16 Thread STINNER Victor

STINNER Victor added the comment:

If the behaviour of PyObject_CallFunction(func, "O", arg) is changed, an 
application relying on the current behaviour would have to replace:

   res = PyObject_CallFunction(func, "O", arg);

with:

   /* code working on any Python version */
   if (PyTuple_Check(arg))
   res = PyObject_Call(func, arg, NULL);
   else
   res = PyObject_CallFunction(func, "O", arg);

--

___
Python tracker 

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



[issue28977] Document PyObject_CallFunction() special case more explicitly

2016-12-16 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy: "O" is not the only special case. "S" and "N" unpack a tuple argument 
too. "O&" converter should return a tuple, otherwise it is an error. All other 
format codes are illegal for single argument.

Oh, I didn't know. I should update my documentation.


Serhiy: I would just deprecate this feature (in PyObject_CallFunction, not in 
Py_BuildValue). The behavior of PyObject_CallFunction with a single argument 
can be made more consistent and useful.

PyObject_CallFunction(func, "O", arg) should call func(arg). I don't want the 
"O" format (and "S" and "N").

What do you mean exactly by deprecating the feature? Emit a warning if and only 
if te format string is "O" (or "S" or "N") and Py_BuildValue() returns a tuple?

I guess that PyObject_CallFunction(func, "(O)", arg) doesn't need to be 
modified, it already always call func(arg), even if arg is a tuple.

I am also tempted to fix PyObject_CallFunction() (and similar functions) rather 
than documenting the special case, but I dislike the idea of a deprecation.

Let's say that calling PyObject_CallFunction(func, "O", arg) where arg is a 
tuple would emit a DeprecationWarning and call func(*arg) in Python 3.7, but 
call func(arg) with no warning in Python 3.8. I dislike this path because 
developers would try to make the warning quiet in Python 3.7, for example use 
"(O)" format string, which is less obvious and looks like a hack to me.


More and more applications use Python bleeding edge (the development branch, 
default), and more and more developers quickly test their application on the 
new Python stable release. Maybe we can "simply" fix the behaviour of 
PyObject_CallFunction() with no transition period:

* Python 3.6: PyObject_CallFunction(func, "O", arg) calls func(arg), or 
func(*arg) if arg is a tuple
* Python 3.7: PyObject_CallFunction(func, "O", arg) always calls func(arg)

The special case was never documented. In my experience, almost no developer 
rely on this feature. Most developers don't expect the feature and so write 
code which doesn't work with tuple arguments.

--

___
Python tracker 

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



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-16 Thread Manish Singh

Manish Singh added the comment:

Hi David Murray,

Please refer this link,

http://stackoverflow.com/questions/383738/104-connection-reset-by-peer-socket-error-or-when-does-closing-a-socket-resu

--

___
Python tracker 

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



[issue28091] Document PEP 525 & 530

2016-12-16 Thread Ned Deily

Ned Deily added the comment:

[cherrypicked for 3.6.0rc2]

--
priority: deferred blocker -> 

___
Python tracker 

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



[issue28900] update 'docs for other versions'

2016-12-16 Thread Ned Deily

Ned Deily added the comment:

[cherrypicked for 3.6.0rc2]

--

___
Python tracker 

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



[issue28900] update 'docs for other versions'

2016-12-16 Thread Ned Deily

Changes by Ned Deily :


--
priority: release blocker -> 
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