[issue32242] loop in loop with with 'zip'ped object misbehaves in py3.6

2017-12-07 Thread Vishu Viswanathan

Vishu Viswanathan  added the comment:

Thanks for the fast response and clarification. Now I can run my code made
for  py2.7  also run in py3.6
I should search and read documentation before reporting.

Thanks

On Thu, Dec 7, 2017 at 8:03 PM, Steven D'Aprano 
wrote:

>
> Steven D'Aprano  added the comment:
>
> I decided to run the code in 3.5 and 2.7, and now that I know what I'm
> looking for, I can see the results buried in the Anaconda notebook.
>
> This is not a bug, zip has been changed in Python 3 to return an iterator
> instead of a list. To get the same results as Python 2.7, change the line:
>
> z = zip(j, k)
>
> to:
>
> z = list(zip(j, k))
>
> To get the same results in 2.7 as in 3, change it to:
>
> z = iter(zip(j, k))
>
> This is documented and is not a bug.
>
> https://docs.python.org/3.0/whatsnew/3.0.html#views-and-
> iterators-instead-of-lists
>
> https://docs.python.org/3/library/functions.html#zip
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue30904] Python 3 logging HTTPHandler sends duplicate Host header

2017-12-07 Thread iMath

iMath  added the comment:

Yes, I met with the same bug, see the post for description and bug 
investigation 
https://stackoverflow.com/questions/43185804/using-httphandler-cause-django-server-side-shows-http-400-and-invalid-http-host/47434323#47434323

--
nosy: +redstone-cold

___
Python tracker 

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



[issue31942] Document that support of start and stop parameters in the Sequence's index() is optional

2017-12-07 Thread Nitish

Nitish  added the comment:

Any comments on the PR?

--

___
Python tracker 

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



[issue28197] Add start and stop parameters to the range.index() ABC method

2017-12-07 Thread Nitish

Nitish  added the comment:

Any comments on the PR?

--
nosy: +nitishch

___
Python tracker 

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



[issue32251] Add asyncio.BufferedProtocol

2017-12-07 Thread Yury Selivanov

Yury Selivanov  added the comment:

I've made a PR that implements the change for selector_events.py.

With the change:

vanilla asyncio:120-135 Mb/s
vanilla asyncio/get_buffer: 220-230 Mb/s
uvloop: 320-330 Mb/s
uvloop/get_buffer:  600-650 Mb/s

If we decide to go forward with the proposed design, I'll update the PR with 
support for proactor_events

--

___
Python tracker 

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



[issue32251] Add asyncio.BufferedProtocol

2017-12-07 Thread Yury Selivanov

Change by Yury Selivanov :


--
keywords: +patch
pull_requests: +4658
stage:  -> patch review

___
Python tracker 

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



[issue8722] Documentation for __getattr__

2017-12-07 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Cheryl, thank you for reviving this, as it is still needed.  A slightly revised 
example better illustrates the claim in the doc revision about when __getattr__ 
is called.

class Foo(object):

def __init__(self):
self.foo = 1
self.data = {"bing": 4}

def __getattr__(self, name):
print(f'Getting {name}')
return self.data.get(name)

@property
def bar(self):
return 3

@property
def bing(self):
raise AttributeError("blarg")

f = Foo()
print('foo', f.foo)
print('__str__', f.__str__)
print('bar', f.bar)
print('bing', f.bing)
f.__getattribute__('bing')

# prints
foo 1
__str__ 
bar 3
Getting bing
bing 4
Traceback (most recent call last):
  File "F:\Python\a\tem2.py", line 24, in 
f.__getattribute__('bing')
  File "F:\Python\a\tem2.py", line 17, in bing
raise AttributeError("blarg")
AttributeError: blarg

--

___
Python tracker 

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



[issue32251] Add asyncio.BufferedProtocol

2017-12-07 Thread Yury Selivanov

New submission from Yury Selivanov :

A couple emails from async-sig for the context:

1. https://mail.python.org/pipermail/async-sig/2017-October/000392.html
2. https://mail.python.org/pipermail/async-sig/2017-December/000423.html

I propose to add another Protocol base class to asyncio: BufferedProtocol.  It 
will have 'get_buffer()' and 'buffer_updated(nbytes)' methods instead of 
'data_received()':

    class asyncio.BufferedProtocol:

        def get_buffer(self) -> memoryview:
            pass

        def buffer_updated(self, nbytes: int):
            pass

When the protocol's transport is ready to receive data, it will call 
`protocol.get_buffer()`.  The latter must return an object that implements the 
buffer protocol.  The transport will request a writable buffer over the 
returned object and receive data *into* that buffer.

When the `sock.recv_into(buffer)` call is done, 
`protocol.buffer_updated(nbytes)` method will be called.  The number of bytes 
received into the buffer will be passed as a first argument.

I've implemented the proposed design in uvloop (branch 'get_buffer', [1]) and 
adjusted your benchmark [2] to use it.  Here are benchmark results from my 
machine (macOS):

vanilla asyncio: 120-135 Mb/s
uvloop: 320-330 Mb/s
uvloop/get_buffer: 600-650 Mb/s.


[1] https://github.com/MagicStack/uvloop/tree/get_buffer
[2] https://gist.github.com/1st1/1c606e5b83ef0e9c41faf21564d75ad7

--

___
Python tracker 

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



[issue32251] Add asyncio.BufferedProtocol

2017-12-07 Thread Yury Selivanov

Change by Yury Selivanov :


--
assignee: yselivanov
components: asyncio
nosy: asvetlov, gvanrossum, pitrou, yselivanov
priority: normal
severity: normal
status: open
title: Add asyncio.BufferedProtocol
versions: Python 3.7

___
Python tracker 

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



[issue8722] Documentation for __getattr__

2017-12-07 Thread Cheryl Sabella

Change by Cheryl Sabella :


--
keywords: +needs review -patch
versions: +Python 3.6, Python 3.7 -Python 2.7, Python 3.1, Python 3.2, Python 
3.3

___
Python tracker 

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



[issue8722] Documentation for __getattr__

2017-12-07 Thread Cheryl Sabella

Change by Cheryl Sabella :


--
pull_requests: +4657
stage: needs patch -> patch review

___
Python tracker 

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



[issue32246] test_regrtest alters the execution environment on Android

2017-12-07 Thread STINNER Victor

STINNER Victor  added the comment:

> The fact that the TEMP directory is not clean already happens when running 
> buildbottest natively with the standard Python Makefile (no one has noticed 
> it yet I guess) and the directory contains a core file.

The root issue is likely the core file. I got a similar issue on FreeBSD when 
an unit test crashed on purpose but forgot to suppress crash report.

You should either find a way to disable the creation of core file when using 
faulthandler_suppress_crash_report() and/or SuppressCrashReport, or skip the 
test on Android.

I'm fine with skipped the test on Android, since the test currently uses 
faulthandler._sigsegv() which is already skipped on Android in 
test_faulthandler:

def skip_segfault_on_android(test):
# Issue #32138: Raising SIGSEGV on Android may not cause a crash.
return unittest.skipIf(is_android,
   'raising SIGSEGV on Android is unreliable')(test)

--

___
Python tracker 

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



[issue32246] test_regrtest alters the execution environment on Android

2017-12-07 Thread STINNER Victor

STINNER Victor  added the comment:

> The command 'adb logcat' reports a crash ("Fatal signal 11 (SIGSEGV)") during 
> the execution of the command. This sounds familiar :-)

test_crashed() does crash on SIGGEV on purpose. It tests how regrtest behaves 
when a worker does crash. The exacty signal doesn't matter.

This function uses faulthandler._sigsegv() which is supposed to "suppress crash 
report": see faulthandler_suppress_crash_report() in Modules/faulthandler.c, 
but also SuppressCrashReport in test/support/__init__.py.

