[issue26624] Windows hangs in call to CRT setlocale()

2016-03-25 Thread Steve Dower

Steve Dower added the comment:

Locking inversion I think, I don't have the bug details handy.

The fix went out over Windows Update recently, but that's only for the release 
version of the runtime. The fixed debug version should have been installed with 
VS 2015 Update 1.

However, since it's still occurring on Jeremy's machine, it may not actually be 
the same bug. Checking the file version of ucrtbased.dll will help, but I can't 
verify the exact certain until Monday.

--

___
Python tracker 

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



[issue23551] IDLE to provide menu link to PIP gui.

2016-03-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:

gohlke/pythonlibs/: Search will have to use a custom function.  If direct 
download from url by pip does not work, then we write a custom function to 
download to a temp file and pip install from local file.  (This is suggestion 
on site.)

runpip: It would be nice if import and main(...) could be made to work by 
reloading the module (to refresh the cache), but if not, subprocess should work 
as a backup.  Having 'run pip command' encapsulated makes it easy to switch 
without affecting the rest of the code.

Additional features: Raymond's list is not a firm cutoff.  I an not sure what a 
'proxy' is in this context and have no sense of what will be useful, especially 
to beginners, rather than clutter.  But I am willing to be educated and 
persuaded.  And there are other people, including a second mentor for this 
project, who can give opinions.

--

___
Python tracker 

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



[issue23735] Readline not adjusting width after resize with 6.3

2016-03-25 Thread Martin Panter

Martin Panter added the comment:

Unfortunately, yes I think another test might be needed in configure.ac, unless 
you can piggy-back on one of the existing flags.

One more thing that I thought of: Looking at the main Python signal handler, it 
reinstalls itself, see 
. This 
is apparently because handlers installed by Posix signal() might be only called 
once. But if the handler was installed by sigaction(), it should not be 
reinstalled. Should our SIGWINCH handler do something similar?

--
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue25987] collections.abc.Reversible

2016-03-25 Thread Guido van Rossum

Guido van Rossum added the comment:

Andrew, did you lose interest in this? We now have a PR for typing.py that 
expects this to be resolved: https://github.com/python/typing/pull/194

--

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread Martin Panter

Martin Panter added the comment:

Sorry, but I don’t think I have the time/motivation/expertise to look into the 
fix in detail. But there are no warnings or failures anymore when I use 
-Werror, so I am happy!

BTW the spurious background processes are still there (visible if you run “ps” 
or “pstree” immediately after the test finishes), but they no longer print 
errors.

--

___
Python tracker 

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



[issue25951] SSLSocket.sendall() does not return None on success like socket.sendall()

2016-03-25 Thread Martin Panter

Martin Panter added the comment:

Thanks for your work Aviv. This version looks good to me.

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



[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2016-03-25 Thread Martin Panter

Martin Panter added the comment:

In many cases I prefer “with” over “try / finally”. But Python 2’s sockets do 
not support “with” statements, so choice (2) is not possible for 2.7.

I found one potential technical problem, and maybe some redundant close() calls 
in the review.

--

___
Python tracker 

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



[issue26391] typing: Specialized sub-classes of Generic never call __init__

2016-03-25 Thread Guido van Rossum

Guido van Rossum added the comment:

Actually, I just realized why this is. Generic.__new__() calls 
next_in_mro.__new__(_gorg(cls)). Here next_in_mro is just object, but 
_gorg(cls) is Foo, in the case where cls is Bar (i.e. Foo[str]). The _gorg() 
call strips the [str] part of the type.

So far so good. Where it gets interesting is that, in general in Python, 
whenever __new__(cls, ...) returns an object whose class is not cls, it is 
presumed to be an already properly initialized object!

I think I can fix this by calling __init__() explicitly in the case where 
_gorg(cls) is not cls.

The reason, BTW, why it strips the [str] part of the class is because that's 
what PEP 484 says, in the same section where it says that Node[T]() and 
Node[int]() are allowed:

> At runtime the type is not preserved, and the class of ``x`` is just
> ``Node`` in all cases.

So this bit of code is trying to do the right thing but obviously hasn't been 
tested much, because mypy disallows that syntax.

--

___
Python tracker 

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



[issue23886] faulthandler_user should use _PyThreadState_Current

2016-03-25 Thread Albert Zeyer

Albert Zeyer added the comment:

Yes exactly. Sorry if I was unclear before. :)

