[issue26491] Defer DECREFs until enum object is in a consistent state for re-entrancy

2016-03-11 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



[issue25652] collections.UserString.__rmod__() raises NameError

2016-03-11 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



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

2016-03-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

quad, please don't change issue attributes to unrelated values.

--
type: security -> 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



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

2016-03-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components:  -2to3 (2.x to 3.x conversion tool)

___
Python tracker 

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



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

2016-03-11 Thread Kwamenichols

Changes by Kwamenichols :


--
components: +2to3 (2.x to 3.x conversion tool)
hgrepos: +334
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



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

2016-03-11 Thread Kwamenichols

Changes by Kwamenichols :


--
nosy: +quad
type: enhancement -> security

___
Python tracker 

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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e54224e8d6a9 by Victor Stinner in branch 'default':
Revert change 291d47954618
https://hg.python.org/cpython/rev/e54224e8d6a9

--

___
Python tracker 

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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread STINNER Victor

STINNER Victor added the comment:

Elena's issue13305.diff:

"Zero padding can be forced on some platforms by using e.g. ``%4Y``"

Sorry, I still doesn't understand the change. %4Y doesn't work with strptime() 
and it only work with strftime() on very few platforms.

Can you explain when %4Y should be used? strftime() and/or strptime()? Which 
platform?

To me, it looks wrong to document %4Y since it almost never works...

--

___
Python tracker 

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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread STINNER Victor

STINNER Victor added the comment:

>> About Elena Oat's patch issue13305.diff: I'm not sure that
>> strftime("%4Y") works on all platforms

> It doesn't, that's what the patch is trying to document.

Oh. I confirm: %4Y gives "4Y" for any year on FreeBSD and Mac OS X, it raises 
ValueError("Invalid format string") on Windows, etc.

--

___
Python tracker 

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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread Ezio Melotti

Ezio Melotti added the comment:

> About Elena Oat's patch issue13305.diff: I'm not sure that
> strftime("%4Y") works on all platforms

It doesn't, that's what the patch is trying to document.
AFAICT it works on my Linux (but not on yours), it gives '4Y' on Mac, and 
raises an error on Windows.  This should depend on the libc used by system, so 
the same OS can give different results depending on which libc it uses, and the 
only sure thing is that %4Y is not a portable solution.
FWIW the patch LGTM (except a couple minor nits -- zero-pad should be 
hyphenated and there should be a double space after the dot), but I'm not sure 
if it's better mentioning platforms at all or just being vague and say that it 
works on some platforms but not others and leave up to the user figuring out 
where.

--

___
Python tracker 

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



[issue17605] mingw-meta: build interpeter core

2016-03-11 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue26519] Cython doesn't work anymore on Python 3.6

2016-03-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Stefan, could you please check that this issue is fixed and there are no other 
cases of pickling or copying unpickleable classes?

--

___
Python tracker 

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



[issue22625] When cross-compiling, don’t try to execute binaries

2016-03-11 Thread Martin Panter

Martin Panter added the comment:

In  I 
suggested adding some makefile settings to manually override the pgen and 
_frozen_importlib programs. I imagine the changes would look something like 
cross-override.patch. Can someone who does cross compiling see if it is any 
use, and/or also indicate what commands or process they use to cross compile?

--
versions:  -Python 3.4
Added file: http://bugs.python.org/file42143/cross-override.patch

___
Python tracker 

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



[issue26314] interned strings are stored in a dict, a set would use less memory

2016-03-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Dicts are hard optimized for string keys due to using them for globals and 
attributes lookup. Sets are optimized too, but rather for accident. We can be 
sure that dicts will be always optimized, but set optimization can be 
eliminated for the sake of simplification or if it will be proven that special 
casing strings has enough large negative effect on non-string items.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26511] Add link to id() built-in in comparison operator documentation for "is"

2016-03-11 Thread Martin Panter

Martin Panter added the comment:

Please don’t use nested brackets like that in English text. Try to rewrite the 
sentence without brackets (e.g. use a comma or say “This is equivalent to”) [or 
use a different kind of bracket if you really must (to make the nesting 
clearer)].

--
nosy: +martin.panter

___
Python tracker 

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



[issue17592] mingw: configure MACHDEP and platform for build

2016-03-11 Thread Martin Panter

Martin Panter added the comment:

Here is a modified patch fixing a couple of the spelling & style problems. I 
moved the comment introducing the ac_sys_ variables up to before the code that 
sets them. I rearranged the logic for _PYTHON_HOST_PLATFORM so it is clear that 
$host_os overrides $host, and I combined the cygwin and mingw cases.

I suspect the configure.ac logic could be simplified more.

--
Added file: http://bugs.python.org/file42142/MINGW-MACHDEP.v2.patch

___
Python tracker 

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



[issue26535] Minor typo in the docs for struct.unpack

2016-03-11 Thread Martin Panter

Martin Panter added the comment:

The patch looks good to me, though it should be applied to all three unpack 
functions and Struct methods, and the doc strings (struct.unpack.__doc__ etc).

An alternative wording is already used for struct.iter_unpack(): “the buffer’s 
size in bytes”. Maybe that is slightly clearer, but it’s no big deal.

--
stage: needs patch -> patch review
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