Maybe we need to disable the Android crash reporter as well?

--

___
Python tracker 

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



[issue32193] Convert asyncio to async/await

2017-12-07 Thread STINNER Victor

Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue32250] Add loop.current_task() and loop.all_tasks() methods

2017-12-07 Thread Andrew Svetlov

New submission from Andrew Svetlov :

Existing `Task.current_task()` and `Task.all_tasks()` class methods are not 
overridable by custom event loop implementation.

The proposal is adding new optional loop methods and using them by existing 
task methods.

--
components: asyncio
messages: 307826
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Add loop.current_task() and loop.all_tasks() methods
versions: Python 3.7

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-07 Thread Mark Shannon

Mark Shannon  added the comment:

Thanks, that example shows the essence of the problem. I understand you 
perfectly now.

--

___
Python tracker 

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



[issue32249] Document handler.cancelled()

2017-12-07 Thread Andrew Svetlov

New submission from Andrew Svetlov :

Method was added by https://bugs.python.org/issue31943

--
components: asyncio
messages: 307825
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Document handler.cancelled()
versions: Python 3.7

___
Python tracker 

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



[issue32193] Convert asyncio to async/await

2017-12-07 Thread Andrew Svetlov

Change by Andrew Svetlov :


--
keywords: +patch
pull_requests: +4656
stage:  -> patch review

___
Python tracker 

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