I mentioned SIGUSR1/2 because for a segfault, the signal handler will usually 
be executed in the same thread (although I'm not sure if that is guaranteed), 
so that was usually not a problem. But I used SIGUSR1 when my Python 
application is hanging and esp in that case I would like to know the current 
Python active thread.

--

___
Python tracker 

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



[issue25911] Regression: os.walk now using os.scandir() breaks bytes filenames on windows

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

Update: test_os pass on all Windows buildbots except one!

I don't understand why the test fails on this buildbot.

http://buildbot.python.org/all/builders/AMD64%20Windows8%203.x/builds/1906/steps/test/logs/stdio

==
FAIL: test_walk_bottom_up (test.test_os.BytesWalkTests)
--
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows8\build\lib\test\test_os.py", line 895, 
in test_walk_bottom_up
self.assertEqual(len(all), 4)
AssertionError: 5 != 4

--

___
Python tracker 

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



[issue25911] Regression: os.walk now using os.scandir() breaks bytes filenames on windows

2016-03-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 82da02b5bf22 by Victor Stinner in branch 'default':
Issue #25911: more info on test_os failure
https://hg.python.org/cpython/rev/82da02b5bf22

--

___
Python tracker 

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



[issue22898] segfault during shutdown attempting to log ResourceWarning

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

warn_5.patch: The patch cannot be reviewed on Rietveld :-( You must not use the 
git format for diff.

warn_5.patch: "if (globals == NULL) { (...) return 0; }"

It looks like filename is not initialized. I suggest to use:

   *filename = f->f_code->co_filename;

It looks like you have to add:

   if (PyUnicode_Check(*filename)) *filename = NULL;

To mimick the code below.

--

___
Python tracker 

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



[issue20021] "modernize" makeopcodetargets.py

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

> Or does it matter to be able to use an external python program?

Oh wait, I misunderstood how the script is used. I understood that the script 
must be run manually only when a new opcode is added and so is rarely used and 
only used with the built Python program.

In fact, the script is part of the build process! I completely missed that, 
sorry. I searched how it was used but I missed the build process.

So yes, it matters to support Python 2 and Python 3 in 
Python/makeopcodetargets.py.

I pushed Serhiy's patch issue20021_2.diff.

--

___
Python tracker 

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



[issue20021] "modernize" makeopcodetargets.py

2016-03-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6ceceb052394 by Victor Stinner in branch 'default':
makeopcodetargets.py: we need to import Lib/opcode.py
https://hg.python.org/cpython/rev/6ceceb052394

--
nosy: +python-dev

___
Python tracker 

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



[issue19829] _pyio.BufferedReader and _pyio.TextIOWrapper destructor don't emit ResourceWarning if the file is not closed

2016-03-25 Thread Martin Panter

Martin Panter added the comment:

In the long term, I prefer not calling close() in __del__(), like 
del-flush.patch, although I admit it is an API change and should probably be 
limited to 3.6+. If people want to improve things in 3.5, privately 
implementing _dealloc_warn() like Victor’s pyio_res_warn-3.patch seems the best 
option.

Serhiy: why did you add 2.7 to this bug? For 2.7, I don’t think anything should 
be done. There is no ResourceWarning in 2.7.

In 3.5, _dealloc_warn() could also be implemented in SocketIO (possibly also 
HTTPResponse, GzipFile, etc). But it should not become a public API, and I 
don’t think it is important to make this sort of change to 3.5 anyway.

In 3.6, if we stopped __del__() from calling close() like del-flush.patch, we 
would be changing the documented behaviour: 
 says “IOBase . 
. . calls the instance’s close() method.” But the end result seems cleaner to 
me. I think changing or adding an API (__del__, _dealloc_warn, etc) is 
necessary for a general solution to the problem.

The effect of del-flush.patch will be that a wrapped FileIO or similar object 
will not be closed until all references are deleted.

>>> file = open(os.devnull, "wb", 0)
>>> print(file)
<_io.FileIO name='/dev/null' mode='wb' closefd=True>
>>> wrapper = BufferedWriter(file)

In 3.5, deleting the wrapper produces a warning and closes the underlying file:

>>> del wrapper
__main__:1: ResourceWarning: unclosed file <_io.BufferedWriter name='/dev/null'>
>>> print(file)
<_io.FileIO [closed]>
>>> file.write(b"more data")
Traceback (most recent call last):
  File "", line 1, in 
ValueError: I/O operation on closed file

I propose that in 3.6, deleting a wrapper should not automatically close or 
warn about the wrapped object until all references are deleted:

>>> del wrapper  # No problem; we still have a reference to "file"
>>> file.write(b"more data")  # File is still open
9
>>> del file  # Finally closes the file and triggers the warning
ResourceWarning: unclosed file 

--

___
Python tracker 

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



[issue23886] faulthandler_user should use _PyThreadState_Current

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

> I want that it marks the current Python thread correctly, and not the current 
> sighandler thread.

Oook, I finally understood your use case. You want to know which threads 
hold the GIL. You don't care which thread got the signal.

--

___
Python tracker 

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



[issue26391] typing: Specialized sub-classes of Generic never call __init__

2016-03-25 Thread STINNER Victor

Changes by STINNER Victor :


--
title: Specialized sub-classes of Generic never call __init__ -> typing: 
Specialized sub-classes of Generic never call __init__

___
Python tracker 

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



[issue22218] Fix more compiler warnings "comparison between signed and unsigned integers"

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

fix_warning_unicodeobject.diff and issue22218-2.patch don't seem to be needed 
anymore. The code is now:

if (PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(wchar_t) < (size + 1))
return NULL;

I close the issue. More specific issues must be opened if you still want to fix 
similar issues.

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

___
Python tracker 

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



[issue25160] Stop using deprecated imp module; imp should now emit a real DeprecationWarning

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

> Tools/i18n/pygettext.py:159:import imp

I opened the issue #26639 for it.


>> Python/makeopcodetargets.py:9:import imp
> See issue 20021.

I pushed the change f682b620c64d but I forgot about the issue #20021. Let's 
discuss there about this script.


> Tools/importbench/importbench.py:10:import imp

I think that it's fine to keep imp there.


> Lib/modulefinder.py:14:import imp

This one requires more work than the other.

--

___
Python tracker 

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



[issue25160] Stop using deprecated imp module; imp should now emit a real DeprecationWarning

2016-03-25 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +eric.snow

___
Python tracker 

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



[issue26631] Unable to install Python 3.5.1 on Windows 10 - Error 0x80070643: Failed to install MSI package.

2016-03-25 Thread J Osell

J Osell added the comment:

Done

--

___
Python tracker 

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



[issue26631] Unable to install Python 3.5.1 on Windows 10 - Error 0x80070643: Failed to install MSI package.

2016-03-25 Thread J Osell

Changes by J Osell :


Added file: http://bugs.python.org/file42294/Python 3.5.1 
(64-bit)_20160323181333_000_core_JustForMe.log

___
Python tracker 

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



[issue25256] Add sys.debug_build public variable to check if Python was compiled in debug mode

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

I lost interest in this issue. It really looks like a corner case, so I prefer 
to keep the current code. I'm not interested to work on the abiflags on Windows.

--
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue25276] Intermittent segfaults on PPC64 AIX 3.x

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

The origin of the crash is unknown. Since I didn't see the crash recently, I 
close the issue.

--
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue26624] Windows hangs in call to CRT setlocale()

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