[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-03-11 Thread Nathaniel Smith

Nathaniel Smith added the comment:

> Note: I don't understand what are domain, tag (address of the memory block?) 
> or quantity (size of the memory block?).

Yes, the idea is basically the same as now, except with an extra const char * 
specifying the "domain", so that one could keep separate track of different 
kinds of allocations. So PyMem_Malloc would just call PyMem_RecordAlloc("heap", 
ptr, size) (or act equivalently to something that called that, etc.), but 
something like PyCuda might do PyMem_RecordAlloc("gpu", ptr, size) to track 
allocations in GPU memory. All the tracing stuff in tracemalloc would be 
awesome to have for GPU allocations, and it would hardly require any changes to 
enable it. Ditto for other leakable resources like file descriptors or shmem 
segments.

> I don't plan to store new information in tracemalloc. tracemalloc design is 
> "simple": it stores a trace for each memory block. A memory block is 
> identified by its address (void* pointer) and a trace is a tuple (size, 
> traceback).
> Extending a trace would increase the memory footprint overhead of tracemalloc.

I think the extra footprint would be tiny? Logically, you'd index traces by 
(domain, pointer) instead of (pointer), but since we expect that the number of 
distinct domains is small (like... 1, in the common case) then the natural 
implementation strategy would be to replace the current {pointer: trace} 
mapping with a mapping {domain: {pointer: trace}}. So the total overhead would 
be basically the overhead of allocating a single additional dict.

That said, I think having the domain argument *in the public hookable API* is 
useful even if the tracemalloc hooks themselves decide to ignore it or just 
ignore all calls that don't refer to the "heap" domain -- because it's 
extremely cheap to put this in the API now while we're adding it, and it leaves 
the door open for someone else to come along later and make an awesome gpu heap 
tracker or whatever without having to first argue with python-dev and wait for 
the cpython release cycle.

--

___
Python tracker 

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



[issue17590] mingw: translate gcc internal defines to python platform specific defines

2016-03-11 Thread Martin Panter

Martin Panter added the comment:

Here is a possible alternative patch that moves MS_WINDOWS etc from 
PC/pyconfig.h to "pyport.h". Not tested with standard Windows build.

--
components:  -Cross-Build
Added file: http://bugs.python.org/file42141/MS_WINDOWS-move.patch

___
Python tracker 

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



[issue9998] ctypes find_library should search LD_LIBRARY_PATH on linux

2016-03-11 Thread Martin Panter

Martin Panter added the comment:

I tend to agree with the comment at 
. Find_library() is documented as 
emulating a build-time linker, not run-time. Build-time linking ignores 
LD_LIBRARY_PATH.

Maybe it would make more sense to pass in an optional list of -L directories to 
search, but it really depends on what the use cases are.

Pau: What is wrong with the more direct CDLL("libspatialindex_c.so") proposal 
that bypasses find_library()?

--
nosy: +martin.panter

___
Python tracker 

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



[issue26323] Add assert_called() and assert_called_once() methods for mock objects

2016-03-11 Thread Berker Peksag

Changes by Berker Peksag :


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



[issue26545] os.walk is limited by python's recursion limit

2016-03-11 Thread Thomas Waldmann

Thomas Waldmann added the comment:

Note: similar issues can be seen in other stdlib recursive filesystem-related 
functions also.

--

___
Python tracker 

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



[issue26545] os.walk is limited by python's recursion limit

2016-03-11 Thread Thomas Waldmann

New submission from Thomas Waldmann:

os.walk calls itself recursively and that limits the directory depth it can 
"walk" into.

On Linux, one can create directory hierarchies deeper than that.

For some more details see there:

https://github.com/borgbackup/borg/issues/380

--
components: Library (Lib)
messages: 261626
nosy: Thomas.Waldmann
priority: normal
severity: normal
status: open
title: os.walk is limited by python's recursion limit
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



[issue20589] pathlib.owner() and pathlib.group() raise ImportError on Windows

2016-03-11 Thread Berker Peksag

Berker Peksag added the comment:

Thanks Victor.

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



[issue21910] File protocol should document if writelines must handle generators sensibly

2016-03-11 Thread Martin Panter

Changes by Martin Panter :


--
stage:  -> needs patch

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2016-03-11 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +lemburg

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2016-03-11 Thread Thomas Waldmann

New submission from Thomas Waldmann:

platform.libc_ver() is trivially broken as it uses string comparison internally 
to determine the maximum libc version number (which is obviously broken as 
"2.9" > "2.10").

--
components: Library (Lib)
messages: 261624
nosy: Thomas.Waldmann
priority: normal
severity: normal
status: open
title: platform.libc_ver() returns incorrect version number
type: behavior
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



[issue26535] Minor typo in the docs for struct.unpack

2016-03-11 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-11 Thread Martin Panter

Martin Panter added the comment:

To add a second response you would just concatenate it to the existing 
response. (Your existing test already uses FakeSocket.) The FakeSocket 
parameter just represents data that would be sent from the server. So:

body = (
   b"HTTP/1.1 200 OK\r\n"
   b"Content-Length: 3\r\n"
   b"\r\n"
   b"abc"
   b"HTTP/1.1 408 Next response should not be read yet\r\n"
)

In fact, see the BasicTest.test_content_length_sync() case, which literally has 
"extradata" as that last line. I think we just need to adapt or duplicate this 
test to cover readline() and read1(), not just read(). Maybe also with 
read1(100), readline(100) cases as well.

--

___
Python tracker 

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



[issue26323] Add assert_called() and assert_called_once() methods for mock objects

2016-03-11 Thread Amit Saha

Amit Saha added the comment:

Thank you Victor.

--

___
Python tracker 

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



[issue26525] Documentation of ord(c) easy to misread

2016-03-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The easily misread "ord('ν')" could be expanded to "ord('ν') (Greek nu)" but I 
agree that "ord('€') (Euro sign)" would be either better for a global doc.  
(And the return is 8364.)  If no objection (Benjamin? Nick?), I am willing to 
do it for 3.5/6

There is no need to change the 2.7 version "ord(u'\u2020') returns 8224."

--
nosy: +terry.reedy
stage:  -> patch review
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



[issue26511] Add link to id() built-in in comparison operator documentation for "is"

2016-03-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

There is not 'integer caching in Python'.  This is strictly an implementation 
feature of CPython, and any other implementation that does similarly.

"or id(x) == id(y)" should be "(id(x) == id(y))" as the addition is an 
alternate wording, not an alternate condition.  I am not sure that this will 
always be helpful.

--
nosy: +terry.reedy
stage:  -> needs patch
versions: +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



[issue26500] Document of new star unpacking is missing.

2016-03-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

#19024 was about adding a general section on the various uses of '*'.  This was 
before the new * unpacking generalizations.  It was closed because the then 
existing uses *are* documented and are indexed in the first, Symbols, section 
of the index. 

There are now 4 entries. I think entries for standalone '*' (operator and 
function defs) should be separated from those for '*identifier'.  Entries for 
new *identifier uses need to be added to the index.  Assignment statement 
*identifier target is in 7.2. Assignment statements. 

Actually documenting the changes in #2292 is #24136 (untouched since July).

--
nosy: +terry.reedy
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> document PEP 448: unpacking generalization
title: Document of star operator missing. It must be documented for better 
understanding. -> Document of new star unpacking is missing.
versions: +Python 3.5, Python 3.6 -Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



[issue26512] Vocabulary: Using "integral" in library/stdtypes.html

2016-03-11 Thread Martin Panter

Martin Panter added the comment:

I have looked at PEP 3141, the history of the documentation in question, and 
the documentation of the functions in the “math” module. It seems that trunc(), 
floor() and ceil() were all intended to return a numbers.Integral type, but 
then PEP 3141’s floor() and ceil() were reverted from Python 2 due to 
compatibility concerns, where they only accept and return float objects. So it 
would be correct to clarify that Integral means numbers.Integral.

The term “integral float” was added by revision 94eeaeeb3ce9, to mean a Python 
float() object that represents an integer. This is correct (but hard to 
understand) for Python 2, but the change is not appropriate for Python 3, where 
floor() and ceil() follow PEP 3141 instead and do return integers 
(numbers.Integral).

I propose to just point to the proper math.trunc(), round() etc documentation 
and remove the table (originally added in revision 4f9723d9ca32). Julien: do 
you think the definitions in 

 are understandable?

Also I noticed Python 3’s floor() and ceil() doc strings say int not 
numbers.Integral. That should probably also be fixed.

Julien, if you agree with my suggestion, do you still want to do a patch for 
this? Otherwise, I could have a go when I get a chance.

--
stage:  -> needs patch
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



[issue24136] document PEP 448: unpacking generalization

2016-03-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

It is now 10 months and 2 releases since the rather large code patch.  
Documenting the extensive changes does not seem easy to me ;-).  Certainly, a 
beginner needs feedback.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue2292] Missing *-unpacking generalizations