[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2017-12-07 Thread Barry A. Warsaw

New submission from Barry A. Warsaw :

We intend to port importlib_resources to Python 3.7 as importlib.resources, 
with a provisional API.  There's also a ResourceReader ABC to include, along 
with documentation and tests.

Nosying Brett and assigning to myself, but if Brett *wants* to do the work, I 
won't stand in his way. :)

--
assignee: barry
components: Library (Lib)
messages: 307824
nosy: barry, brett.cannon
priority: normal
severity: normal
status: open
title: Port importlib_resources (module and ABC) to Python 3.7
versions: Python 3.7

___
Python tracker 

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



[issue32247] shutil-copytree: Create dst folder only if it doesn't exist

2017-12-07 Thread Radostin

New submission from Radostin :

shutil.copytree method always tries to create the destination directory which 
raises the error message "OSError: [Errno 17] File exists".

This issue has been discussed here:
https://stackoverflow.com/questions/1868714/how-do-i-copy-an-entire-directory-of-files-into-an-existing-directory-using-pyth

--
messages: 307823
nosy: rst0py
priority: normal
pull_requests: 4655
severity: normal
status: open
title: shutil-copytree: Create dst folder only if it doesn't exist
type: behavior

___
Python tracker 

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



[issue32186] io.FileIO hang all threads if fstat blocks on inaccessible NFS server

2017-12-07 Thread STINNER Victor

STINNER Victor  added the comment:

The bug has been fixed in Python 2.7, 3.6 and the master branch.

Thank you Nir Soffer for the bug report and the fix!

--
versions:  -Python 3.5, Python 3.8

___
Python tracker 

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



[issue32186] io.FileIO hang all threads if fstat blocks on inaccessible NFS server

2017-12-07 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 830daae1c82ed33deef0086b7b6323e5be0b0cc8 by Victor Stinner (Nir 
Soffer) in branch '2.7':
[2.7] bpo-32186: Release the GIL during fstat and lseek calls (#4651)
https://github.com/python/cpython/commit/830daae1c82ed33deef0086b7b6323e5be0b0cc8


--

___
Python tracker 

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



[issue32206] Run modules with pdb

2017-12-07 Thread Mario Corchero

Change by Mario Corchero :


--
keywords: +patch
pull_requests: +4654
stage:  -> patch review

___
Python tracker 

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



[issue32208] Improve semaphore documentation

2017-12-07 Thread Andrew Svetlov

Andrew Svetlov  added the comment:


New changeset a04ca12e12b522850e7e9244c250754d3cd36f0a by Andrew Svetlov (Miss 
Islington (bot)) in branch '3.6':
bpo-32208: update threading.Semaphore docs and add unit test (GH-4709) (#4750)
https://github.com/python/cpython/commit/a04ca12e12b522850e7e9244c250754d3cd36f0a


--

___
Python tracker 

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



[issue32208] Improve semaphore documentation

2017-12-07 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4653

___
Python tracker 

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



[issue32208] Improve semaphore documentation

2017-12-07 Thread Andrew Svetlov

Andrew Svetlov  added the comment:


New changeset a0374dd34aa25f0895195d388b5ceff43b121b00 by Andrew Svetlov 
(Garrett Berg) in branch 'master':
bpo-32208: update threading.Semaphore docs and add unit test (#4709)
https://github.com/python/cpython/commit/a0374dd34aa25f0895195d388b5ceff43b121b00


--
nosy: +asvetlov

___
Python tracker 

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



[issue32237] test_xml_etree leaked [1, 1, 1] references, sum=3

2017-12-07 Thread Neil Schemenauer

Change by Neil Schemenauer :


--
keywords: +patch
pull_requests: +4652
stage:  -> patch review

___
Python tracker 

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



[issue30862] parent logger should also check the level

2017-12-07 Thread Vinay Sajip

Vinay Sajip  added the comment:

basicConfig() provides default behaviour for simple cases. If you don't like 
the defaults it provides, you can choose your own configuration code to do 
exactly what you want.

--

___
Python tracker 

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



[issue32199] uuid.getnode() should return the MAC address on Android

2017-12-07 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

Thanks Serhiy and Barry for your comments and reviews :-)

--

___
Python tracker 

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



[issue26414] os.defpath too permissive

2017-12-07 Thread Jakub Wilk

Jakub Wilk  added the comment:

Linux man page for execvp(3)
 says:

> The default search path (used when the environment does not contain
> the variable PATH) shows some variation across systems.  It generally
> includes /bin and /usr/bin (in that order) and may also include the
> current working directory.  On some other systems, the current
> working is included after /bin and /usr/bin, as an anti-Trojan-horse
> measure.  The glibc implementation long followed the traditional
> default where the current working directory is included at the start
> of the search path.  However, some code refactoring during the
> development of glibc 2.24 caused the current working directory to be
> dropped altogether from the default search path.  This accidental
> behavior change is considered mildly beneficial, and won't be
> reverted.

So while having cwd is os.defpath has some historical justification,
now that glibc dropped it from its default PATH, it would be prudent for
Python to follow the suit.

--
nosy: +jwilk

___
Python tracker 

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



[issue32199] uuid.getnode() should return the MAC address on Android

2017-12-07 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

LGTM, and thanks!

--

___
Python tracker 

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



[issue13420] newer() function in dep_util.py discard changes in the same second

2017-12-07 Thread Jakub Wilk

Jakub Wilk  added the comment:

I don't remember why I needed it. Sorry!

--

___
Python tracker 

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



[issue32246] test_regrtest alters the execution environment on Android

2017-12-07 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

> The command 'adb logcat' reports a crash ("Fatal signal 11 (SIGSEGV)") during 
> the execution of the command. This sounds familiar :-)

See issue #32138 and #26934.

--

___
Python tracker 

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



[issue32246] test_regrtest alters the execution environment on Android

2017-12-07 Thread Xavier de Gaye

New submission from Xavier de Gaye :

Sorry, this is a bit involved :-(
BTW all the tests except this one pass (ctypes is disabled on x86_64 and arm64) 
on Android API 24 for x86, x86_64, armv7 and arm64 :-)

Description:
---
There are two different cases:
1) When buildbottest is tweaked to run only test_regrtest and is run remotely 
from the build system, the error occurs systematically and is:

  Warning -- files was modified by test_regrtest
Before: []
After:  ['test_python_2535/']

Here is the command that is run remotely (through adb), the run_tests.py file 
is Tools/scripts/run_tests.py from the src tree that has been pushed to the 
emulator by buildbottest:

python /data/local/tmp/python/bin/run_tests.py -j 1 -u all -W --slowest 
--fail-env-changed --timeout=900 -j2 test_regrtest

The command also fails when replacing '-j2' with '-j1'.

In that case:
* There is no 'test_support_*' directory left over in the TEMP directory, the 
directory is clean.
* The command 'adb logcat' reports a crash ("Fatal signal 11 (SIGSEGV)") during 
the execution of the command. This sounds familiar :-)