> It's been fixed, just figuring out when the update will be available, or how 
> to get it if it already is.

Can you elaborate? What was the bug? How was it fixed? Is it a bug in Windows, 
in Visual Studio or in the C library?

--

___
Python tracker 

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



[issue26624] Windows hangs in call to CRT setlocale()

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

The issue #25289 has marked as a duplicate of this issue.

--

___
Python tracker 

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



[issue25289] test_strptime hangs sometimes on AMD64 Windows7 SP1 3.x buildbot

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

It looks like the issue was a bug in setlocale() and that it was fixed in 
Windows! See the issue #26624.

--
resolution:  -> duplicate
status: open -> closed
superseder:  -> Windows hangs in call to CRT setlocale()

___
Python tracker 

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



[issue26643] regrtest: rework libregrtest.save_env submodule

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

> Consider your example with the 'sys.path' resource. With current code I need 
> to understand only 3 simple lines of the code in two close methods. With the 
> patch I need to research 4 classes with 16 complicated methods! This is awful!

I replaced get_sys_path()/restore_sys_path() (2 methods) with 
ModuleAttr.get()+ModuleAttrList.encode_value() / 
ModuleAttr.restore()+ModuleAttrList.restore_attr() (4 methods).

I want to factorize the code to limit duplicated code.

My use case is that I want to see what changed when I get the "test xxx changed 
yyy" error. For sys.path, ModuleAttrList.decode_value() helps to get a nicer 
output since you only display 1 list instead of the (id, list, list_copy) tuple.

How do you suggest to enhance the existing code to get such nicer output?


> Now about using __subclasses__(). Is it guarantied that the order of classes 
> in __subclasses__() is the same as the order of declaration and always will 
> be?

No, it looks random.


> The order of restoring resources matters.

I'm not sure that it's a good thing to have dependencies between "resources". I 
see that Files depends on Cwd, but maybe the Files check can be integrated into 
Cwd?

Ok so the order matters, in this case, I can use a metaclass to use the order 
of class definition. It will make get_resources() simpler, it will be build 
directly in the metaclass.

> For now if there is needed to change the order of restoring resources (I'm 
> sure there will be need to do this in future) you need to change only one or 
> two lines. With your patch you need to reorder classes declarations.

Yes. Is it really an issue? I only see two resources that have a dependency 
(Files and Cwd). It's not like this file is modified regulary.


> Nicer diff for dictionaries can be an enhancement, but it can be implemented 
> without such large rewriting.

How do you want to implement that? Currently, a resource has a "get" method 
which returns a blackbox. It's not easy to display it. There is not standard 
format.

--

___
Python tracker 

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