2016-03-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

> the docs don't need to be committed in time for beta 1.

10 months and 2 releases after the code patch, the doc patches in #24136 are 
incomplete (I believe), uncommitted, untouched since July, and forgotten about. 
 The issue needs more help.

--

___
Python tracker 

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



[issue26543] imaplib noop Debug

2016-03-11 Thread Stephen Evans

New submission from Stephen Evans:

With the imaplib.Debug=3 (or greater) imaplib.noop() will crash if there are 
any untagged responses present.

The _dump_ur() function has not been converted to expect bytes in the lambda 
variable x[1]. An abbreviate example of the 'dict' parameter would be:

{'READ-WRITE': [b''], 'FETCH': [b'1 (FLAGS (\\Recent NonJunk))']}

This _dump_ur() function needs converting to Python 3.x, say, change the 
map/lambda line to:
  l = map(lambda x:'%s: %r' % (x[0], x[1]), l)


A sample crash inducing session produced by the attached file (using another 
email client to produce untagged responses for NOOP):

  20:01.23 imaplib version 2.58
  20:01.23 new IMAP4 connection, tag=b'LMHB'
  20:01.48 CAPABILITIES: ('IMAP4REV1', 'LITERAL+', 'SASL-IR', 
'LOGIN-REFERRALS', 'ID', 'ENABLE', 'IDLE', 'NAMESPACE', 'AUTH=PLAIN', 
'AUTH=LOGIN')
Traceback (most recent call last):
  File "E:/temp/imap-idle/imaplib-noop.py", line 18, in 
connection.noop()  # Crashes here.
  File "C:\Python35\lib\imaplib.py", line 656, in noop
self._dump_ur(self.untagged_responses)
  File "C:\Python35\lib\imaplib.py", line 1210, in _dump_ur
self._mesg('untagged responses dump:%s%s' % (t, t.join(l)))
  File "C:\Python35\lib\imaplib.py", line 1209, in 
l = map(lambda x:'%s: "%s"' % (x[0], x[1][0] and '" "'.join(x[1]) or ''), l)
TypeError: sequence item 0: expected str instance, bytes found

--
components: email
files: imaplib-noop.py
messages: 261615
nosy: Stephen.Evans, barry, r.david.murray
priority: normal
severity: normal
status: open
title: imaplib noop Debug
type: crash
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42140/imaplib-noop.py

___
Python tracker 

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



[issue26314] interned strings are stored in a dict, a set would use less memory

2016-03-11 Thread Gregory P. Smith

Gregory P. Smith added the comment:

updated patch:

Don't Py_CLEAR the dummy sentinel value in PySet_Fini. The interned set uses 
it.  Otherwise it causes problems when re-initializing after a Fini as happens 
in processes the setup and tear down an embedded interpreter multiple times.

--
Added file: http://bugs.python.org/file42139/interned_set_27-gps02.diff

___
Python tracker 

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



[issue26509] spurious ConnectionAbortedError logged on Windows

2016-03-11 Thread STINNER Victor

STINNER Victor added the comment:

> Your patch seems to miss the ``_fatal_error`` method in 
> ``proactor_events.py`` (which is actually where the bug happens in my 
> application - it's using ``ProactorEventLoop``).

Oops :-) What a shame. It's now fixed.

Note: _UnixReadPipeTransport._fatal_error() uses the check:

isinstance(exc, OSError and exc.errno == errno.EIO

It doesn't use _FATAL_ERROR_IGNORE.

--
Added file: http://bugs.python.org/file42138/fatal_error_ignore-2.patch

___
Python tracker 

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



[issue20589] pathlib.owner() and pathlib.group() raise ImportError on Windows

2016-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 64d45f3d0978 by Victor Stinner in branch '3.5':
Issue #20589: Fix test_pathlib
https://hg.python.org/cpython/rev/64d45f3d0978

--

___
Python tracker 

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



[issue26488] hashlib command line interface

2016-03-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This strikes me as a sensible addition.  While I did not review the patch in 
detail, it seems cleanly written and is complete in having a new main() for the 
code, a new doc section, and a new unittest Test class.

--
nosy: +terry.reedy
stage:  -> patch review

___
Python tracker 

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



[issue20589] pathlib.owner() and pathlib.group() raise ImportError on Windows

2016-03-11 Thread STINNER Victor

STINNER Victor added the comment:

Tests fail...
http://buildbot.python.org/all/builders/x86-64 Ubuntu 15.10 Skylake CPU 
3.5/builds/276/

==
ERROR: test_group (test.test_pathlib.PureWindowsPathTest)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/test/test_pathlib.py",
 line 1167, in test_group
P('c:/').group()
AttributeError: 'PureWindowsPath' object has no attribute 'group'

==
ERROR: test_owner (test.test_pathlib.PureWindowsPathTest)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/test/test_pathlib.py",
 line 1162, in test_owner
P('c:/').owner()
AttributeError: 'PureWindowsPath' object has no attribute 'owner'

--
nosy: +haypo
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread STINNER Victor

STINNER Victor added the comment:

acucci's patch doc.patch suggests to use format "%4Y". Problem: I tried it on 
Linux, and it looks like it doesn't work.

>>> datetime.datetime.strptime("1980", "%Y")
datetime.datetime(1980, 1, 1, 0, 0)
>>> datetime.datetime.strptime("1980", "%4Y")
Traceback (most recent call last):
  ...
ValueError: '4' is a bad directive in format '%4Y'

Or maybe I misunderstood the doc change. Do you suggest to use %4Y format with 
strptime(), with strftime() or with both?

--

___
Python tracker 

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



[issue26483] docs unclear on difference between str.isdigit() and str.isdecimal()

2016-03-11 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +terry.reedy
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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 291d47954618 by Victor Stinner in branch 'default':
Always test datetime.strftime("%4Y")
https://hg.python.org/cpython/rev/291d47954618

--

___
Python tracker 

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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread STINNER Victor

STINNER Victor added the comment:

About Elena Oat's patch issue13305.diff: I'm not sure that strftime("%4Y") 
works on all platforms, so I enabled the test on strftime("%4Y"). I will check 
our buildbots.

--

___
Python tracker 

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



[issue26323] Add assert_called() and assert_called_once() methods for mock objects

2016-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bd75f8d34f97 by Victor Stinner in branch 'default':
Add Mock.assert_called()
https://hg.python.org/cpython/rev/bd75f8d34f97

--
nosy: +python-dev

___
Python tracker 

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



[issue26323] Add assert_called() and assert_called_once() methods for mock objects

2016-03-11 Thread STINNER Victor

STINNER Victor added the comment:

> Yes, this can go in.

Cool. I pushed the latest patch of Amit Saha. I just modified assert_call() doc 
to add "at least once".

Thanks Amit for your contribution!

--

___
Python tracker 

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



[issue26542] Wrongly formatted doctest block in difflib documentation

2016-03-11 Thread Berker Peksag

Berker Peksag added the comment:

Good catch, Dmitry. Thanks for the patch!

--
nosy: +berker.peksag
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



[issue26542] Wrongly formatted doctest block in difflib documentation

2016-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ffd0603f5251 by Berker Peksag in branch '3.5':
Issue #26542: Fix markup of code example in difflib documentation
https://hg.python.org/cpython/rev/ffd0603f5251

New changeset 40d92c92eb6e by Berker Peksag in branch 'default':
Issue #26542: Fix markup of code example in difflib documentation
https://hg.python.org/cpython/rev/40d92c92eb6e

--
nosy: +python-dev

___
Python tracker 

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



[issue20589] pathlib.owner() and pathlib.group() raise ImportError on Windows

2016-03-11 Thread Berker Peksag

Berker Peksag added the comment:

I've changed the exception to raise NotImplementedError. I'm not sure about 
using the ctypes solution in the stdlib. Perhaps we should wrap Windows 
GetSecurity* APIs (similar to what we did for UNIX/POSIX APIs) first then we 
can use it in pathlib.

--
nosy: +berker.peksag
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type:  -> behavior
versions: +Python 3.5, Python 3.6 -Python 3.4

___
Python tracker 

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



[issue18500] mingw: detect winsock2 and setup _socket module

2016-03-11 Thread Martin Panter

Changes by Martin Panter :


--
stage:  -> patch review
title: mingw: defect winsock2 and setup _socket module -> mingw: detect 
winsock2 and setup _socket module

___
Python tracker 

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



[issue20589] pathlib.owner() and pathlib.group() raise ImportError on Windows

2016-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8ac695499fa3 by Berker Peksag in branch '3.5':
Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise
https://hg.python.org/cpython/rev/8ac695499fa3

New changeset 1602fa504e72 by Berker Peksag in branch 'default':
Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise
https://hg.python.org/cpython/rev/1602fa504e72

--
nosy: +python-dev

___
Python tracker 

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



[issue14787] pkgutil.walk_packages returns extra modules

2016-03-11 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue17605] mingw-meta: build interpeter core

2016-03-11 Thread Martin Panter

Changes by Martin Panter :


--
dependencies: +AC_LIBOBJ replacement of fileblocks, mingw: Allow 
Objects/exceptions.c to include "errmap.h", mingw: add wincrypt.h in 
Python/random.c, mingw: configure MACHDEP and platform for build, mingw: 
default sys.path calculations for windows  platforms, mingw: defect winsock2 
and setup _socket module, mingw: determine if pwdmodule should be used, mingw: 
init system calls, mingw: translate gcc internal defines to python platform 
specific defines

___
Python tracker 

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



[issue17592] mingw: configure MACHDEP and platform for build

2016-03-11 Thread Martin Panter

Martin Panter added the comment:

There are some spelling errors in the comments. It would also be good to keep 
the indentation, quoting, layout etc similar to the surrounding code.

Regarding the comments, what is the significance of “runtime platform” vs 
MACHDEP? Also, what is the significance of sys.platform() when setting 
_PYTHON_HOST_PLATFORM?

Why did you use different types of comments? (# vs dnl)

I do not understand the comment “build must not depend from posix-compatible 
environment”. Is this just explaining that we are setting ac_sys_system (uname 
-s) to a dummy generic value that will not trigger any special cases. Should we 
also set ac_sys_release to an empty string, like the cross-compiling case later 
on?

What’s the go with the two competing “mingw*)” cases when determining 
_PYTHON_HOST_PLATFORM? What is the situation where $host matches *-*-mingw*, 
but $host_os does not match mingw*?

--
nosy: +martin.panter
stage:  -> patch review

___
Python tracker 

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



[issue26394] Have argparse provide ability to require a fallback value be present

2016-03-11 Thread Michael Herold

Michael Herold added the comment:

Yes, a fallback hook at the end of parsing would have to be placed >
before the 'required' testing, not after as in my 'group' testing.

Just to clarify: Would you suggest that a fallback call returns the
parsed value (i.e. the fallback calls the action or alike) or
`take_action` is called on fallback values after all the other calls are
done?

I will try to look into your hook system in detail. Maybe you are right
and the ideas can be combined nicely.

> I still haven't absorbed why this patch is superior to the
> ConfigArgParse approach, or chaining dictionary values after parsing.

Problems with ConfigArgParse I found: It ignores config and env vars
completely if "--" is used on the command line. Implementing positional
arguments supplied via config or env var is impossible.

Chaining dictionary would require that all arguments are optional. I
think that the "make everything optional" approach bypasses to many
features of argparse.

> I'd also suggest following its example in published this enhancement
> in your own repository and pypi.

Thanks for the suggestion. I will surely consider this.

--

___
Python tracker 

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



[issue25959] tkinter - PhotoImage.zoom() causes segfault

2016-03-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Terry.

--

___
Python tracker 

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



[issue25959] tkinter - PhotoImage.zoom() causes segfault

2016-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1e7c388dc3c5 by Terry Jan Reedy in branch '2.7':
Issue 25959: Explain in docstring that PhotoImage.zoom arguments are
https://hg.python.org/cpython/rev/1e7c388dc3c5