2) When this same command is run on the emulator (i.e. the user is remotely 
logged in with the command 'adb shell'), the environment is never altered 
(never == about 20 attempts to raise the problem).

In that case:
* A 'test_support_*' directory is left in the TEMP directory and it is empty.

The fact that the TEMP directory is not clean already happens when running 
buildbottest natively with the standard Python Makefile (no one has noticed it 
yet I guess) and the directory contains a core file. This is another bug, 
related to this one and it provided a much welcome hint to use 'adb logcat' and 
for a work-around :-)
Maybe this last bug is related to issue 26295 ?

Work-around
---
* The problem does not happen when skipping ArgsTestCase.test_crashed for 
Android in the same manner that tests that raise SIGSEGV are skipped in 
test_faulthandler. And there is no 'test_support_*' directory left over in the 
TEMP directory.

--
components: Tests
messages: 307812
nosy: vstinner, xdegaye
priority: normal
severity: normal
stage: needs patch
status: open
title: test_regrtest alters the execution environment on Android
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue6531] atexit_callfuncs() crashing within Py_Finalize() when using multiple interpreters.

2017-12-07 Thread Petr Viktorin

Change by Petr Viktorin :


--
nosy: +Dormouse759, encukou

___
Python tracker 

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



[issue32245] OSError: raw write() returned invalid length on latest Win 10 Consoles

2017-12-07 Thread Simon Depiets

New submission from Simon Depiets :

A couple of users have been having issues on console output since the Fall 2017 
Creator Update on Windows 10

An OSError is triggered randomly when rewriting data on the console (typically 
with progress bars, for instance when you install a module with pip), this only 
happens with the Microsoft Console (within Powershell or cmd.exe).

It seems the windows stdout console stream returns a length double what python 
expects. I don't have the skills to go deeper than the bufferedio.c method 
_bufferedwriter_raw_write to diagnostic the issue, so I've made a very dirty 
fix (which I do not recommend) 
https://github.com/python/cpython/compare/3.5...LlianeFR:patch-1

Different unrelated use cases where an error is triggered :

https://stackoverflow.com/questions/47356993/oserror-raw-write-returned-invalid-length-when-using-print-in-python

https://github.com/Microsoft/vscode/issues/39149

--
components: IO
messages: 307811
nosy: Simon Depiets
priority: normal
severity: normal
status: open
title: OSError: raw write() returned invalid length on latest Win 10 Consoles
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



[issue32244] Multiprocessing: multiprocessing.connection.Listener.accept() should accept a timeout

2017-12-07 Thread Tom Cook

Tom Cook  added the comment:

The same goes for `Connection.recv()`, as in the sample code another case where 
the thread will never terminate is when a `Client` is connected to the socket 
but never sends any messages; in this case, the call to `recv()` will block 
forever.  There is no way at all to interrupt this.

--

___
Python tracker 

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



[issue32244] Multiprocessing: multiprocessing.connection.Listener.accept() should accept a timeout

2017-12-07 Thread Tom Cook

New submission from Tom Cook :

If nothing connects to it, `multiprocessing.connection.Listener.accept()` will 
block forever with no good way to interrupt it.

Supposing that a thread implements a loop like this:

def run(self):
l = Listener(socket_path, 'AF_UNIX')
while self.running:
c = l.accept()
while self.running:
data = c.recv()
self.process(data)

There is no obvious way to implement a `stop` method on this thread.  Setting 
`self.running = False` may never result in the thread terminating, as it may be 
that no client connects to it.  The following is a possible way of implementing 
it:

def stop(self):
self.running = False
try:
c = Client(socket_path, 'AF_UNIX')
except:
pass

however it seems fraught with race conditions.  Letting `accept()` accept a 
timeout would be a much cleaner solution to this and many similar problems.

--
components: Library (Lib)
messages: 307809
nosy: Tom Cook
priority: normal
severity: normal
status: open
title: Multiprocessing: multiprocessing.connection.Listener.accept() should 
accept a timeout
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



[issue32243] Tests that set aggressive switch interval hang in Cygwin on a VM

2017-12-07 Thread Erik Bray

New submission from Erik Bray :

This is basically the same as #26939, but rather than Android running in an 
emulator it is affecting Cygwin running in a slow VM (in this case it's on my 
university's OpenStack infrastructure--I don't know what hypervisor they're 
using but probably KVM--either way the point is that it's a Windows VM and 
relatively slow).

With Cygwin on Windows running natively this has never been a problem.

FWIW I tried my own version of Victor's patch from #23428 (adapted to the new 
_PyTime API).  This patch would be worth applying regardless and I can attach 
my version of the patch to that ticket, but alone it did not fix it.

On top of that I also added a version of Xavier's patch from #26939 that 
adjusts the wait interval in PyCOND_TIMEDWAIT to ensure that the deadline is 
late enough to account for delays.  I'm not sure that this is completely 
fool-proof, but it solved the problem for me.  With that patch I was unable to 
make the system hang again.

For some reason in #26939 that more general fix was abandoned in favor of 
simply setting the switch interval less aggressively for those tests in the 
particular case of the android emulator.  But it seems that the more general 
fix might still be worthwhile.

--
components: Tests
messages: 307808
nosy: erik.bray
priority: normal
severity: normal
status: open
title: Tests that set aggressive switch interval hang in Cygwin on a VM

___
Python tracker 

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



[issue32242] loop in loop with with 'zip'ped object misbehaves in py3.6

2017-12-07 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

I decided to run the code in 3.5 and 2.7, and now that I know what I'm looking 
for, I can see the results buried in the Anaconda notebook.

This is not a bug, zip has been changed in Python 3 to return an iterator 
instead of a list. To get the same results as Python 2.7, change the line:

z = zip(j, k)

to:

z = list(zip(j, k))

To get the same results in 2.7 as in 3, change it to:

z = iter(zip(j, k))

This is documented and is not a bug.

https://docs.python.org/3.0/whatsnew/3.0.html#views-and-iterators-instead-of-lists

https://docs.python.org/3/library/functions.html#zip

--

___
Python tracker 

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



[issue32242] loop in loop with with 'zip'ped object misbehaves in py3.6

2017-12-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

In Python 2 zip() returns a list. In Python 3 it returns an iterator (like 
itertools.izip() in Python 2). This is an intentional change. For restoring the 
Python 2 behavior you should wrap the result of zip() into list(): z = 
list(zip(j, k)). The 2to3 command can do this for you.

--
nosy: +serhiy.storchaka
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



[issue32242] loop in loop with with 'zip'ped object misbehaves in py3.6

2017-12-07 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

If the nested loop is the issue the Python 3 version behaves as expected.

A difference between python2 and python3 is that the zip() builtin returns a 
list on python2 and an iterator on python3. This explains the difference in 
results in running the code on the two versions.

To get the same behaviour on Python 2 and Python 3 use "list(zip(j, k))".

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue32242] loop in loop with with 'zip'ped object misbehaves in py3.6

2017-12-07 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

I'm sorry, I have no idea how to read an Anaconda notebook file. In the browser 
it looks like some sort of nested dictionary. I can find the code:

j = [1, 2, 3, 4]
k = [5, 6, 7, 8]
z = zip(j, k)
for x, y in z:
for m, n in z:
print (x, y, m, n)