[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

"try: ... finally: s.close()" are "with s: ..." do the same thing, but I prefer 
"with" (context-manager). IMO it's more "pythonic". I prefer to see the 
"cleanup block" at the beginning, rather than at the end.

> My point about Python 2 was that this might add an annoying difference 
> between the two branches. Even if you don’t apply this to Py 2, the next 
> person adding or updating a test might be inclined to do it.

Well, there are 3 choices:

(1) Do nothing. The code rotten slowly (technical debt)
(2) Modify all actively development branches (2.7, 3.5, default)
(3) Only modify Python 3.6

Mofiying all branches means taking the (low) risk of introducing regressions. 
IMHO regressions occur, all the time.

I prefer the option (3) because it allows to enhance the code without taking 
any risk on regression.

Yeah, the code diverge, it's a natural fact.

Then you write that my changes replacing try/finally with "with" are not worth. 
Well, maybe you are true. Since 5 years, I convert all the code to "with" 
because I really like context managers. IMHO they make the code stronger and 
easier to read.

--

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

I'm not sure why Python 2.7 was in the Versions. I just ran "python2.7 -Werror 
-m test.regrtest -v test_multiprocessing" => no error. ResourceWarning doesn't 
exist in Python 2.

Is it still something to do on multiprocessing about ResourceWarning?

I didn't understand if you (Martin and Serhiy) are ok with my change (based on 
Serhiy's change).

--
versions:  -Python 2.7, Python 3.4

___
Python tracker 

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



[issue26627] IDLE incorrectly labeling error as internal

2016-03-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The goal is to match the traceback that Python itself produces with the same 
code, but it is perhaps an impossible process. The current list goes back to 
2003 without tracker issue numbers, so I don't know the reason for each.  I 
worry a bit about the suppression of lines from threading and queue.

I wondered why the idlelib.run lines were here until I read this (3.5.2, 
run.py, line 233-236.

if len(tb) == 0:
# exception was in IDLE internals, don't prune!
tb[:] = orig_tb[:]
print("** IDLE Internal Exception: ", file=sys.stderr)

So both lines were deleted and then restored.

Prepending idlelib as appropriate, seems like a good idea.

exclude = ['bdb.py', 'queue.py', 'threading.py']
for name in ('RemoteDebugger.py', 'rpc.py', 'run.py'):
exclude.append(os.path.join('idlelib', name))

--
stage:  -> test needed

___
Python tracker 

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



[issue26642] Replace stdout and stderr with simple standard printers at Python exit

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka added the comment:
> 1. Is there a reason only name is closed, not dunder_name? (Josh's question, 
> but I'm interesting too).

By default, sys.__stdout__ is sys.stdout. Is it ok to close the same file twice?

> 2. Is it worth to first replace standard streams with "standard printers", 
> and then close original streams? This allows to log warnings from closing 
> streams.

Yeah, I tried this locally after sending my patch. I think that we
should keep a strong reference and only "decref" after the stream is
replaced.

> 3. "standard printers" are used at startup and at shutdown. Can we reuse some 
> code? Or save and reuse "standard printers"?

I will check, it's maybe possible to share some code inside pylifecycle.c.

> 4. Daemons close standard streams and fileno(stdout) can return unrelevant 
> value. Perhaps it is not good idea to recreate closed stdout.

Ah yes, while playing with my patch, I noticed that I replaced stdout
even if sys.stdout was NULL or None.

Closed stdout is a different thing. I guess that we can try to call
stdout.closed() and only replaced it with a standard printer it
closed() returns True (don't do it on error nor if closed() returns
false).

--

___
Python tracker 

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



[issue26642] Replace stdout and stderr with simple standard printers at Python exit

2016-03-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There are some questions.

1. Is there a reason only name is closed, not dunder_name? (Josh's question, 
but I'm interesting too).

2. Is it worth to first replace standard streams with "standard printers", and 
then close original streams? This allows to log warnings from closing streams.

3. "standard printers" are used at startup and at shutdown. Can we reuse some 
code? Or save and reuse "standard printers"?

4. Daemons close standard streams and fileno(stdout) can return unrelevant 
value. Perhaps it is not good idea to recreate closed stdout.

--

___
Python tracker 

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



[issue19829] _pyio.BufferedReader and _pyio.TextIOWrapper destructor don't emit ResourceWarning if the file is not closed

2016-03-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

1. What if only object which directly owns a limited resource will emit a 
ResourceWarning? This can break some tests, but may be these tests are too 
strong? Current GC may be better than when io classes were implemented.

2. An object which indirectly owns a limited resource don't know about this if 
use only public API. It can known about this only if the wrapped object 
provides _dealloc_warn(). Thus _dealloc_warn() extends the API. If allows an 
object which indirectly owns a limited resource emit a resource warning, it may 
be worth to expose _dealloc_warn() or something equivalent as public API.

--

___
Python tracker 

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



[issue26616] A bug in datetime.astimezone() method

2016-03-25 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

The fix was applied to default in c9bc6614a652 but I got the commit message 
wrong.  I will not attempt to fix it (not sure it is even possible in hg.)

--

___
Python tracker 

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



[issue26616] A bug in datetime.astimezone() method

2016-03-25 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

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



[issue26616] A bug in datetime.astimezone() method

2016-03-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 361a92204d4a by Alexander Belopolsky in branch '3.5':
Issue#26616:Fixed a bug in datetime.astimezone() method.
https://hg.python.org/cpython/rev/361a92204d4a

--
nosy: +python-dev

___
Python tracker 

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



[issue26643] regrtest: rework libregrtest.save_env submodule

2016-03-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Old code looks much clearer to me.

Consider your example with the 'sys.path' resource. With current code I need to 
understand only 3 simple lines of the code in two close methods. With the patch 
I need to research 4 classes with 16 complicated methods! This is awful!

That was about first two items.

Now about using __subclasses__(). Is it guarantied that the order of classes in 
__subclasses__() is the same as the order of declaration and always will be? 
The order of restoring resources matters. For now if there is needed to change 
the order of restoring resources (I'm sure there will be need to do this in 
future) you need to change only one or two lines. With your patch you need to 
reorder classes declarations. This not only makes the patch larger, but makes 
harder to review the diff and to track the history of the file.

Nicer diff for dictionaries can be an enhancement, but it can be implemented 
without such large rewriting.

--

___
Python tracker 

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



[issue26616] A bug in datetime.astimezone() method

2016-03-25 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
stage: patch review -> commit review

___
Python tracker 

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



[issue26616] A bug in datetime.astimezone() method

2016-03-25 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
versions:  -Python 3.3, Python 3.4

___
Python tracker 

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



[issue26616] A bug in datetime.astimezone() method

2016-03-25 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

> When you made your first astimezone() call, (t = u.astimezone()),
> it was made without a tzinfo parameter, and should result in t's
> timezeone being EST by the documentation.

No, u in my test case was selected to be right before the "fall-back" time.  
The clocks in New York are moved back at 2am local, or 6am UTC.  You can verify 
that with zdump:

$ zdump -v America/New_York | grep 2015 | grep Nov
America/New_York  Sun Nov  1 05:59:59 2015 UTC = Sun Nov  1 01:59:59 2015 EDT 
isdst=1
America/New_York  Sun Nov  1 06:00:00 2015 UTC = Sun Nov  1 01:00:00 2015 EST 
isdst=0

so 5am UTC is 1 hour before the transition and is correctly translated to EDT 
by astimezone().

--

___
Python tracker 

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



[issue26643] regrtest: rework libregrtest.save_env submodule

2016-03-25 Thread STINNER Victor

New submission from STINNER Victor:

(I pushed the change 245a16f33c4b, but Serhiy asked me to review it and discuss 
it. So I reverted my change and created this issue.)

I noticed many times that buildbots log "test xxx changed yyy" but this line is 
not enough to debug the issue. I propose to always display the old and new 
value to easy debugging these issues.

Sometimes, I try to reproduce the issue, but I fail to reproduce it locally. I 
may depend on the test execution order and the platform.

Attached patch changes:

* Replace get/restore methods with a Resource class and Resource subclasses
* Create ModuleAttr, ModuleAttrList and ModuleAttrDict helper classes
* Use __subclasses__() to get resource classes instead of using an hardcoded
  list (2 shutil resources were missinged in the list!)
* Don't define MultiprocessingProcessDangling resource if the multiprocessing 
module is missing
* Nicer diff for dictionaries. Useful for the big os.environ dict
* Reorder code to group resources


I chose to use classes to be able to easily customize how "Before/After" (value 
diff) is displayed: the new display_diff() method.

I also wrote helper classes to factorize the code.

Example:

def get_sys_path(self):
return id(sys.path), sys.path, sys.path[:]
def restore_sys_path(self, saved_path):
sys.path = saved_path[1]
sys.path[:] = saved_path[2]

becomes

   class SysPath(ModuleAttrList):
   name = 'sys.path'

When sys.path is modified, currently Python displays the whole (id, object, 
object_copy) tuple which is not easily readable. With my change, it only 
displays object_copy (one list).

I began to write a pretty diff for ModuleAttrList, but it looks non trivial, 
and I'm not sure that it's worth (since lists are quite short).

--
components: Tests
files: save_env.patch
keywords: patch
messages: 262449
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: regrtest: rework libregrtest.save_env submodule
versions: Python 3.6
Added file: http://bugs.python.org/file42293/save_env.patch

___
Python tracker 

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



[issue26591] datetime datetime.time to datetime.time comparison does nothing

2016-03-25 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Python 3.6.0a0 (default:245a16f33c4b, Mar 25 2016, 14:11:43)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> if datetime.time(22, 15) > datetime.time(16, 0):
... print('works for me')
...
works for me

--
resolution:  -> works for me
stage: test 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



[issue26629] Need an ability to build standard DLLs with distutils

2016-03-25 Thread Steve Dower

Steve Dower added the comment:

Oh, and just saw that you're apparently asking about 2.7. I was referring to 
the 3.5 sources for distutils, so some things may be different in 2.7. But I 
doubt distutils has changed that much since then.

--

___
Python tracker 

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



[issue26629] Need an ability to build standard DLLs with distutils

2016-03-25 Thread Steve Dower

Steve Dower added the comment:

(Obligatory recommendation that you use Cython rather than ctypes, especially 
if you're going to require your users to have a compiler handy - in general 
this isn't recommended on Windows at all; make sure you distribute wheels if 
you want to make your users' lives easiest.)

I haven't tested this, but I believe you want to specify your libraries with 
the `libraries` parameter, not the `extensions` parameter:

LIBRARIES = [
('my_lib', {'sources': ['my_lib.c'], 'include_dirs': ['dirs', 'if', 'you', 
'want'], 'macros': ['DEFINES', 'IF', 'YOU', 'WANT']})
]

setup(
...
libraries=LIBRARIES,
...
)

Then you need to ensure build_clib is run to produce it. I'd imagine that will 
just happen, but I could be wrong.

Again, I haven't tried this myself, but it seems to be the right way to build a 
regular library.

--

___
Python tracker 

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



[issue26631] Unable to install Python 3.5.1 on Windows 10 - Error 0x80070643: Failed to install MSI package.

2016-03-25 Thread Steve Dower

Steve Dower added the comment:

Thanks for the report

You should have another log file near the one you attached (in your 
%LocalAppData%\Temp directory) with "core_JustForMe" in the name. Could you put 
that one up as well?

--

___
Python tracker 

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



[issue26640] xmlrpc.server imports xmlrpc.client

2016-03-25 Thread Brett Cannon

Brett Cannon added the comment:

Yes because the location of the object is based on where it's defined, not 
where you got it from.

While I get the motivation to be a little cleaner in the xmlrpc package, 
"practicality beats purity" here in that the reorg isn't worth it at this point 
in the face of potentially breaking code for little benefit.

Closing as "wont fix"; sorry, Valentin.

--
nosy: +brett.cannon
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue26640] xmlrpc.server imports xmlrpc.client

2016-03-25 Thread ProgVal

ProgVal added the comment:

Even if xmlrpc.client imported them in its namespace?

--

___
Python tracker 

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



[issue26543] imaplib noop Debug

2016-03-25 Thread Maciej Szulik

Changes by Maciej Szulik :


--
nosy: +maciej.szulik

___
Python tracker 

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



[issue26636] SystemError while running tests: extra exception raised

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

I hope that the exception will help you to write better software (don't loose 
exceptions) ;-)

--
status: open -> closed

___
Python tracker 

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



[issue26636] SystemError while running tests: extra exception raised

2016-03-25 Thread Denis

Denis added the comment:

Thank you!  
The error  was that some calls in pycrypto code were aggregated and exceptions 
in those calls were ignored.
Here is the patch for pycrypto that fixed the build.

@@ -1427,7 +1429,9 @@ getStrongPrime (PyObject *self, PyObject *args, PyObject 
*kwargs)
Py_BLOCK_THREADS;
res = 1;
res &= getRandomRange (X, lower_bound, upper_bound, randfunc);
+   if (res!=0)
res &= getRandomNBitInteger (y[0], 101, randfunc);
+   if (res!=0)
res &= getRandomNBitInteger (y[1], 101, randfunc);
Py_UNBLOCK_THREADS;

So this code tried to aggregate exceptions before propagating them, that was 
the reason for exception.

--
resolution:  -> not a bug

___
Python tracker 

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



[issue19829] _pyio.BufferedReader and _pyio.TextIOWrapper destructor don't emit ResourceWarning if the file is not closed

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

Ok, I now understand the problem better. They are two kinds of io objects:

(1) object which directly or indirectly owns a limited resource like file 
descriptor => must emit a ResourceWarning
(2) object which don't own a limited resource => no ResourceWarning must be 
logged

Examples of (1): FileIO, BufferedReader(FileIO), 
TextIOWrapper(BufferedReader(FileIO))

Examples of (2): BytesIO, BuffereadReader(BytesIO), 
TextIOWrapper(BuffereadReader(BytesIO))


The tricky part is to decide if an object owns a limited resource or not. 
Currently, the io module uses the _dealloc_warn() trick. A close() method tries 
to call _dealloc_warn(), but it ignores any exception when calling 
_dealloc_warn(). BufferedReader calls raw._dealloc_warn(). TextIOWrapper calls 
buffer._dealloc_warn().


For case (1), BufferedReader(FileIO).close() calls FileIO._dealloc_warn() => 
ResourceWarning is logged

For case (2), BufferedReader(BytesIO).close() calls BytesIO._dealloc_warn() 
raises an AttributeError => no warning is logged


Well, we can call this a hack, but it works :-) pyio_res_warn-3.patch 
implements the same hack in _pyio.

--

___
Python tracker 

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



[issue19829] _pyio.BufferedReader and _pyio.TextIOWrapper destructor don't emit ResourceWarning if the file is not closed

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

> For io.BytesIO, I fixed the code to inherit correctly IOBase finalizer.

Oh, I forgot to include it in my patch. But it's maybe better to have it in a 
different patch: see attached bytesio_stringio.patch which changes also 
io.StringIO to inherit the IOBase finalizer.

Emitting a ResourceWarning in io.BytesIO and io.StringIO adds a *lot* of 
warnings when running the Python test suite. Since these objects only contain 
memory, no very limited resource like file descriptors, it's probably better to 
*not* log ResourceWarning for them.

--
Added file: http://bugs.python.org/file42292/bytesio_stringio.patch

___
Python tracker 

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



[issue19829] _pyio.BufferedReader and _pyio.TextIOWrapper destructor don't emit ResourceWarning if the file is not closed

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

> I think we should use one of Martin's option. If there are any issues with 
> garbage collecting, we should fix the garbage collector.

Ok, here is a new simpler proposition: remove all _dealloc_warn() method, and 
simply emit the ResourceWarning in IOBase finalizer.

With this change, all objects which inherit from io.IOBase (or _pyio.IOBase) 
now emits a ResourceWarning if they are not closed explicitly. You have to 
override the __del__() method to prevent this warning.

A lot of new objects start to log ResourceWarning: io.SocketIO, 
_pyio.TextIOWrapper, io.BytesIO, http.client.HTTPResponse, etc.

For io.BytesIO, I fixed the code to inherit correctly IOBase finalizer.

--

A lot of tests start to fail because they emit a lot of ResourceWarning 
warnings. I don't know yet if it's a feature or a bug :-)

--

With the patch, Python starts to logs warnings like:

sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='' 
mode='w' encoding='UTF-8'>
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='' 
mode='r' encoding='UTF-8'>

You can use my patch of the issue #26642 to fix these warnings.

ResourceWarning is emited even if FileIO.closefd is false.

Note: It looks like the ResourceWarning is not always displayed. Yet another 
bug?

--
Added file: http://bugs.python.org/file42291/iobase_finalizer.patch

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

> Lets open new issue for this.

I opened the issue #26642 "Replace stdout and stderr with simple standard 
printers at Python exit".

--

___
Python tracker 

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



[issue26642] Replace stdout and stderr with simple standard printers at Python exit

2016-03-25 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26642] Replace stdout and stderr with simple standard printers at Python exit