New changeset 7474695874d9 by Terry Jan Reedy in branch '3.5':
Issue 25959: Explain in docstring that PhotoImage.zoom arguments are
https://hg.python.org/cpython/rev/7474695874d9

--
nosy: +python-dev

___
Python tracker 

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



[issue25959] tkinter - PhotoImage.zoom() causes segfault

2016-03-11 Thread Terry J. Reedy

Changes by Terry J. Reedy :


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



[issue25959] tkinter - PhotoImage.zoom() causes segfault

2016-03-11 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
assignee: docs@python -> terry.reedy
stage: needs patch -> commit review

___
Python tracker 

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



[issue26540] Python Macros

2016-03-11 Thread Ezio Melotti

Ezio Melotti added the comment:

Agreed, this is python-ideas material.  The topic also came up in the past, and 
there are already threads where this has been discussed and even existing 
projects that implements macros.

--
nosy: +ezio.melotti
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



[issue26247] Document Chrome/Chromium for python2.7

2016-03-11 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patches and reviews!

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



[issue26247] Document Chrome/Chromium for python2.7

2016-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8ef74c7f3fdc by Ezio Melotti in branch '2.7':
#26247: document Chrome/Chromium addition to webbrowser.  Patch by Manvi B.
https://hg.python.org/cpython/rev/8ef74c7f3fdc

--
nosy: +python-dev

___
Python tracker 

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



[issue26540] Python Macros

2016-03-11 Thread Mark Dickinson

Mark Dickinson added the comment:

This is really python-ideas material: you'd need to give a *lot* more details 
about exactly what you mean by "macros".

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue26538] regrtest: setup_tests() must not replace module.__path__ (_NamespacePath) with a simple list // importlib & abspath

2016-03-11 Thread Brett Cannon

Brett Cannon added the comment:

Figures. If you do decide to centralize the code then put it in importlib.util 
and please don't make it public. It's something that should only be done once 
and not something most people should have to worry about.

--

___
Python tracker 

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



[issue26542] Wrongly formatted doctest block in difflib documentation

2016-03-11 Thread Dmitry Shachnev

New submission from Dmitry Shachnev:

Look at the documentation of difflib.SequenceMatcher.get_opcodes:
https://docs.python.org/dev/library/difflib.html#difflib.SequenceMatcher.get_opcodes

There, the result part of the example is rendered as plain reStructuredText, 
separately from the code block itself.
The attached patch fixes it.

--
assignee: docs@python
components: Documentation
files: doctest.diff
keywords: patch
messages: 261591
nosy: docs@python, mitya57
priority: normal
severity: normal
status: open
title: Wrongly formatted doctest block in difflib documentation
type: enhancement
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42137/doctest.diff

___
Python tracker 

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



[issue26448] dis.findlabels ignores EXTENDED_ARG

2016-03-11 Thread Barun Parruck

Barun Parruck added the comment:

Hi!

Okay, sorry for disappearing like that(this is becoming rather a habit isn't 
it!), but with Gsoc applications, I've been insanely busy trying to get patches 
and bugs accepted for my first Gsoc ever. I do apologize for leaving you 
hanging, it was not my intention!

I'll try my best to give you an update by the end of this week and hopefully be 
able to keep working on this!

--

___
Python tracker 

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



[issue14787] pkgutil.walk_packages returns extra modules

2016-03-11 Thread Андрей Няхайчык

Андрей Няхайчык added the comment:

Any hope to add the warning in pkgutil docs about this problem? 

For example:
Warning!!! The walk_packages function uses sys.path to import nested packages 
for provided paths. It means it walks deeply by relative import for 
subpackages. If you provide path that is not in sys.path as an argument the 
result won't be correct.

--
nosy: +Андрей Няхайчык

___
Python tracker 

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



[issue26541] Add stop_after parameter to setup()

2016-03-11 Thread Memeplex

New submission from Memeplex:

The current implementation offers a stop_after parameter for run_setup() but 
not for setup(). This design has some shortcomings:

1. It couples the possibility to stop setup after some phase to the fact that 
the setup function resides in another file. But the feature is also useful when 
directly invoking setup (for example, if you want to tweak the dist before 
running it).

2. The other parameters to run_setup are already parameters to setup. It would 
be more consistent to make all three parameters common to both methods.

3. Arguably messy global variable manipulation to communicate run_setup and 
setup.

--
components: Distutils
messages: 261588
nosy: dstufft, eric.araujo, memeplex
priority: normal
severity: normal
status: open
title: Add stop_after parameter to setup()
type: enhancement
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



[issue26538] regrtest: setup_tests() must not replace module.__path__ (_NamespacePath) with a simple list // importlib & abspath

2016-03-11 Thread STINNER Victor

STINNER Victor added the comment:

Longer extract of setup_tests(), with the long comment:

# Some times __path__ and __file__ are not absolute (e.g. while running from
# Lib/) and, if we change the CWD to run the tests in a temporary dir, some
# imports might fail.  This affects only the modules imported before 
os.chdir().
# These modules are searched first in sys.path[0] (so '' -- the CWD) and if
# they are found in the CWD their __file__ and __path__ will be relative 
(this
# happens before the chdir).  All the modules imported after the chdir, are
# not found in the CWD, and since the other paths in sys.path[1:] are 
absolute
# (site.py absolutize them), the __file__ and __path__ will be absolute too.
# Therefore it is necessary to absolutize manually the __file__ and 
__path__ of
# the packages to prevent later imports to fail when the CWD is different.
for module in sys.modules.values():
if hasattr(module, '__path__'):
module.__path__ = [os.path.abspath(path)
   for path in module.__path__]
if hasattr(module, '__file__'):
module.__file__ = os.path.abspath(module.__file__)

--

___
Python tracker 

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



[issue26394] Have argparse provide ability to require a fallback value be present

2016-03-11 Thread paul j3

paul j3 added the comment:

Yes, the use of ordered dictionary would be right.  Your code would still 
reorder actions that have fallback values, but that wouldn't affect others.

Yes, a fallback hook at the end of parsing would have to be placed before the 
'required' testing, not after as in my 'group' testing.

I still haven't absorbed why this patch is superior to the ConfigArgParse 
approach, or chaining dictionary values after parsing.

By the way I like how ConfigArgParse claims to automatically test itself 
against 'test_argparse.py'.  I'd also suggest following its example in 
published this enhancement in your own repository and pypi.  The process of 
adding features to the main Python distribution is very slow.

--

___
Python tracker 

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



[issue26323] Add assert_called() and assert_called_once() methods for mock objects

2016-03-11 Thread Michael Foord

Michael Foord added the comment:

Yes, this can go in.

--

___
Python tracker 

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



[issue26540] Python Macros

2016-03-11 Thread Ethan Furman

Ethan Furman added the comment:

That particular use-case is easily handled by simply creating the correct 
function/method based on the criterion:

if py_ver < 3.6:
   def fribbletz():
  # do something in a 3.0-3.5 compatible way
else:
   def fribbletz():
  # otherwise use 3.6 methods

One possible up-side would by if macros were able to allow not erroring out 
when new syntax was used in the False branch; but really, we add new syntax so 
rarely even that is probably not worth it.

--
nosy: +ethan.furman

___
Python tracker 

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



[issue26540] Python Macros

2016-03-11 Thread Devyn Johnson

New submission from Devyn Johnson:

Would it be a good idea to add macros to Python? This would allow developers to 
test a condition (such as, "is this code running on Linux?" or "is this Python 
version 3.6?"). Then, the compiled bytecode will already contain the needed 
code, as opposed to testing the conditions during each execution.

--
components: Interpreter Core
messages: 261582
nosy: Devyn Johnson
priority: normal
severity: normal
status: open
title: Python Macros
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



[issue26538] regrtest: setup_tests() must not replace module.__path__ (_NamespacePath) with a simple list // importlib & abspath

2016-03-11 Thread Brett Cannon

Brett Cannon added the comment:

I think a more important question is why is test.libregrtest doing what it's 
doing? Is it simply to guarantee that the `site` code is run? If so it should 
just import `site`.

As for adding the __setitem__() method, I'm fine with it but maybe Eric has an 
opinion?

--
nosy: +eric.smith

___
Python tracker 

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



[issue26536] Add the SIO_LOOPBACK_FAST_PATH option to socket.ioctl

2016-03-11 Thread SilentGhost

Changes by SilentGhost :


--
components: +Windows
nosy: +paul.moore, pitrou, steve.dower, tim.golden, zach.ware
stage:  -> patch review

___
Python tracker 

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



[issue26532] build fails with address sanitizer

2016-03-11 Thread Brett Cannon

Changes by Brett Cannon :


--
resolution:  -> third party
status: open -> closed

___
Python tracker 

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



[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-03-11 Thread Nathaniel Smith

Nathaniel Smith added the comment:

Hi Victor,

This is really great, thanks for working on it!

What do you think about the richer api I proposed here?
http://bugs.python.org/issue18835#msg232221

--

___
Python tracker 

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



[issue26247] Document Chrome/Chromium for python2.7

2016-03-11 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr. added the comment:

LGTM

Thanks for getting this documented!

--

___
Python tracker 

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



[issue26531] KeyboardInterrupt while in input() not catchable on Windows 10

2016-03-11 Thread Joshua Cannell

Joshua Cannell added the comment:

Yeah, so this looks like a behavior in Windows in which an EOFError is raised 
when a Ctrl + C is pressed, followed by a KeyboardInterrupt.

This post basically explains how to overcome it: 
http://stackoverflow.com/questions/31127652/cannot-catch-keyboardinterrupt-in-command-prompt-twice

def bing():
try:
input()
except EOFError:
print("Caught an EOFError")

try:
bing()
print("After bing")
except KeyboardInterrupt:
print("Final KeyboardInterrupt")

Sorry for necro-ing an old issue.

--

___
Python tracker 

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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread Elena Oat

Elena Oat added the comment:

I submitted a patch for documentation changes related to strftime "%Y" 
directive inconsistencies. I am not sure that specifying the OS is correct, 
because I haven't tested the inconsistencies on all Linux PCs, Windows versions 
or OS X. I still left them there though, so let me know what's your opinion on 
it.

--
nosy: +Elena.Oat
Added file: http://bugs.python.org/file42136/issue13305.diff

___
Python tracker 

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



[issue16465] dict creation performance regression

2016-03-11 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka:
> Closed in the favor of issue23601.

Cool!

--

___
Python tracker 

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



[issue26247] Document Chrome/Chromium for python2.7

2016-03-11 Thread Manvi B

Manvi B added the comment:

Submitted the patch with the text noting below the table.

--
Added file: http://bugs.python.org/file42135/issue26247.diff

___
Python tracker 

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



[issue26247] Document Chrome/Chromium for python2.7

2016-03-11 Thread Manvi B

Manvi B added the comment:

@Fred L. Drake, Jr. (fdrake)
Is it okay if I can remove ``versionchanged::``. And simply say that,
Support for Chrome/Chromium has been added from 2.7.5 version or later.

--

___
Python tracker 

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



[issue26247] Document Chrome/Chromium for python2.7

2016-03-11 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr. added the comment:

Sorry; I guess I wasn't clear.

``versionadded::`` and ``versionchanged::`` are applied to specific API points 
(modules, classes, methods, attributes) that are identified structurally in the 
documentation.  That isn't the case for this.

While a bit of text noting the addition is less discoverable for documentation 
processors, I believe it to be sufficient.

--

___
Python tracker 

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



[issue26247] Document Chrome/Chromium for python2.7

2016-03-11 Thread Manvi B

Manvi B added the comment:

Modified the patch with this directive instead   ``versionchanged::``.

--
Added file: http://bugs.python.org/file42134/issue26247.diff

___
Python tracker 

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



[issue26156] Bad name into power operator syntax

2016-03-11 Thread Guido Treutwein

Guido Treutwein added the comment:

Yurys answer and resolution misses the point. Nobody complained about the await 
operator. Fact is, that in the _power_ operator (chapter 6.5) as base 
specification now "await" is given. This is likely to be an inadvertent copy of 
the previous chapter, makes no sense here and should probably be replaced by 
"u_expr" or similar.

--
nosy: +Guido Treutwein

___
Python tracker 

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



[issue25959] tkinter - PhotoImage.zoom() causes segfault

2016-03-11 Thread Varpu Rantala

Varpu Rantala added the comment:

crashes also with Python 3.5.0 (Mac OS X 10.11.3) when x and y are the 
following or bigger, but works when they are smaller. Tried it with the 
mapbe.gif image (size 1000 x 681). 

30, 27 
31, 26 
32, 25 
33, 24 
34, 24 
35, 23 
36, 22 
37, 22 
38, 22 
39, 21 
40, 20

--
nosy: +Varpu Rantala

___
Python tracker 

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



[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2016-03-11 Thread Eryk Sun

Eryk Sun added the comment:

Background Discussion

The Windows 10 console uses the condrv.sys device driver, which is set up as 
follows in the NT namespace:

C:\>odir \ -r -n con;con*$;cond*
Directory of \

Device
ConDrv 
Driver
condrv 
GLOBAL??
CON -> \Device\ConDrv\Console
CONIN$ -> \Device\ConDrv\CurrentIn
CONOUT$ -> \Device\ConDrv\CurrentOut

Previously the base console API used an NT LPC port to communicate with the 
attached console process (i.e. an instance of conhost.exe). There wasn't a real 
console device. Instead, opening "CON", "CONIN$", or "CONOUT$" was special 
cased to call OpenConsoleW (undocumented). 

With the new console device driver, opening the DOS "CON" device gets 
translated to the NT path "\Device\ConDrv\Console", i.e. it opens the file 
named "Console" on the ConDrv device. 

Opening the Console file returns a handle for a regular kernel File object. To 
that end, you may have noticed that console handles in Windows 10 are no longer 
tagged for routing by setting the lower two bits (e.g. 3, 7, 11, etc). For 
example:

>>> kernel32.GetStdHandle(STD_INPUT_HANDLE)
32
>>> kernel32.DebugBreak()
(e1c.e20): Break instruction exception - code 8003 (first chance)
KERNELBASE!DebugBreak+0x2:
7ffa`60280262 cc  int 3

0:000> !handle 32
Handle 32
  Type  File

Previously, all operations on console handles were internally routed to special 
console functions, such as ReadFile => ReadConsoleA. Thus with the old 
LPC-based console, a ReadFile basically has the behavior of ReadConsoleA (with 
the addition of special casing input lines that start with Ctrl+Z). 

The new design scraps a lot of the special-cased code. For example, reading 
from a console handle in Windows 10 uses a regular NtReadFile system call. So 
the error it sets, if any at all, depends on translating the NTSTATUS code 
that's returned by NtReadFile. Let's see what status the console sets here:

C:\Temp>cdb -xi ld python ccbug.py

[...]

ntdll!LdrpDoDebuggerBreak+0x30:
7ffb`170de260 cc  int 3
0:000> g
3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25)
[MSC v.1900 64 bit (AMD64)]

calling DebugBreak...
(8d0.62c): Break instruction exception - code 8003 (first chance)
KERNELBASE!DebugBreak+0x2:
7ffb`13f40262 cc  int 3
0:000> bp ntdll!NtReadFile
0:000> g
Breakpoint 0 hit
ntdll!NtReadFile:
7ffb`170b35d0 4c8bd1  mov r10,rcx
0:000> pt
ntdll!NtReadFile+0xa:
7ffb`170b35da c3  ret
0:000> r rax
rax=0101

The console weirdly returns a success code, STATUS_ALERTED (0x101, "the delay 
completed because the thread was alerted"), which is why ReadFile doesn't set 
an error. STATUS_ALERTED is normally returned when an NT wait function gets 
alerted by NtAlertThread (note that this is not the same as getting alerted by 
an asynchronous procedure call). For example:

tid = threading.get_ident()
h = kernel32.OpenThread(MAXIMUM_ALLOWED, 0, tid)
t = threading.Timer(5, ntdll.NtAlertThread, (h,))
delay = LARGE_INTEGER(10 * -10**7) # 10 seconds
t.start()
r = ntdll.NtDelayExecution(True, byref(delay))

>>> hex(r)
'0x101'

NtAlertThread is rarely used because WinAPI wait functions (e.g. SleepEx) 
automatically restart a wait when the underlying NT wait returns 
STATUS_ALERTED. 

The ReadConsole implementation has always translated STATUS_ALERTED to 
ERROR_OPERATION_ABORTED. This still exists in the Windows 10 implementation of 
ReadConsole. However, the correct error status for this case is 
STATUS_CANCELLED (0xC120, "the I/O request was cancelled"): 

>>> ntdll.RtlNtStatusToDosError(0xC120)
995

Whoever reimplemented the console IPC using a device driver should have updated 
the console to return STATUS_CANCELLED when an I/O operation is interrupted by 
Ctrl+C or Ctrl+Break. Then nothing would need to be special cased.

--

___
Python tracker 

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



[issue26394] Have argparse provide ability to require a fallback value be present

2016-03-11 Thread Michael Herold

Michael Herold added the comment:

Thanks so much for looking into my patch!

Let me start by outlining that I don't understand how your alternate
solutions are coping with the key problem. You are assuming that you get
a populated Namespace object. However, `_parse_known_args` is exiting if
required arguments are missing. Hence, late hooks or working with
Namespaces is just too late. I was thinking about adding an option that
suppresses required argument errors, but this again implies that parts
of the logic have to be reimplemented outside of argparse.

Let me remind you of ConfigArgParse again. It constructs an argument
string from configs etc. and appends it to sys.argv before calling
argparse. Surprise: This is not rock solid and limits the capabilities.
There is almost no other way to attach these functionalities to
argparse.



The `actions_with_values` dict should actually be ordered. My bad. With
an ordered dict, the order can only be changed if a fallback is present.
The desired behaviour has to be defined in this context. However,
without fallbacks the order is identical with an ordered dict. I totally
get that backward compatibility is a delicate thing in this context.

Unit tests: All passing, up to action='append'. This is related to a
design decision to be made for fallbacks in case of multiply supplied
arguments.

Number of arguments for fallbacks: This part was blind guessing and it
worked for my simple test cases. I really didn't dive into this regex
part in detail. At least extensive unit tests for fallbacks are required
anyways.

Values and objects instead of strings: Think there are two aspects.

1.  That example.py had to handle bools explicitly is a design decision.
How bools can be supplied in configs or env vars should not be hard
coded in argparse. This also applies for my [x,y] list syntax etc.

2.  Supplying actual objects/values as fallback makes sense. The
current implementation (with my example) is such, that you can
supply the arguments in the same form as on the command line. If you
have interpreted this information already (say, fallback returns
`true` instead of `[]`), you don't want the returned fallback to be
handled in the usual way [number of arguments differs (it's not even
a list), action gets unexpected input]. Maybe the fallback can
indicate that by returning an argparse.FinalValue() object or
what ever.

Subparsers: Yeah, big unknown. But my intuition is, that this can be
solved nicely.

--

___
Python tracker 

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



[issue26247] Document Chrome/Chromium for python2.7

2016-03-11 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr. added the comment:

The ``versionadded::`` directive should only be used to annotate descriptions 
of new API entries.  While it would be correctly applied to the ``Chrome`` and 
``Chromium`` classes, those are not separately documented here, but are only 
listed in the table.

See http://bugs.python.org/issue26366 for further discussion on the use of 
``versionadded::``.

--
nosy: +fdrake

___
Python tracker 

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



[issue26539] frozen executables should have an empty path

2016-03-11 Thread Daniel Shaulov

New submission from Daniel Shaulov:

A frozen python executable should have an empty path, so it doesn't 
accidentally run something it was not supposed to.

The attached file achieves that by setting Py_NoSiteFlag and Py_IsolatedFlag in 
Python/frozenmain.c

It also checks for Py_FrozenFlag in Python/sysmodule.c in makepathobject and 
just returns an empty list if it is set.

I originally tried doing it without changing sysmodule, by calling Py_SetPath 
as suggested in the comment in getpath.c, but calling Py_SetPath(L"") will 
leave me with a path that cointains a single empty string. There is no way to 
set an empty path with Py_SetPath.

Other options include allowing Py_SetPath to accept NULL and making sure that 
NULL results in an empty list, or changing the behavior of makepathobject so an 
empty string will result in an empty list instead of a list with an empty 
string.

--
components: Demos and Tools
files: freeze_path.patch
keywords: patch
messages: 261566
nosy: Daniel Shaulov, twouters
priority: normal
severity: normal
status: open
title: frozen executables should have an empty path
type: enhancement
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42133/freeze_path.patch

___
Python tracker 

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



[issue16465] dict creation performance regression

2016-03-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Closed in the favor of issue23601.

--
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed
superseder:  -> use small object allocator for dict key storage

___
Python tracker 

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



[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2016-03-11 Thread Eryk Sun

Eryk Sun added the comment:

This problem has come up in several issues now (see issue 25376 and issue 
26531). I'm adding a patch for Python 3.6 to call ReadConsoleA instead of fgets 
in PyOS_Readline. This fixes Ctrl+C and EOF handling in Windows 10 for both the 
interactive shell and the built-in input() function. 

As noted previously, changes to the console in Windows 8 and 10 introduced a 
bug in ReadFile. It no longer sets the last error to ERROR_OPERATION_ABORTED 
(995) when a console read is interrupted by Ctrl+C or Ctrl+Break. This is a 
problem for the current implementation of PyOS_Readline, which calls ReadFile 
indirectly via C fgets. 

This bug can be avoided by calling ReadConsoleA instead of fgets when stdin is 
a console. Note that isatty() is insufficient to detect the console, since it's 
true for all character devices, such as NUL. I instead call GetConsoleMode to 
check for a console handle.

I'm also looking into modifying Modules/signalmodule.c to set 
_PyOS_SigintEvent() when SIGBREAK is tripped, which matters when there's a 
non-default SIGBREAK handler. Also, PyErr_CheckSignals is a logical place to 
reset the event. Actually, it seems to me that everywhere in signalmodule.c 
where the signal flag is untripped should reset the event, in which case there 
should be an untrip_signal() to match trip_signal().

--
keywords: +patch
Added file: http://bugs.python.org/file42132/issue18597_3_6_0.patch

___
Python tracker 

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



[issue26295] Random failures when running test suite in parallel (-m test -j0) caused by test_regrtest

2016-03-11 Thread STINNER Victor

STINNER Victor added the comment:

Oh ok, I found a bug in the setup_tests() function of libregrtest: issue #26538.

Attached patch fixes this issue, it requires the patch of the issue issue 
#26538.

--
keywords: +patch
Added file: http://bugs.python.org/file42131/test_regrtest_tmpdir.patch

___
Python tracker 

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



[issue26538] regrtest: setup_tests() must not replace module.__path__ (_NamespacePath) with a simple list // importlib & abspath

2016-03-11 Thread STINNER Victor

New submission from STINNER Victor:

Extract of test.libregrtest.setup_tests():

for module in sys.modules.values():
if hasattr(module, '__path__'):
module.__path__ = [os.path.abspath(path)
   for path in module.__path__]
if hasattr(module, '__file__'):
module.__file__ = os.path.abspath(module.__file__)

Because of this code, it's not possible to store test files outside Lib/test/. 
For the issue #26295 (test_regrtest), I would like to create a temporary 
directory and then a subdirectory test/ to create temporary test files.

Attached patch adds _NamespacePath.__setitem__() method and modify 
setup_tests() to keep the _NamespacePath type of module.__path__.

Maybe we should move this abspath() code somewhere in importlib. The site 
module already contains similar code, abs_paths() function:

for m in set(sys.modules.values()):
if (getattr(getattr(m, '__loader__', None), '__module__', None) not in
('_frozen_importlib', '_frozen_importlib_external')):
continue   # don't mess with a PEP 302-supplied __file__
try:
m.__file__ = os.path.abspath(m.__file__)
except (AttributeError, OSError):
pass
try:
m.__cached__ = os.path.abspath(m.__cached__)
except (AttributeError, OSError):
pass

Since this code looks to depend on the implementation of importlib (the 
__loader__ test), IMHO it makes sense to move the code directly somewhere in 
importlib.

--
files: libregrtest_module_path.patch
keywords: patch
messages: 261562
nosy: brett.cannon, haypo
priority: normal
severity: normal
status: open
title: regrtest: setup_tests() must not replace module.__path__ 
(_NamespacePath) with a simple list // importlib & abspath
versions: Python 3.6
Added file: http://bugs.python.org/file42130/libregrtest_module_path.patch

___
Python tracker 

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



[issue26525] Documentation of ord(c) easy to misread

2016-03-11 Thread Susan Sun

Susan Sun added the comment:

This was changed in the following commit.

changeset:   95165:f6c6304c8193
user:Benjamin Peterson 
date:Tue Mar 24 12:12:44 2015 -0400
summary:
  change Σ to ν for obscure joke reasons

https://twitter.com/ncoghlan_dev/status/579173053793353728

--
nosy: +Susan Sun, benjamin.peterson, ncoghlan

___
Python tracker 

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



[issue16851] Hint about correct ismethod and isfunction usage

2016-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a90b39aa6af4 by Victor Stinner in branch '2.7':
Issue #16851: Add Anna Koroliuk to Misc/ACKS
https://hg.python.org/cpython/rev/a90b39aa6af4

--

___
Python tracker 

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



[issue16851] Hint about correct ismethod and isfunction usage

2016-03-11 Thread STINNER Victor

STINNER Victor added the comment:

Thanks Anna, I pushed your doc fix.

Can you please sign the Python Contributor Agreement?
https://www.python.org/psf/contrib/

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

___
Python tracker 

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



  1   2   >