[issue30888] import class not isinstance of the class

2017-07-10 Thread Ronald Oussoren

Ronald Oussoren added the comment:

In foo2.py you import "a.foo", which refers to module 'a' that isn't included 
in the directory structure you describe.  I'm assuming 'dirc' should be 'a' to 
match the code.

How did you run foo1.py?  

When running with 'python3.6 -m bug.foo1' I get an error about not being able 
to import 'a' (as expected, the package is 'bug.a').

When you run with "PYTHONPATH=. python3.6 bug/foo1.py" I get the assertion 
failure you mention, and that's expected behavior.  This gets clearer when you 
print type(fun()) and Event, the output will be:

  
  

As you can see these refer to two different classes, not the same class.

The reason for this is that  'python3.6 bug/foo1.py' adds the 'bug' directory 
to the start of sys.path, hence the "import a.foo" in foo2 succeeds. The script 
foo1.py imports 'bug.a.foo', which is a different name that happens to refer to 
the same file on the filesystem.

All in all this is expected behavior and not a bug.

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

___
Python tracker 

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



[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Josay noticed that _PyArg_NoStackKeywords() is not used anymore except for one 
place (_hashopenssl.c).

Seems this is my oversign. Generated constructors in _hashopenssl.c use the 
METH_FASTCALL | METH_KEYWORDS calling method, but check that no keyword 
arguments are passed. They can now just use the METH_FASTCALL calling method. 
And _PyArg_NoStackKeywords() can be excluded from public header.

--
status: closed -> open

___
Python tracker 

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



[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

Let's remove this function which became useless.

--

___
Python tracker 

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



[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +2706

___
Python tracker 

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



[issue30822] Python implementation of datetime module is not being tested correctly.

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

I reverted the commit which fixes test_datetime to also test Lib/datetime.py, 
to repair buildbots. But since I reverted the change, nothing was done so 
datetime.py is still not tested :-(

> The tests enabled by "-utzdata" check UTC to local and back conversions at 
> several points around *every* time transition in *every* timezone. On systems 
> with a complete installation of IANA tzdata, this is a lot of test points.
>
> These tests were supposed to be exhaustive and I did not expect them to be 
> run by default.  that's why I introduced the -utzdata flag in the first place.

Alexander: yeah, having an opt-in option to test all timezones makes sense. 
It's likely to trigger bugs in some corner cases. But the question is really 
having our CI.

Alexander, Serhiy: would you be ok to disable tzdata resource on all our CI 
(Travis CI, AppVeyor, all buildbots)?

*Maybe* we might enable tzdata on selected (fast) buildbots where test_datetime 
takes less than 20 minutes. But I would prefer to keep the option as an 
*opt-in*, rather than always running all tests on all CI.

--

___
Python tracker 

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



[issue30822] Python implementation of datetime module is not being tested correctly.

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

> Two timezones (America/New_York and Asia/Tehran) are picked for testing 
> independently from the -utzdata flag.

By the way, if someone is aware of other interesting timezones, we may also 
test more timezones (without tzdata)?

--

___
Python tracker 

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



[issue30171] Emit ResourceWarning in multiprocessing Queue destructor

2017-07-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> The problem is that multiprocessing.Queue.join_thread() does nothing since 
> the thread wasn't started by a subprocess.

I don't understand what this means.  Can you clarify a bit?

--

___
Python tracker 

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



[issue30171] Emit ResourceWarning in multiprocessing Queue destructor

2017-07-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Specifically "the thread wasn't started by a subprocess"...

--

___
Python tracker 

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



[issue29930] Waiting for asyncio.StreamWriter.drain() twice in parallel raises an AssertionError when the transport stopped writing

2017-07-10 Thread Chris Jerdonek

Changes by Chris Jerdonek :


--
nosy: +chris.jerdonek

___
Python tracker 

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



[issue30171] Emit ResourceWarning in multiprocessing Queue destructor

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

> Specifically "the thread wasn't started by a subprocess"...

I'm talking about this check in Queue._start_thread() of multiprocessing.queues:

created_by_this_process = (self._opid == os.getpid())
if not self._joincancelled and not created_by_this_process:
self._jointhread = Finalize(
self._thread, Queue._finalize_join,
[weakref.ref(self._thread)],
exitpriority=-5
)

--

___
Python tracker 

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



[issue30886] test_handle_called_with_mp_queue() of test_logging leaks a thread on AMD64 FreeBSD 10.x Shared 3.x

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

The warning is a race condition which can be reproduced easily on Linux using 
attached test_handle_called_with_mp_queue-bug.patch, run:

haypo@selma$ ./python -m test --fail-env-changed  -m 
test_handle_called_with_mp_queue  test_logging
Run tests sequentially
0:00:00 load avg: 0.22 [1/1] test_logging
Warning -- threading_cleanup() failed to cleanup 20 threads after 0 sec (count: 
20, dangling: 21)
Warning -- threading._dangling was modified by test_logging
  Before: <_weakrefset.WeakSet object at 0x7fe1df5302c8>
  After:  <_weakrefset.WeakSet object at 0x7fe1df5338e0> 
test_logging failed (env changed)

1 test altered the execution environment:
test_logging

Total duration: 718 ms
Tests result: ENV CHANGED

--
keywords: +patch
Added file: 
http://bugs.python.org/file46999/test_handle_called_with_mp_queue-bug.patch

___
Python tracker 

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



[issue30886] test_handle_called_with_mp_queue() of test_logging leaks a thread on AMD64 FreeBSD 10.x Shared 3.x

2017-07-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2707

___
Python tracker 

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



[issue30886] test_handle_called_with_mp_queue() of test_logging leaks a thread on AMD64 FreeBSD 10.x Shared 3.x

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

https://github.com/python/cpython/pull/2642 fixes the warning. I tested the 
change with test_handle_called_with_mp_queue-bug.patch: no more warning.

Sorry, I don't know multiprocessing to understand the purpose of the removed 
test.

I would like to really make sure that a Queue object doesn't "leak" a thread 
when I close .close() + .join_thread(). It's surprising that .join_thread() 
doesn't join anything and leave a thread running in the background. Even if in 
the common case, when the system load is low, the thread quits quickly thanks 
to .close().

--

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +davin, pitrou
title: test_handle_called_with_mp_queue() of test_logging leaks a thread on 
AMD64 FreeBSD 10.x Shared 3.x -> multiprocessing.Queue.join_thread() does 
nothing if created and use in the same process

___
Python tracker 

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



[issue30171] Emit ResourceWarning in multiprocessing Queue destructor

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

Let's discuss created_by_this_process in bpo-30886.

This issue is more about adding or not a ResourceWarning.

--

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

Hum, interesting, created_by_this_process was already removed from Python 2.7 
in bpo-4106:

commit 77657e40fa5f43fe6f7ffb6e32da4613dba657e1
Author: Antoine Pitrou 
Date:   Wed Aug 24 22:41:05 2011 +0200

Issue #4106: Fix occasional exceptions printed out by multiprocessing on 
interpreter shutdown.

This bug doesn't seem to exist on 3.2, where daemon threads are killed
before Py_Finalize() is entered.

--

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> I would like to really make sure that a Queue object doesn't "leak" a thread 
> when I close .close() + .join_thread().

I don't understand how this happens.  The Finalize object only acts as an 
atexit handler.  When called as a regular finalize, `self._thread` is dead and 
therefore `_finalize_join()` doesn't do anything.

--

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

> I don't understand how this happens.

If you run "./python -m test --fail-env-changed  -m 
test_handle_called_with_mp_queue  test_logging" with attached  
test_handle_called_with_mp_queue-bug.patch, no finalizer is registered: 
.join_thread() does nothing, because created_by_this_process is true.

--

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Oh, that's because you're calling join_thread() explicitly.  I see.  I agree 
that the fix looks desirable then.

--

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread STINNER Victor

New submission from STINNER Victor:

1:36:32 [224/405/1] test_import failed -- running: test_mmap (2236 sec), 
test_io (2529 sec), test_venv (1437 sec)
beginning 6 repetitions
123456
.test test_import failed -- Traceback (most recent call last):
  File 
"D:\buildarea\3.6.ware-win81-release.refleak\build\lib\test\test_import\__init__.py",
 line 377, in test_concurrency
raise exc
  File 
"D:\buildarea\3.6.ware-win81-release.refleak\build\lib\test\test_import\__init__.py",
 line 362, in run
import package
  File 
"D:\buildarea\3.6.ware-win81-release.refleak\build\lib\test\test_import\data\package\__init__.py",
 line 2, in 
package.submodule
AttributeError: module 'package' has no attribute 'submodule'

--
components: Tests, Windows
messages: 298044
nosy: haypo, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Sometimes, test_concurrency() of test_import fails with AttributeError: 
module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6
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



[issue30171] Emit ResourceWarning in multiprocessing Queue destructor

2017-07-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I don't think a ResourceWarning should be emitted.  There is no risk of data 
loss or resource leak if you don't close a multiprocessing Queue explicitly.  
Actually, in the real world, I don't think I've ever seen code that closes 
queues explicitly.

--

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

I was able to *easily* (100% failure rate) reproduce the failure with Python 
3.6 and 3.7 (master) on Windows using this command:

./python -m test -R 3:100 -m test_concurrency test_import

--

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

I don't understand if a test_concurrency() failure is a bug in importlib, or a 
bug in the test :-)

--
nosy: +brett.cannon, eric.snow, ncoghlan

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

Note: "./python -m test -R 3:100 -m test_concurrency test_import" is just a 
convenient way to run test_concurrency() "in a loop", in the same process, 100 
times.

I'm unable to reproduce the bug on Linux, even when I write 3 into 
/proc/sys/vm/drop_caches while the test is running to drop filesystem caches.

I also tried to use a temporary directory in my home (TMPDIR=$HOME/tmp) to use 
temporary files in ext4 rather than tmpfs. But I don't know if importlib uses 
temporary files or not :-)

--

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

Oh, the unit test was added 4 days ago:

commit b4baacee1adc06edbe30ac7574d17a8cd168e2e0
Author: Serhiy Storchaka 
Date:   Thu Jul 6 08:09:03 2017 +0300

bpo-30814: Fixed a race condition when import a submodule from a package. 
(#2580)

--

___
Python tracker 

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



[issue30814] Import dotted name as alias breaks with concurrency

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

test_concurrency() of test_import fails randomly on Windows: see bpo-30891.

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

> Oh, that's because you're calling join_thread() explicitly.  I see.  I agree 
> that the fix looks desirable then.

FYI I added join_thread() in my first attempt to fix "Warning -- 
threading._dangling was modified by test_logging": bpo-30131, commit 
8ca2f2faefa8dba323a2e4c4b86efb633d7a53cf. I expected that join_thread() 
would... join the thread :-)

--

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

I suggest to backport the fix up to Python 3.5.

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread Nick Coghlan

Nick Coghlan added the comment:

Indeed, Serhiy's been stress-testing some bits of the import system, and 
finding a few holes made possible by the shift away from a single global import 
lock to per-module locks. (Issue 30876 is another example of that)

Nothing immediately comes to mind as a platform-dependent code path that could 
explain why that error is showing up on Windows and not on Linux, though.

--
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 3b69d911c57ef591ac0c0f47a66dbcad8337f33a by Victor Stinner in 
branch 'master':
bpo-30886: Fix multiprocessing.Queue.join_thread() (#2642)
https://github.com/python/cpython/commit/3b69d911c57ef591ac0c0f47a66dbcad8337f33a


--

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2708

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2709

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 69e41807f0851ff1107f949dcdc94dbb0af32acd by Victor Stinner in 
branch '3.5':
bpo-30886: Fix multiprocessing.Queue.join_thread() (#2642) (#2644)
https://github.com/python/cpython/commit/69e41807f0851ff1107f949dcdc94dbb0af32acd


--

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 7f3d65d6e4f8bebaaf996efb1c1adb67eb1724cb by Victor Stinner in 
branch '3.6':
bpo-30886: Fix multiprocessing.Queue.join_thread() (#2642) (#2643)
https://github.com/python/cpython/commit/7f3d65d6e4f8bebaaf996efb1c1adb67eb1724cb


--

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

Ok, I applied my fix to 3.5, 3.6 and master branches.

Thanks for the review Antoine.

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Some parts of import machinery are platform depended (see issue30873).

I don't have idea what is wrong on Windows.

I'm puzzled. test_concurrency itself runs a test in a loop. The only difference 
between one and several consequent runs of test_concurrency is running setUp() 
and tearDown() between tests. Victor, try to add importlib.invalidate_caches() 
inside a loop. Does it cause a failure in a single test_concurrency?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue30822] Python implementation of datetime module is not being tested correctly.

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If testing with -u tzdata is such expensive, tzdata can be excluded from all 
resources. There is a precedence with the extralargefile resource (see 
test_zipfile64).

Actually this means that these test will never run until you request this 
specially.

--

___
Python tracker 

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



[issue30866] Add _testcapi.stack_pointer() to measure the C stack consumption

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 64fa449f559b0e7b0480a177000419a78ebcf3ff by Victor Stinner in 
branch 'master':
bpo-30866: Add _testcapi.stack_pointer() (#2601)
https://github.com/python/cpython/commit/64fa449f559b0e7b0480a177000419a78ebcf3ff


--

___
Python tracker 

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



[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Removed _PyArg_NoStackKeywords() (7e60192fe0dfd763b0d458cf0898ba4f7ac7d81a).

--
status: open -> closed

___
Python tracker 

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



[issue30873] `SystemError: returned NULL without setting an error` from importing _pickle on Windows

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

ppperry: First, please create a Python script and attach it to the issue, it 
would make it easier to reproduce the bug. Second, which Python version did you 
test? I tested 3.6 and master Git branches on Windows, and I'm unable to 
reproduce the bug.

I'm able to reproduce the bug on Windows using Python 3.6.1, but this version 
still contains issue30626 bug. I'm unable to reproduce the bug using 3.6.2rc2, 
so to be, this bug is just a duplicate of issue30626.

Please try: https://www.python.org/downloads/release/python-362rc2/

--
nosy: +haypo
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> "SystemError:  returned NULL without 
setting an error"  from open function

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

> Victor, try to add importlib.invalidate_caches() inside a loop. Does it cause 
> a failure in a single test_concurrency?

I added a "importlib.invalidate_caches()" call in the "for i in range(10):" 
loop. With this change, a single run doesn't fail. It doesn't fix the test 
neither: with -R 3:100, the command still fails.

> Some parts of import machinery are platform depended (see issue30873).

I don't think that this issue30873 or issue30626 is platform dependent.


> I don't have idea what is wrong on Windows.

IMHO it's just that my Windows VM is slow. It's a race condition. If I run 
"./python -m test -m test_concurrency test_import test_import": the command 
pass, but when again, it fails. It's pure random :-)

--

___
Python tracker 

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



[issue30882] Built-in list disappeared from Python 2.7 intersphinx inventory

2017-07-10 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
assignee: docs@python -> Mariatta
nosy: +Mariatta

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

I added print(id(package)) in Lib/test/test_import/data/package/__init__.py: 
when the bug occurs on my Windows VM, I see two print with two different 
identifiers. Moreover, when the bug occurs, first id(sys.modules['package']) is 
the first identifier, and then package is replaced with the new 'package' 
package in sys.modules (new identifier).

I don't understand something: sys.modules isn't supposed to be protected by a 
lock? I checked if _installed_safely.__enter__() if the _imp is held: it isn't 
held when _bootstrap._setup() is called, nor when 
_imp._install_external_importers() is called. But even if I patch these two 
functions to acquire the lock, Python startup fails on importing a codec 
module, because the _imp lock is not held in _installed_safely.__enter__(). So 
maybe sys.modules dict is supposed to be protected by a different lock, maybe 
indirectly?

I hack _bootstrap._find_and_load_unlocked() to sleep 10 ms if name == 
'package'. With this change, test_concurrency() fails immediatly on my Linux 
box.

* Apply attached importlib_sleep.patch (written for the current master branch)
* Recompile: make regen-importlib && make
* Run test_concurrency() just once: ./python -m test -m test_concurrency -v 
test_import
* You get the bug

By the way, importlib_sleep.patch changes test_concurrency() to run the test 
exactly once (it changes to loop to a single iteration, instead of 10).

Is it normal that a sleep makes import failing? Imports are not supposed to be 
atomic?

--

I tried to similar hack before the commit 
b4baacee1adc06edbe30ac7574d17a8cd168e2e0:

* add a sleep in importlib
* copy test_concurrency() from master
* Run test_concurrency()
* The test pass

While I'm not sure of my hack, it *seems* like sys.modules was somehow atomic 
before this commit?

--
keywords: +patch
Added file: http://bugs.python.org/file47000/importlib_sleep.patch

___
Python tracker 

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



[issue30814] Import dotted name as alias breaks with concurrency

2017-07-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +2710

___
Python tracker 

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



[issue30814] Import dotted name as alias breaks with concurrency

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It is worth to backport the test to older versions. Just to be sure that this 
is a 3.6 regression.

--

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

FYI test_concurrency() added by commit b4baacee1adc06edbe30ac7574d17a8cd168e2e0 
doesn't really test bpo-30814. I backported the unit test on 
1ccbad9c95cf5782a1329eeaecba6e3eb0c37cb8 (commit before 
b4baacee1adc06edbe30ac7574d17a8cd168e2e0), and the test pass, whereas I 
expected it to fail before the fix.

--

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread Nick Coghlan

Nick Coghlan added the comment:

No, there's no global lock on the import system these days.

Instead, imports are supposed to be atomic on a per-module basis, but issue 
30814 showed that some of the accesses to the shared state management (which 
*is* still supposed to be protected by the import lock) could get into trouble 
given concurrent imports from different threads.

However, the new test exercises an interesting sequence of per-module lock 
acquisition, since each thread effectively runs through this sequence:

- import package # Test case
- import package.submodule # Package init
- import package # Parent package import

That moves back-and-forth between C & Python in a few different places, and 
hence may have been relying on the GIL to keep the parts executed in C atomic.

So now I'm wondering whether or not this new problem might be due to moving the 
_imp.acquire_lock() calls into Python code as part of issue 30814, as that 
creates a window near the start of _find_and_load() where the thread may end up 
holding neither the GIL *nor* the import lock. By contrast, when the import 
lock was acquired in C, then by the time the Python code starts running 
(potentially releasing the GIL), the import lock has already been acquired.

--

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

> FYI test_concurrency() added by commit 
> b4baacee1adc06edbe30ac7574d17a8cd168e2e0 doesn't really test bpo-30814. I 
> backported the unit test on 1ccbad9c95cf5782a1329eeaecba6e3eb0c37cb8 (commit 
> before b4baacee1adc06edbe30ac7574d17a8cd168e2e0), and the test pass, whereas 
> I expected it to fail before the fix.

Oops, please ignore this comment, it was a mistake. After clearing my 
repository (removing __pycache__ directories), the test failed. I forgot to 
copy the Lib/test/test_import/data/package/ directory.

--

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

test_concurrency is failed before b4baacee1adc06edbe30ac7574d17a8cd168e2e0 on 
my computer. I think it tests the issue30814 bug even if it doesn't fail on all 
computers. At the end, this is a race condition, and the failure is 
probabilistic.

--

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

Using attached importlib_sleep.patch, you can *see* the race condition with:

diff --git a/Lib/test/test_import/data/package/__init__.py 
b/Lib/test/test_import/data/package/__init__.py
index a4f2bc3..f07eb11 100644
--- a/Lib/test/test_import/data/package/__init__.py
+++ b/Lib/test/test_import/data/package/__init__.py
@@ -1,2 +1,3 @@
 import package.submodule
+print("package: id=%#x" % id(package))
 package.submodule


Example of output:
---
haypo@selma$ ./python -m test -m test_concurrency -v test_import
package: id=0x7fb497400d58
package: id=0x7fb49744d458
test test_import failed -- (...)
---

Lib/test/test_import/data/package/__init__.py is run twice instead of being run 
once. A lock is missing somewhere on the package module.

--

___
Python tracker 

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



[issue30890] Comment error in Korean language

2017-07-10 Thread DelTos

Changes by DelTos :


--
versions: +Python 3.6 -Python 3.7

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +2711

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Victor tested test_concurrency on 3.5, and it is failed on slow Windows VM. 
Therefore the bug exists on 3.5 and is not related to recent changes.

--

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread Nick Coghlan

Nick Coghlan added the comment:

I'm about to head to bed so I'll get back to this discussion tomorrow, but in 
the meantime: Victor, maybe it would make sense to reformulate your reproducer 
as a monkeypatch for _find_and_load_unlocked() that injects the 10 ms sleep 
from the test case if it finds _frozen_importlib in sys.modules?

That is, temporarily replacing it with something like:

orig_find_and_load_unlocked = _frozen_importlib._find_and_load_unlocked
def _slow_find_and_load_unlocked(name, import_):
time.sleep(0.010)
return orig_find_and_load_unlocked(name, import_)

That way, we'd hopefully be able to reproduce the failure independently of the 
slower buildbot.

--

___
Python tracker 

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



[issue30891] Sometimes, test_concurrency() of test_import fails with AttributeError: module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6

2017-07-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2712

___
Python tracker 

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



[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

2017-07-10 Thread STINNER Victor

Changes by STINNER Victor :


--
title: Sometimes, test_concurrency() of test_import fails with AttributeError: 
module 'package' has no attribute 'submodule' on AMD64 Windows8.1 Refleaks 3.6 
-> importlib: _find_and_load() race condition on sys.modules[name] check
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



[issue30183] [HPUX] compilation error in pytime.c with cc compiler

2017-07-10 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage:  -> patch review

___
Python tracker 

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



[issue30892] _elementtree: assertion error if stdlib copy module is overriden

2017-07-10 Thread STINNER Victor

New submission from STINNER Victor:

The _elementtree fails with an assertion error if the stdlib copy module is 
overriden by the user.

haypo@selma$ mkdir copy/
haypo@selma$ touch copy/__init__.py
haypo@selma$ ./python -c 'import _elementtree'
python: Objects/abstract.c:153: PyObject_GetItem: Assertion `(item != NULL) ^ 
(PyErr_Occurred() != NULL)' failed.
Aborted (core dumped)

--
messages: 298073
nosy: haypo
priority: normal
severity: normal
status: open
title: _elementtree: assertion error if stdlib copy module is overriden
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



[issue30892] _elementtree: assertion error if stdlib copy module is overriden

2017-07-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2713

___
Python tracker 

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



[issue30851] IDLE: configdialog -- fix tkinter Variables

2017-07-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset aa8d0a24694bea05061f1920ec3f944a9e6799d5 by terryjreedy 
(csabella) in branch 'master':
bpo-30851: IDLE: Remove unused tk variables in configdialog. (#2626)
https://github.com/python/cpython/commit/aa8d0a24694bea05061f1920ec3f944a9e6799d5


--

___
Python tracker 

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



[issue30851] IDLE: configdialog -- fix tkinter Variables

2017-07-10 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
pull_requests: +2714

___
Python tracker 

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



[issue30870] IDLE: configdialog/fonts: change font when select by key up/down

2017-07-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Serhiy, I tried tkinter.test.support.simulate_mouse_click to test this patch 
but it seems not to work.  Code at end of previous message. Any idea on how to 
fix?

--
nosy: +serhiy.storchaka
stage: patch review -> test needed

___
Python tracker 

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



[issue30780] IDLE: configdialog - add tests for ConfigDialog GUI.

2017-07-10 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
dependencies: +IDLE: configdialog/fonts: change font when select by key up/down

___
Python tracker 

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



[issue30870] IDLE: configdialog/fonts: change font when select by key up/down

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It isn't my. It was added by Guilherme in r69050.

I'll take a look at code tomorrow.

--

___
Python tracker 

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



[issue30893] Expose importlib._bootstrap._ModuleLockManager in importlib.machinery

2017-07-10 Thread Brett Cannon

New submission from Brett Cannon:

Based on all the work currently going into fixing the locking situation for 
imports, it's probably a good idea to expose it publicly so others can use it.

--
components: Library (Lib)
messages: 298077
nosy: brett.cannon
priority: normal
severity: normal
status: open
title: Expose importlib._bootstrap._ModuleLockManager in importlib.machinery
type: enhancement

___
Python tracker 

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



[issue30893] Expose importlib._bootstrap._ModuleLockManager in importlib.machinery

2017-07-10 Thread Brett Cannon

Changes by Brett Cannon :


--
dependencies: +importlib: _find_and_load() race condition on sys.modules[name] 
check

___
Python tracker 

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



[issue30851] IDLE: configdialog -- fix tkinter Variables

2017-07-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset 8e3f73e5499a5bc575a5e7ad4ee0f16b1aaae829 by terryjreedy in branch 
'3.6':
[3.6] bpo-30851: IDLE: Remove unused tk variables in configdialog. (GH-2626) 
(#2648)
https://github.com/python/cpython/commit/8e3f73e5499a5bc575a5e7ad4ee0f16b1aaae829


--

___
Python tracker 

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



[issue30893] Expose importlib._bootstrap._ModuleLockManager in importlib.machinery

2017-07-10 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +eric.snow, ncoghlan

___
Python tracker 

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



[issue30851] IDLE: configdialog -- fix tkinter Variables

2017-07-10 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
dependencies:  -IDLE: configdialog - add tests for ConfigDialog GUI.
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



[issue20917] Idle: Enhance font change notification system

2017-07-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I believe I saw somewhere that the 'somehow' in the opening post is looping 
through the windows listed under the Window tab.

This issue was inspired by #17642, which allows hotkeys (^-, ^+) and wheel to 
change font size in editor window.  If the size change only applies to the 
current window, then only the CodeContext for that window should be notified.  
If CodeContext becomes a feature rather than extension, #27099, then code 
editor windows could know they have a code context and notify it when they get 
notified.  That will not help external extensions.

--

___
Python tracker 

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



[issue30892] _elementtree: assertion error if stdlib copy module is overriden

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset b136f11f3a51f9282ae992bac68f170ca5563b55 by Victor Stinner in 
branch 'master':
bpo-30892: Fix _elementtree module initialization (#2647)
https://github.com/python/cpython/commit/b136f11f3a51f9282ae992bac68f170ca5563b55


--

___
Python tracker 

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



[issue30892] _elementtree: assertion error if stdlib copy module is overriden

2017-07-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2715

___
Python tracker 

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



[issue30892] _elementtree: assertion error if stdlib copy module is overriden

2017-07-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2716

___
Python tracker 

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



[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 4f9a446f3fb42f800e73cd9414dd1eccb3ca4fa7 by Victor Stinner in 
branch 'master':
bpo-30891: Fix importlib _find_and_load() race condition (#2646)
https://github.com/python/cpython/commit/4f9a446f3fb42f800e73cd9414dd1eccb3ca4fa7


--

___
Python tracker 

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



[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

2017-07-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2717

___
Python tracker 

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



[issue29854] Segfault when readline history is more then 2 * history size

2017-07-10 Thread Berker Peksag

Berker Peksag added the comment:


New changeset bfa4fe4f39dd8b5ce1a0b649cedd36857859081a by Berker Peksag (Nir 
Soffer) in branch '2.7':
[2.7] bpo-29854: Fix segfault in call_readline() (GH-728)
https://github.com/python/cpython/commit/bfa4fe4f39dd8b5ce1a0b649cedd36857859081a


--

___
Python tracker 

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



[issue30894] Python 3.6.1 String Literal Error Not Going to sys.stderr

2017-07-10 Thread George Gillan

New submission from George Gillan:

Python 3.6.1 String Literal Error Not Going to sys.stderr

Using Windows 7 and Python 3.6.1. Attempting to redirect sys.stderr to a file. 
The application will be deployed via .pyw file instead of .py so the GUI 
application runs without a console window.

Is this fixable or 'as-is' due to the nature of the way the interpreter scans 
the code?

The following code worked as intended.

#!/usr/bin/env python3.6 
errfile = 'test_err.txt'

import sys
errorlog = open(errfile, 'w')
sys.stderr = errorlog

1/0

The code above produced a file called test_err.txt with the following contents:

Traceback (most recent call last):
  File "C:\Users\George\Coding\Python\test\mintest.py", line 8, in 
1/0
ZeroDivisionError: division by zero


The following code did not work as intended.

#!/usr/bin/env python3.6 
errfile = 'test_err.txt'

import sys
errorlog = open(errfile, 'w')
sys.stderr = errorlog

print("test)

The code above did not create the file test_err.txt with the error going to the 
console window instead.


Copy-paste from the Windows console.

The successful test (first) showed nothing in the console window; the error was 
logged to the file as noted above. The unsuccessful test (second) did not 
create the file, instead the error was sent to the console.

C:\Users\George\Coding\Python\test>mintest

C:\Users\George\Coding\Python\test>mintest
  File "C:\Users\George\Coding\Python\test\mintest.py", line 8
print("test)
   ^
SyntaxError: EOL while scanning string literal

C:\Users\George\Coding\Python\test>

PS: This is my first bug/issue submission here. Please coach me as needed if I 
messed it up.

--
components: Interpreter Core
files: Python361_bug.txt
messages: 298083
nosy: George Gillan
priority: normal
severity: normal
status: open
title: Python 3.6.1 String Literal Error Not Going to sys.stderr
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file47001/Python361_bug.txt

___
Python tracker 

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



[issue29854] Segfault when readline history is more then 2 * history size

2017-07-10 Thread Berker Peksag

Berker Peksag added the comment:

Ok, I think we can finally close this one :) Thank you, everyone!

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

___
Python tracker 

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



[issue30892] _elementtree: assertion error if stdlib copy module is overriden

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 044e156426825acac8b6c6d1ce14d5b7bcb20bc9 by Victor Stinner in 
branch '3.6':
bpo-30892: Fix _elementtree module initialization (#2647) (#2649)
https://github.com/python/cpython/commit/044e156426825acac8b6c6d1ce14d5b7bcb20bc9


--

___
Python tracker 

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



[issue30892] _elementtree: assertion error if stdlib copy module is overriden

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 7f567e7472dd6c3d066eec1c204301df251484b5 by Victor Stinner in 
branch '3.5':
bpo-30892: Fix _elementtree module initialization (#2647) (#2650)
https://github.com/python/cpython/commit/7f567e7472dd6c3d066eec1c204301df251484b5


--

___
Python tracker 

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



[issue27099] IDLE: turn builting extensions into regular modules

2017-07-10 Thread Charles Wohlganger

Changes by Charles Wohlganger :


--
pull_requests: +2718

___
Python tracker 

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



[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:


New changeset fe6e686c27ce3a3ecdf03803cff7e230dee5530d by Victor Stinner in 
branch '3.6':
bpo-30891: Fix importlib _find_and_load() race condition (#2646) (#2651)
https://github.com/python/cpython/commit/fe6e686c27ce3a3ecdf03803cff7e230dee5530d


--

___
Python tracker 

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



[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

Backporting the fix ot Python 3.5 doesn't seem trivial, 3.5 lacks many changes.

--

___
Python tracker 

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



[issue30886] multiprocessing.Queue.join_thread() does nothing if created and use in the same process

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

I'm not sure that the bug is fully fixed, I still saw a warning on:
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.x%20Shared%203.x/builds/561/

This build tested the commit aa8d0a24694bea05061f1920ec3f944a9e6799d5 which is 
more recent than commit 3b69d911c57ef591ac0c0f47a66dbcad8337f33a.

test_handle_called_with_mp_queue (test.test_logging.QueueListenerTest) ...

Warning -- threading_cleanup() failed to cleanup -1 threads after 5 sec (count: 
0, dangling: 1)

ok

--

___
Python tracker 

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



[issue30714] test_ssl fails with openssl 1.1.0f

2017-07-10 Thread STINNER Victor

STINNER Victor added the comment:

The test now fails on AMD64 Debian PGO 3.x:

http://buildbot.python.org/all/builders/AMD64%20Debian%20PGO%203.x/builds/985/steps/test/logs/stdio

FAIL: test_alpn_protocols (test.test_ssl.ThreadedTests)

--

___
Python tracker 

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



[issue27755] Retire DynOptionMenu with a ttk Combobox

2017-07-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I did more experiments with DOM (DynamicOptionMenu) and Combobox (CB).  This 
was partly to evaluate CB as replacement for DOM for font size; partly to 
consider CB for the font list.   At least by default, both start closed.  Font 
list should start open. CB has an Entry area, DOM does not.  They get focus by 
clicking.  Both open with Down or click on Down button.  DOM also opens on Up, 
not essential. CB adds scrollbar if needed.  DOM?  Needed for font list.  Up 
and Down move the selection highlight but do not select.  Selection by click 
and  close the box and generate <>  This is unlike 
Listbox where moving highlight generates <>.  #30870 fixed code 
so that Up and Down, in addition to click, caused sample change.  I want to 
keep this for font choice and add it for size choice.  For CB, click on Down 
button closes without changing selection.  For DOM, it does not, a deficiency.

--

___
Python tracker 

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



[issue24776] IDLE: Improve config dialog font change user interface

2017-07-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Make this the master issue for improving the font tab user interface by 
improving components and rearranging them.  With basic tests done, I am moving 
this up in priority.

Related issues currently open.
#30870 (dependency) made Up/Down change font selection; unit test needed.
#27755 replaces IDLE's custom DynOptionMenu with ttk.Combobox.  Comboboxes 
allow key entry of a value and the arrow toggles. See msg298091 for comparison 
and evaluation for font page.
#13802 (dependency) is about the improving the sample display.
#17642 is about font resizing by hot key and wheel in editor.
#20917 is about the font change notification system.

Additional changes for this issue or new related issues.

* Selecting a font by name (as well as a font size by number) can be done with 
an entry box with a validator linked to the listbox.  If a ttk Combobox can be 
locked open, I would try that.  See #27755.  For a demo of another alternative, 
run the tk fontchooser.

import tkinter
root = tkinter.Tk()
root.tk.call('tk', 'fontchooser', 'show')

For IDLE, I like some parts, not others.  I view it as an alternate mockup for 
ideas to build on.

* Mark's mockup removes "Base Editor Font".  If an editor window can have its 
font individually resized, then the settings on the font page define just that. 
 'Font Size' would then have to be 'Starting [or Default] Font Size'. 

* Font size a slider?  I am not convinced.  It would have to be vertical to go 
up to 40.  (I added larger sizes by request for classroom projector use.)  On 
the other hand, it would allow any size in the given range.  A spinbox that 
could be spun by mousewheel would also and stay compact.  Or use a ttk Combobox.

* See #13802 for discussion of sample display.

* Indent.  I don't understand "cries out to be moved (usually when people are 
intending to increase their font size)."  But I think it take too much space 
and should be shrunk to a spin box or drop box.  Reduced to a single line, I am 
thinking of moving it to the General tab, or perhaps a new Editor tab.  It does 
not particularly belong with font selection.

* Factor the Font page, with associated Variables and their tracers, other 
attributes, and methods, into a FontPage class.

--
dependencies: +IDLE Prefernces/Fonts: use multiple alphabets in examples, IDLE: 
configdialog/fonts: change font when select by key up/down, Retire 
DynOptionMenu with a ttk Combobox
priority: low -> normal
title: Improve Fonts/Tabs UX for IDLE -> IDLE: Improve config dialog font 
change user interface
versions: +Python 3.7 -Python 3.5

___
Python tracker 

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



[issue30883] test_urllib2net failed on s390x Debian 3.6: ftp.debian.org error, too many connections from your internet address

2017-07-10 Thread Berker Peksag

Changes by Berker Peksag :


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



[issue30895] Decimal arithmetic sum error

2017-07-10 Thread Yelson Chevarrias Huaman

New submission from Yelson Chevarrias Huaman:

Decimal arithmetic sum error

--
components: Interpreter Core
files: csm.png
messages: 298093
nosy: Yelson Chevarrias Huaman
priority: normal
severity: normal
status: open
title: Decimal arithmetic sum error
type: performance
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file47002/csm.png

___
Python tracker 

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



[issue30895] Decimal arithmetic sum error

2017-07-10 Thread Yelson Chevarrias Huaman

Changes by Yelson Chevarrias Huaman :


--
type: performance -> behavior

___
Python tracker 

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



[issue30895] Decimal arithmetic sum error

2017-07-10 Thread Yelson Chevarrias Huaman

Changes by Yelson Chevarrias Huaman :


--
versions: +Python 3.3, Python 3.4, Python 3.6, Python 3.7

___
Python tracker 

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



[issue30895] Decimal arithmetic sum error

2017-07-10 Thread Zachary Ware

Zachary Ware added the comment:

https://docs.python.org/3/tutorial/floatingpoint.html

--
nosy: +zach.ware
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue30896] BytesWarning in re module when compiling certain bytes patterns

2017-07-10 Thread Jelle Zijlstra

New submission from Jelle Zijlstra:

This code in sre_parse (line 738 and down):

warnings.warn(
'Flags not at the start of the expression %s%s' 
% (
source.string[:20],  # truncate long regexes
' (truncated)' if len(source.string) > 20 
else '',
),
DeprecationWarning, stacklevel=7
)


triggers a BytesWarning if you do `_line_re = re.compile(br'^(.*?)$(?m)')`.

The fix should be simple; I can try to get a PR in over the next few days.

--
components: Library (Lib)
messages: 298095
nosy: Jelle Zijlstra, ezio.melotti, serhiy.storchaka
priority: normal
severity: normal
status: open
title: BytesWarning in re module when compiling certain bytes patterns
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



[issue12910] urrlib.quote quotes too many chars, e.g., '()'

2017-07-10 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage:  -> patch review
versions:  -Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue30781] IDLE: configdialog -- switch to ttk widgets.

2017-07-10 Thread Cheryl Sabella

Changes by Cheryl Sabella :


--
pull_requests: +2719

___
Python tracker 

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



[issue30894] Python 3.6.1 String Literal Error Not Going to sys.stderr

2017-07-10 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Before Python runs your code, it compiles it to byte-code. A SyntaxError means 
that the code cannot be compiled, and so it does not run.

So the SyntaxError is raised *before* any of the code runs, and standard error 
is not re-directed. This is expected behaviour, not a bug. You cannot catch 
compile-time errors at run-time.

--
nosy: +steven.daprano
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



[issue30895] Decimal arithmetic sum error

2017-07-10 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Also, for the future, please do not post screen shots of text. Copy and Paste 
the text from the console. Thank you.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue30893] Expose importlib._bootstrap._ModuleLockManager in importlib.machinery

2017-07-10 Thread Nick Coghlan

Nick Coghlan added the comment:

Based on https://github.com/python/cpython/pull/2646/files#r126574323, I'm 
actually thinking along different lines: I'm starting to think we should move 
the current sys.modules to sys._modules, and make sys.modules a synchronised 
wrapper that does the following for all get/set/delete operations:

  # Acquires the global import lock
  # Acquires the relevant module lock
  # Releases the global import lock
  # Mutates sys._modules
  # Releases the module lock

That said, I'm not sure that would be sufficient to give the desired level of 
atomicity, so exposing ModuleLockManager may actually be a better approach.

--

___
Python tracker 

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



[issue30803] Truth value of sets not properly documented

2017-07-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Responding here to Peter's PR comment.  Peter opened this issue with the claim 
that the doc failed a specific test case-- document the truth value of set().  
Since mappings are (or can be viewed as) a specialized type of set, I always 
considered that the empty mapping line implicitly covered sets.  But I 
acknowledge that this is not clear for everyone.  The simplest fix to make the 
test pass would be: "any unordered collection, for example, set(), {}".  This 
should also cover frozenset and a possible frozendict.

Raymond noted that 'user-defined' in the last bullet point is wrong (it implies 
that built-in functions are different) and should be deleted.  He then combined 
the corrected rule for false with the default rule in the next sentence to 
produce a succinct statement of the actual rule.  (In CPython, 'default' is 
literally true. Class 'object' has neither __bool__ nor __len__; ditto for all 
subclasses that do not add one.)

With a minor change, I like this statement and agree that it should be moved 
above the examples.  But I think the bullet points should be reduced to just 3, 
rewritten, and single spaced, but not smashed into running text.  I suggest 
replacing everything between the first sentence (ending with 'below.') and the 
last two (beginning with 'Operations') with:

"By default, an object is considered true unless its class defines either a 
__bool__ method that returns False or __len__ method that returns zero, when 
called with the object.  Here are most of the built-in objects considered false.

* constants defined to be false: None and False.
* numeric 0 of any type: 0, 0.0, Decimal(0), Fractions(0, 1)
* empty sequences and collections: '', (), [], {}, set(), range(0)
"

Before writing the above, I checked that an instance attribute __bool__ = 
lambda: False is not consulted by bool().

--

___
Python tracker 

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



[issue30896] BytesWarning in re module when compiling certain bytes patterns

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your report Jelle, but this was fixed in issue30605.

--
resolution:  -> out of date
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



  1   2   >