2016-03-25 Thread STINNER Victor

New submission from STINNER Victor:

The Python shutdown process is complex and fragile.

It was discussed in the issue #25654 to replace stdout and stderr with simple 
"standard printers" (implemented in C, don't depend on other Python objects or 
modules).

Attached patch implements this idea. The patch begins with closing standard 
stream objects (sys.stdin, sys.stdout, sys.stderr), and then replace stdout and 
stderr.

--
files: replace_stdio.patch
keywords: patch
messages: 262436
nosy: haypo
priority: normal
severity: normal
status: open
title: Replace stdout and stderr with simple standard printers at Python exit
versions: Python 3.6
Added file: http://bugs.python.org/file42290/replace_stdio.patch

___
Python tracker 

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



[issue23551] IDLE to provide menu link to PIP gui.

2016-03-25 Thread Aivar Annamaa

Changes by Aivar Annamaa :


--
nosy:  -Aivar.Annamaa

___
Python tracker 

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



[issue26640] xmlrpc.server imports xmlrpc.client

2016-03-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Moving public classes and functions to other module can break pickle 
compatibility.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



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

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

tracemalloc_track_fd.py: Proof-of-concept to track file descriptors using 
monkey-patching on os.open() and os.close(). It's just to show to the API can 
be used in Python, I don't think that it's very useful to track where file 
descriptors are allocated.