but I'm not sure what result you are getting or what results you expect.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue32242] loop in loop with with 'zip'ped object misbehaves in py3.6

2017-12-07 Thread Vishu Viswanathan

New submission from Vishu Viswanathan :

The file shows the results by running in Py3.6 and 2.7
In my opinion Py2.7 results matches what I expected.

In this bug or the zip function behaviour is changed with some purpose

--
files: py3.6_vs_py2.7.ipynb
messages: 307803
nosy: Vishu Viswanathan
priority: normal
severity: normal
status: open
title: loop in loop with with 'zip'ped object misbehaves in py3.6
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47328/py3.6_vs_py2.7.ipynb

___
Python tracker 

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



[issue32241] Add the const qualifier for char and wchar_t pointers to unmodifiable strings

2017-12-07 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +4651
stage:  -> patch review

___
Python tracker 

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



[issue32241] Add the const qualifier for char and wchar_t pointers to unmodifiable strings

2017-12-07 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

Py_SetProgramName() and Py_SetPythonHome() take a pointer to a string that 
shouldn't be changed for the duration of the program's execution. But the type 
of their arguments is "wchar_t *", therefore passing just a pointer to a 
constant static string will cause a compiler warning. The proposed PR changes 
the type to "const wchar_t *". This is backward compatible change.

The PR also adds the const qualifier to internal pointers that point on to 
unmodifiable strings. This could help to distinguish them from pointers on 
modifiable strings and can prevent unintentional modifications.

--
components: Interpreter Core
messages: 307802
nosy: serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Add the const qualifier for char and wchar_t pointers to unmodifiable 
strings
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue32199] uuid.getnode() should return the MAC address on Android

2017-12-07 Thread Xavier de Gaye

Change by Xavier de Gaye :


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



[issue32199] uuid.getnode() should return the MAC address on Android

2017-12-07 Thread Xavier de Gaye

Xavier de Gaye  added the comment:


New changeset 03031fbc7d44106d652756462db34eae67de9568 by xdegaye (Miss 
Islington (bot)) in branch '3.6':
bpo-32199:  The getnode() ip getter now uses 'ip link' instead of 'ip link 
list' (GH-4696) (#4747)
https://github.com/python/cpython/commit/03031fbc7d44106d652756462db34eae67de9568


--

___
Python tracker 

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



[issue32235] [2.7 regression] test_xml_etree test_xml_etree_c failures with 2.7 and 3.6 branches 20171205

2017-12-07 Thread Matthias Klose

Matthias Klose  added the comment:

ok, I can confirm that the failures go away with an updated version.  Then 
trying to find documentation about required external dependencies...  None.  
While we have pointers to optimize the build, we don't have anything about 
requirements in the toplevel README.md.

--

___
Python tracker 

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



[issue32235] test_xml_etree test_xml_etree_c failures with 2.7 and 3.6 branches 20171205

2017-12-07 Thread Matthias Klose

Change by Matthias Klose :


--
title: [2.7 regression] test_xml_etree test_xml_etree_c failures with 2.7 and 
3.6 branches 20171205 -> test_xml_etree test_xml_etree_c failures with 2.7 and 
3.6 branches 20171205

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This change is inspired by reviewing one PR in which an input array of 
PyObject* was modified inplace. Even if it was correct in that particular  
case, it looked unsafe (actually that code was wrong for other causes). Adding 
the const qualifier allows to distinguish input PyObject* array arguments from 
pointers to output PyObject* arguments.

--

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I don't like "PyConstObjectArray" or any other name. I will just obfuscate the 
C code. "PyObject * const *args" should be clear for every C programmer, but if 
I see "PyConstObjectArray" I need to search the definition of it in the header 
files. And it is easy to make a mistake by using "PyConstObjectArray *" instead 
of "PyConstObjectArray" since complex types usually are passed by pointer in C.

If you prefer, "PyObject * const *args" can be written as "PyObject * const 
args[]". This is an identical syntax, but the latter form is used more rarely.

--