--
Added file: http://bugs.python.org/file42289/tracemalloc_track_fd.py

___
Python tracker 

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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

Okay, it looks like all issues have been fixed. The optimization for 
compact keys has been implemented. I didn't see any crash on buildbots 
recently, test_tracemalloc pass on all platforms.

Nathaniel asked how domains will be "allocated" or "registered", but I suggest 
to discuss that in the issue #26530.

I close this issue that was much more difficult to implement than I expected...

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

___
Python tracker 

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



[issue26640] xmlrpc.server imports xmlrpc.client

2016-03-25 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +loewis
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue20021] "modernize" makeopcodetargets.py

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

issue20021_2.diff looks good to me.

--

___
Python tracker 

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



[issue20021] "modernize" makeopcodetargets.py

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

> Victor went with a different solution in f682b620c64d.

Oh sorry, I wasn't aware of this old issue. My motivation was to get ride of 
the deprecated imp module, this script looks to be the latest part of the 
Python which uses the imp module (except of deliberate unit tests on the imp 
module).


> f682b620c64d looks incorrect to me. It makes makeopcodetargets.py to use the 
> opcode module of Python that executes the script. Instead the script should 
> use the opcode module from the same source tree as the script.

Ah, this was unclear to me. It looks overcomplicated code to just import a 
module. Can't we simply use import, but ensure that the running python 
executable belongs to the current source tree?

Or does it matter to be able to use an external python program?


> I think f682b620c64d should be reverted.

Don't hesitate to rework the code to importlib if you want to ensure that 
Lib/opcode.py is imported.

But please don't revert the whole change, I changed other things.

--

___
Python tracker 

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



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

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

I created the issue #26641 for doctest (test_doctest).

--

___
Python tracker 

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



[issue26641] doctest doesn't support packages

2016-03-25 Thread STINNER Victor

New submission from STINNER Victor:

The PEP 420 -- Implicit Namespace Packages introduces packages which have no 
__init__.py file and can be made of multiple packages. It looks like doctest 
doesn't support them.

I would like to convert the Lib/test/ of the Python standard library into such 
package for the issue #26295.

I propose to use an heuristic when the package is only made of one directory 
(when module.__path__ only contains one entry): use this directory to lookup 
for requested test files.

Attached patch implements that.

--
files: doctest_package.patch
keywords: patch
messages: 262429
nosy: brett.cannon, eric.snow, haypo, ncoghlan
priority: normal
severity: normal
status: open
title: doctest doesn't support packages
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file42288/doctest_package.patch

___
Python tracker 

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



[issue26641] doctest doesn't support packages

2016-03-25 Thread STINNER Victor

Changes by STINNER Victor :


--
components: +Library (Lib)

___
Python tracker 

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



[issue26640] xmlrpc.server imports xmlrpc.client

2016-03-25 Thread ProgVal

New submission from ProgVal:

from xmlrpc.client import Fault, dumps, loads, gzip_encode, gzip_decode

Shouldn't these class/functions be moved to a new module, with a name like 
xmlrpc.common?

--
components: Library (Lib)
messages: 262428
nosy: Valentin.Lorentz
priority: normal
severity: normal
status: open
title: xmlrpc.server imports xmlrpc.client
type: enhancement
versions: Python 3.4

___
Python tracker 

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



[issue20021] "modernize" makeopcodetargets.py

2016-03-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

f682b620c64d looks incorrect to me. It makes makeopcodetargets.py to use the 
opcode module of Python that executes the script. Instead the script should use 
the opcode module from the same source tree as the script.

I think f682b620c64d should be reverted.

--
priority: low -> high
resolution: out of date -> 
stage: resolved -> 
status: closed -> open

___
Python tracker 

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



[issue23551] IDLE to provide menu link to PIP gui.

2016-03-25 Thread Upendra Kumar

Upendra Kumar added the comment:

I had just one more idea after carefully going through all the options provided 
by pip. Other than the features suggested by Raymond, we should also provide 
option for installing using proxy settings.

Sometimes, configuring proxy can also be tricky while downloading. Can this be 
an additional feature? It can be easily implemented as pip provides --proxy 
option.

--

___
Python tracker 

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



[issue20021] "modernize" makeopcodetargets.py

2016-03-25 Thread Berker Peksag

Berker Peksag added the comment:

Victor went with a different solution in f682b620c64d.

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



[issue23551] IDLE to provide menu link to PIP gui.

2016-03-25 Thread Upendra Kumar

Upendra Kumar added the comment:

@Terry, I have tried to implement the treeview (as suggested by Alexander) and 
separate out the functions for retrieving data and displaying data. But, I have 
doubt on how to separate out the functions for getting data and displaying 
data. Further, I have changed the definition of 'runpip' function. I have used 
the subprocess module. Because of that few bugs are removed, but the speed of 
getting results from the pip command is slightly reduced.
Therefore, if you can get time to review my updated code, please tell me about 
possible improvements.

--
Added file: http://bugs.python.org/file42287/tem_pip_v3.py

___
Python tracker 

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



[issue26610] test_venv.test_with_pip() fails when ctypes is missing

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

I pushed a workaround to limit the number of failures on the  OpenIndiana 
buildbot. Feel free once pip runs without ctypes and pip is updated in CPython.

--

___
Python tracker 

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



[issue26610] test_venv.test_with_pip() fails when ctypes is missing

2016-03-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cd7cb503ab67 by Victor Stinner in branch 'default':
Skip test_venv.test_with_pip() if ctypes miss
https://hg.python.org/cpython/rev/cd7cb503ab67

--
nosy: +python-dev

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Oops, I forgot to discuss the second part :-) You also added "sys.__stderr__ 
> = sys.stderr" in multiprocessing.

At the start of PyImport_Cleanup() sys.stdXXX is set to sys.__stdXXX__. If 
sys.stdXXX is not sys.__stdXXX__ and here is the last reference to the stream, 
this causes deallocating sys.stdXXX and emitting a resource warning. If set 
sys.__stdXXX__ to sys.stdXXX, deallocating the stream is deferred to the end of 
PyImport_Cleanup(). Other changes make PyImport_Cleanup() to close standard 
streams explicitly before deallocating, thus resource warning are not emitted.

This workaround is not needed if deallocating sys.stdin doesn't emit a resource 
warning (since it is opened with closefd=False). But it still may be needed in 
tests if apply proposed changes to PyImport_Cleanup(), since sys.stderr is set 
to a file opened with closefd=True.

--

___
Python tracker 

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



[issue26639] Tools/i18n/pygettext.py: replace deprecated imp module with importlib

2016-03-25 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch replaces the imp module with importlib in 
Tools/i18n/pygettext.py.

Please review carefully, it looks like the code getting the filename of a 
Python module is not tested by Lib/test/test_tools.py :-/

--
files: pygettext_imp.patch
keywords: patch
messages: 262420
nosy: brett.cannon, eric.snow, haypo, ncoghlan
priority: normal
severity: normal
status: open
title: Tools/i18n/pygettext.py: replace deprecated imp module with importlib
versions: Python 3.6
Added file: http://bugs.python.org/file42286/pygettext_imp.patch

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy:
> Lets open new issue for this.

I agree with PyImport_Cleanup() deserves a dedicated issue.

Myself:
> This change has two parts.

Oops, I forgot to discuss the second part :-) You also added "sys.__stderr__ = 
sys.stderr" in multiprocessing.

I don't understand this change. Can you please explain why you want to do that?

Above, you wrote "A workaround is to set sys.__stdin__ as well as sys.stdin."

Is "sys.__stderr__ = sys.stderr" also a workaround?

--

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Lets open new issue for this.

--

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

ASCII/backslashescape is maybe a better encoding for this printer.

--

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

By the way, I'm not sure that using UTF-8/backslashescape is the
encoding :-/ It's common to use Latin1 on a terminal. UTF-8 is very
rare on Windows for the console for example.

--

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

> I don't know. I don't know why OSError and ValueError are caught at all.

Ha ha, me neither. Maybe it's time to remove them an wait for user feedback :-)