___
Python tracker 

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



[issue32199] uuid.getnode() should return the MAC address on Android

2017-12-07 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4650

___
Python tracker 

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



[issue32199] uuid.getnode() should return the MAC address on Android

2017-12-07 Thread Xavier de Gaye

Xavier de Gaye  added the comment:


New changeset 961dbe0548e26394b7716d41423c61b1e2e58ef7 by xdegaye in branch 
'master':
bpo-32199:  The getnode() ip getter now uses 'ip link' instead of 'ip link 
list' (GH-4696)
https://github.com/python/cpython/commit/961dbe0548e26394b7716d41423c61b1e2e58ef7


--

___
Python tracker 

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



[issue32238] Handle "POSIX" in the legacy locale detection

2017-12-07 Thread Jakub Wilk

Change by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-07 Thread STINNER Victor

STINNER Victor  added the comment:

I hate this "obscure" C syntax "PyObject * const *args".

Technically, is it possible to define it as a type with a better name to give 
more context where the type would be defined?

For example, "PyConstObjectArray"?

--

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-07 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +4649
stage:  -> patch review

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-07 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

The proposed PR replaces argument declarations "PyObject **args" with "PyObject 
* const *args". In many cases this can be a pointer to the internal array of 
the tuple object. It is not safe to change it.

PyEval_EvalCodeEx() is the only public function affected by this change, but 
this change is backward compatible. All other affected code is a private C API.

--
messages: 307795
nosy: serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Add the const qualifier for PyObject* array arguments
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue32239] decimal module exception args incorrect for c module

2017-12-07 Thread Stefan Krah

Stefan Krah  added the comment:

This is known and was deliberate when I wrote the module. The list contains 
conditions that trigger the exception.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> decimal C module's exceptions don't match the Python version

___
Python tracker 

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



[issue32199] uuid.getnode() should return the MAC address on Android

2017-12-07 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

On archlinux it is easy to know precisely what patches are applied to iproute2 
and how it is built (see 
https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/iproute2).

The attached two files, archlinux-ip_link.strace and 
archlinux-ip_link_list.strace, contain the output of strace run on the commands 
'ip link' and 'ip link list' on archlinux.
* For 'ip link', the sendto() syscall uses RTM_GETLINK to get information about 
a specific network interface.
* For 'ip link list', this sendto() syscall is preceded by another sendto() 
syscall using RTM_NEWLINK to *create* information about a specific network 
interface.

Conclusions:
1) Both commands are not equivalent, this seems to be a bug in iproute2 or its 
documentation (I did not read the whole iproute2 documentation).
2) By using RTM_NEWLINK, 'ip link list' requests a write-like operation that 
may be denied by SELinux if there is no policy that allows netlink_route_socket 
(nlmsg_write). I may be wrong but on Android API 26 it seems that only few 
processes get that permission: dhcp, clatd, logd, netd, rild, ...
3) From Python perspective it is more robust to call 'ip link' to handle 
platforms where SELinux is run in enforcing mode.

I will update the PR to do only that change: s/ip link list/ip link/

--
versions: +Python 3.6
Added file: https://bugs.python.org/file47327/archlinux-ip_link_list.strace

___
Python tracker 

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



[issue32199] uuid.getnode() should return the MAC address on Android

2017-12-07 Thread Xavier de Gaye

Change by Xavier de Gaye :


Added file: https://bugs.python.org/file47326/archlinux-ip_link.strace

___
Python tracker 

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



[issue32222] pygettext doesn't extract docstrings for functions with type annotated params

2017-12-07 Thread Toby Harradine

Change by Toby Harradine :


--
keywords: +patch
pull_requests: +4648
stage:  -> patch review

___
Python tracker 

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



[issue31972] Inherited docstrings for pathlib classes are confusing

2017-12-07 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests:  -4645

___
Python tracker 

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



[issue32239] decimal module exception args incorrect for c module

2017-12-07 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +skrah

___
Python tracker 

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