> What are you think about deterministic closing standard streams in 
> cleanup_std_streams.patch? There is no haste to commit this.

This change has two parts.

For the "stdout.flush() ... stdout.close() ... stdout = None" part:

* It looks like a good idea to set stout (and stderr) to None, since I see many 
C code having an explicit "stream is None" check (handle correctly this case).
* For the flush part: I would prefer to share code with pylifecycle.c, 
flush_std_files(). Maybe we can log flush error into the C stderr stream? 
(Maybe with a flag when we know that Python finalization has started, or check 
_Py_Finalizing?)
* For the close part: I don't know. I like the idea of being able to use print 
until the last Python instruction.

Instead of closing and setting stdout/stderr to None, what do you think of 
using something similar than Py_Initialize():

/* Set up a preliminary stderr printer until we have enough
   infrastructure for the io module in place. */
pstderr = PyFile_NewStdPrinter(fileno(stderr));
if (pstderr == NULL)
Py_FatalError("Py_Initialize: can't set preliminary stderr");
_PySys_SetObjectId(_stderr, pstderr);
PySys_SetObject("__stderr__", pstderr);
Py_DECREF(pstderr);

This printer has limitations, but it can help to get very late messages during 
Python finalization.

If we use this printer, it reduces the pressure on the exact order of 
operations.

--

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> What do you think? Is it better to keep stdin if stdin.close() raises an 
> exception?

I don't know. I don't know why OSError and ValueError are caught at all.

What are you think about deterministic closing standard streams in 
leanup_std_streams.patch? There is no haste to commit this.

--

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

> The change should be backported to Python 3.5. I'm waiting for buildbots and 
> I have to read again the change later.

Oh, I didn't notice that 3.5 buildbots were also all red. So I
backported the fix immediatly.

--

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 357d1ed928fe by Victor Stinner in branch '3.5':
Issue #25654:
https://hg.python.org/cpython/rev/357d1ed928fe

--

___
Python tracker 

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



[issue21925] ResourceWarning sometimes doesn't display

2016-03-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f474898ef6de by Victor Stinner in branch '3.5':
Issue #21925: Fix test_warnings for release mode
https://hg.python.org/cpython/rev/f474898ef6de

--

___
Python tracker 

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



[issue26161] Use Py_uintptr_t instead of void* for atomic pointers

2016-03-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b1666037c97e by Victor Stinner in branch '3.5':
Use Py_uintptr_t for atomic pointers
https://hg.python.org/cpython/rev/b1666037c97e

--

___
Python tracker 

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



[issue25951] SSLSocket.sendall() does not return None on success like socket.sendall()

2016-03-25 Thread Aviv Palivoda

Aviv Palivoda added the comment:

Thanks for the review.
I don't have any use cases for this change. I just saw this issue while looking 
for something else and thought I will give it a try.

--
Added file: http://bugs.python.org/file42285/25951-2.patch

___
Python tracker 

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



[issue21925] ResourceWarning sometimes doesn't display

2016-03-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 307ba4afd0a6 by Victor Stinner in branch 'default':
Issue #21925: Fix test_warnings for release mode
https://hg.python.org/cpython/rev/307ba4afd0a6

--

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

I pushed a change based on multiprocessing_no_close_fd.patch. I changed 
multiprocessing.util._close_stdin() to try to replace sys.stdin with os.devnull 
even if stdin.close() raised an exception. Since stdin is read-only, I don't 
expect an exception on stdin.close(), but it's just in case :-) What do you 
think? Is it better to keep stdin if stdin.close() raises an exception?

I hate having to push changes without careful review. I wanted to fix buildbots 
as soon as possible. I'm working hard since 1 week to fix all random bugs on 
buildbots, so it's annoying when *all* buildbots are red :-/

I will read again the change later, but IMHO the approach is the good one. 
Python initialization also creates files (stdin, stdout, stderr) with 
closefd=False.

The change should be backported to Python 3.5. I'm waiting for buildbots and I 
have to read again the change later.

Note: It looks like all ResourceWarning of unit tests are now fixed. The 
following change succeed:

./python -Werror -m test -j0 test_multiprocessing_fork.py 
test_multiprocessing_forkserver.py test_multiprocessing_spawn.py 
test_multiprocessing_main_handling.py

--

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-03-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9faa03e9cea8 by Victor Stinner in branch 'default':
Issue #25654:
https://hg.python.org/cpython/rev/9faa03e9cea8

--
nosy: +python-dev

___
Python tracker 

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



[issue26637] importlib: better error message when import fail during Python shutdown

2016-03-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e2c482b60776 by Victor Stinner in branch 'default':
Issue #26637: Fix test_io
https://hg.python.org/cpython/rev/e2c482b60776

--

___
Python tracker 

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



[issue23551] IDLE to provide menu link to PIP gui.

2016-03-25 Thread Eric Khoo Jiun Hooi

Eric Khoo Jiun Hooi added the comment:

One more thing, window should be able to install package with pip. So, why the 
need of http://www.lfd.uci.edu/~gohlke/pythonlibs/ ?

--
Added file: http://bugs.python.org/file42284/Design reference from pycharm.png

___
Python tracker 

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



[issue23551] IDLE to provide menu link to PIP gui.

2016-03-25 Thread Eric Khoo Jiun Hooi

Eric Khoo Jiun Hooi added the comment:

Terry, now I have done two more mockup for the installed package tab which is 
referenced from your suggestion and belopolsky's suggestion. Which you do 
you prefer? About the http://www.lfd.uci.edu/~gohlke/pythonlibs/ repo that you 
suggested to be added inside, I have done some research about that and it seem 
like pip install --index-url can only search from something like this website 
https://pypi.python.org/simple/ format. So, I think maybe I have to parse the 
package from ttp://www.lfd.uci.edu/~gohlke/pythonlibs/, but without 
description. Is it ok?

--
Added file: http://bugs.python.org/file42283/Design suggested by Terry.png

___
Python tracker 

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