[issue10808] ssl unwrap fails with Error 0

2016-05-09 Thread Hans-Peter Jansen

Hans-Peter Jansen added the comment:

Poor old bug.

Just being bitten from it today, while trying to package pyftpdlib on the 
openSUSE build service, which creates a clean reproducible build environment 
for all packages, and testing fails.

Part of the game: openssl 1.0.1k, Python 2.7.8

https://build.opensuse.org/package/show/home:frispete:python/python-pyftpdlib

It happens reproducible for i586 only, but not for x86_64, with all the same 
versions, and not with a local (much faster) build host.

So it is smells like a timing problem.

[   97s] ERROR: test_nlst (test_functional_ssl.TestFtpListingCmdsTLSMixin)
[   97s] --
[   97s] Traceback (most recent call last):
[   97s]   File 
"/home/abuild/rpmbuild/BUILD/pyftpdlib-1.5.1/pyftpdlib/test/test_functional_ssl.py",
 line 139, in test_nlst
[   97s] super(TestFtpListingCmdsTLSMixin, self).test_nlst()
[   97s]   File 
"/home/abuild/.local/lib/python2.7/site-packages/pyftpdlib-1.5.1-py2.7.egg/pyftpdlib/test/test_functional.py",
 line 1187, in test_nlst
[   97s] self._test_listing_cmds('nlst')
[   97s]   File 
"/home/abuild/.local/lib/python2.7/site-packages/pyftpdlib-1.5.1-py2.7.egg/pyftpdlib/test/test_functional.py",
 line 1180, in _test_listing_cmds
[   97s] self.client.retrlines('%s %s' % (cmd, tempdir), x.append)
[   97s]   File "/usr/lib/python2.7/ftplib.py", line 735, in retrlines
[   97s] conn.unwrap()
[   97s]   File "/usr/lib/python2.7/ssl.py", line 289, in unwrap
[   97s] s = self._sslobj.shutdown()
[   97s] error: [Errno 0] Error

--
nosy: +frispete

___
Python tracker 

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



[issue26974] Crash in Decimal.from_float

2016-05-09 Thread Mark Dickinson

Mark Dickinson added the comment:

[Serhiy, on the second patch]
> Disadvantages are that this changes behavior ignoring overriding 
> as_integer_ratio() and __abs__() and slightly slows down Python 
> implementation.

None of those seem like big issues to me. Certainly we shouldn't care too much 
about slowing down the Python implementation a bit more, and I think it's 
reasonable to say that code that's overriding as_integer_ratio (or `__abs__`) 
and then expecting that override to be picked up and used in 
`Decimal.from_float` is on its own.

> Advantages are that this fixes also issue26975 and slightly speeds up C 
> implementation.

Sounds pretty good to me!

I'll let Stefan review the patch properly, but this seems like a good solution 
to me.

--

___
Python tracker 

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



[issue23213] subprocess communicate() hangs when stderr isn't closed

2016-05-09 Thread Thomas D.

Thomas D. added the comment:

Yep, I agree with you. This can be closed.

Thanks to your clarification the problem could be resolved upstream.

The udev problem was resolved in https://github.com/systemd/systemd/issues/190 
and the PHP problem has a pending PR https://github.com/php/php-src/pull/1432

--
status: pending -> closed

___
Python tracker 

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



[issue26673] Tkinter error when opening IDLE configuration menu (Tcl/Tk 8.6)

2016-05-09 Thread Matthias Klose

Matthias Klose added the comment:

Seen on Debian and Ubuntu as well. All these distros have in common to use 
Tcl/Tk 8.6.

--
nosy: +doko
title: Tkinter error when opening IDLE configuration menu -> Tkinter error when 
opening IDLE configuration menu (Tcl/Tk 8.6)

___
Python tracker 

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



[issue26673] Tkinter error when opening IDLE configuration menu (Tcl/Tk 8.6)

2016-05-09 Thread Matthias Klose

Matthias Klose added the comment:

using this as a work-around, not tested with Tcl/Tk 8.5 or older.

--- a/Lib/idlelib/configDialog.py
+++ b/Lib/idlelib/configDialog.py
@@ -113,7 +113,11 @@ class ConfigDialog(Toplevel):
 
 def CreatePageFontTab(self):
 parent = self.parent
-self.fontSize = StringVar(parent)
+# see issue #26673
+if TkVersion >= 8.6:
+self.fontSize = IntVar(parent)
+else:
+self.fontSize = StringVar(parent)
 self.fontBold = BooleanVar(parent)
 self.fontName = StringVar(parent)
 self.spaceNum = IntVar(parent)

--

___
Python tracker 

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



[issue18531] Undocumented different between METH_KEYWORDS and **kws

2016-05-09 Thread Eric V. Smith

Eric V. Smith added the comment:

Oops, sorry. I'm an idiot. I was running in a venv where python was python3. 
Checking with my installed 2.7.10, I see the expected error.

--

___
Python tracker 

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



[issue16113] Add SHA-3 and SHAKE (Keccak) support

2016-05-09 Thread englabenny

Changes by englabenny :


--
nosy:  -englabenny

___
Python tracker 

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



[issue26983] float() can return not exact float instance

2016-05-09 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

The float constructor can return an instance of float subclass.

>>> class FloatSubclass(float):
... pass
... 
>>> class BadFloat:
... def __float__(self):
... return FloatSubclass(1.2)
... 
>>> type(float(BadFloat()))


Comparing with other types, complex() always returns complex:

>>> class ComplexSubclass(complex):
... pass
... 
>>> class BadComplex:
... def __complex__(self):
... return ComplexSubclass(1.2, 3.4)
... 
>>> type(complex(BadComplex()))


And int() can return an instance of int subclass, but this behavior is 
deprecated:

>>> class BadInt:
... def __int__(self):
... return True
... 
>>> int(BadInt())
__main__:1: DeprecationWarning: __int__ returned non-int (type bool).  The 
ability to return an instance of a strict subclass of int is deprecated, and 
may be removed in a future version of Python.
True

May be we should either deprecate __float__ returning non-float (as for int), 
or convert the result to exact float (as for complex).

The constructor of float subclass always returns an instance of correct type.

>>> class FloatSubclass2(float):
... pass
... 
>>> type(FloatSubclass2(BadFloat()))


--
components: Interpreter Core
messages: 265191
nosy: mark.dickinson, serhiy.storchaka
priority: normal
severity: normal
status: open
title: float() can return not exact float instance
type: behavior
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



[issue26974] Crash in Decimal.from_float

2016-05-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Actually the part of the second patch for Python implementation not always 
works correctly due to a bug (issue26983). We should either first fix 
issue26983 or use more complicated code.

--

___
Python tracker 

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



[issue26870] Unexpected call to readline's add_history in call_readline

2016-05-09 Thread Meador Inge

Meador Inge added the comment:

Works fine on Darwin (OS X Yosemite 10.10.5):

drago:cpython meadori$ uname -a
Darwin drago 14.5.0 Darwin Kernel Version 14.5.0: Mon Jan 11 18:48:35 PST 2016; 
root:xnu-2782.50.2~1/RELEASE_X86_64 x86_64

--
nosy: +meador.inge

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-05-09 Thread Michael Felt

Michael Felt added the comment:

New patch of the Lib/ctypes directory - BUT - this time as a delta based on 
3.5.0.

++ changes from last patch ++
* OSError gets raised (as expected) by test/test_loading.py
* test in util.py modified (libm is replaced by libc when "aix"), and
added an additional test for AIX (showing it finds the latest version
of libintl that is installed (frequently, there are two versions)
* moved RTLD_NOW and RTLD_MEMBER definitions to the "aix" blocks in __init__.py
* in test/test_loading.py added two more libraries to look for

--
Added file: http://bugs.python.org/file42789/python.Lib.ctypes.160509.patch

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-05-09 Thread Michael Felt

Michael Felt added the comment:

New version of aixutil.py

++ Changes ++
* more comments
* re-worked the 'searches' for matches after adding changing the way
the output from _get_dumpH was read (now to an array using readlines).
Also, p.stdout.close() and p.wait() are done within the _get_dumpH routine.

Suggestions on how to have cleaner workings with the 'arrays of text' and 
searching through them is welcomed! It is passing the internal tests is all I 
will say for now.

--
versions: +Python 3.5
Added file: http://bugs.python.org/file42790/aixutil.py

___
Python tracker 

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



[issue26984] int() can return not exact int instance

2016-05-09 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

The int constructor can return an instance of int subclass.

>>> class BadTrunc:
... def __trunc__(self):
... return True
... 
>>> int(BadTrunc())
True

When __int__ returns non-exact int, at least a warning is emitted:

>>> class BadInt:
... def __int__(self):
... return True
... 
>>> int(BadInt())
__main__:1: DeprecationWarning: __int__ returned non-int (type bool).  The 
ability to return an instance of a strict subclass of int is deprecated, and 
may be removed in a future version of Python.
True

The constructor of int subclass always return an instance of correct type:

>>> class IntSubclass(int):
... pass
... 
>>> type(IntSubclass(BadTrunc()))

>>> type(IntSubclass(BadInt()))
__main__:1: DeprecationWarning: __int__ returned non-int (type bool).  The 
ability to return an instance of a strict subclass of int is deprecated, and 
may be removed in a future version of Python.


I don't know if it is worth to deprecate __trunc__ returning non-exact int, 
since this special method is used in math.trunc(). But I think that the int 
constructor should convert its result to exact int. If some preparatory period 
is needed, it can first start to emit FutureWarning.

--
components: Interpreter Core
messages: 265196
nosy: mark.dickinson, serhiy.storchaka
priority: normal
severity: normal
status: open
title: int() can return not exact int instance
type: behavior
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



[issue26985] Information about CodeType in inspect documentation is outdated

2016-05-09 Thread Xiang Zhang

New submission from Xiang Zhang:

Information about CodeType in inspect documentation is outdated. It lacks 
attributes: co_kwonlyargcount, co_freevars, co_cellvars. And co_flags lacks 
many more options. These also apply to the comments of inspect.iscode source 
code.

--
assignee: docs@python
components: Documentation
messages: 265197
nosy: docs@python, xiang.zhang
priority: normal
severity: normal
status: open
title: Information about CodeType in inspect documentation is outdated
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



[issue26632] __all__ decorator

2016-05-09 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Here's a standalone version for older Python 3's:

http://public.readthedocs.io/en/latest/
https://pypi.python.org/pypi/atpublic

--

___
Python tracker 

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



[issue26969] ascynio should provide a policy to address pass-loop-everywhere problem

2016-05-09 Thread Ilya Kulakov

Ilya Kulakov added the comment:

> You don't know what else that coroutine is waiting for, and it may be waiting 
> for some I/O whose socket is registered with the other event loop. Since the 
> other event loop won't make progress, you'd be deadlocked.

As an end user I know what my coroutines may be waiting for. It's out of 
question to expect an ability to reuse coroutine and its associated context in 
multiple loops.

> PS. If you have something you sometimes want to run synchronously and 
> sometimes as a coroutine, you probably need to refactor it somehow.

We have a service that is responsible for reporting various stages about our 
application's lifetime. Most of the time app does not care about when (and 
whether) data will be actually sent, so we run this service in its own thread, 
the rest of the app just schedules coroutines in its event loop (hidden and 
managed by service's API). However sometimes it does care and moreover needs to 
do that synchronously (i.e. when we handle fatal / unhandled exception. In 
order to reuse remaining code that constructs coroutines, in the place of 
invocation we create a temporary event loop and use run_until_complete.

This is all practical problem. The conceptual problem is that current API is 
not flexible enough to create an event policy that would do something more 
useful that changing default type of an event loop.

Having the ability to get currently running event loop from within executing 
coroutine sounds pretty convenient and in my opinion would greatly reduce the 
amount of passing loops everywhere for end users (library developery, 
unfortunately, have no chance to avoid this).

--

___
Python tracker 

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



[issue26969] ascynio should provide a policy to address pass-loop-everywhere problem

2016-05-09 Thread Guido van Rossum

Guido van Rossum added the comment:

Instead of starting a new event loop, you should figure out a way to wait
for an event in the existing loop. IIUC that loop runs in a different
thread -- I think you can solve this by using a threading.Event that you
set from a wrapper coroutine running in your event loop and waited for in
the main loop. (If you're worried about blocking the event loop just to
acquire the threading lock that's part of threading.Event, you can use
run_in_executor().

Good luck!

--

___
Python tracker 

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



[issue26986] Enhance PyFunction_New documentation

2016-05-09 Thread Xiang Zhang

New submission from Xiang Zhang:

Doc of PyFunction_New[1] is not perfect. 

1. *__module__* is not retrieved from *code* but *globals*.
2. Add descriptions for annotations and qualname.

[1] https://docs.python.org/3/c-api/function.html#c.PyFunction_New

--
files: PyFunction_New_doc.patch
keywords: patch
messages: 265201
nosy: xiang.zhang
priority: normal
severity: normal
status: open
title: Enhance PyFunction_New documentation
Added file: http://bugs.python.org/file42791/PyFunction_New_doc.patch

___
Python tracker 

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



[issue26986] Enhance PyFunction_New documentation

2016-05-09 Thread Xiang Zhang

Changes by Xiang Zhang :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

___
Python tracker 

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



[issue26969] ascynio should provide a policy to address pass-loop-everywhere problem

2016-05-09 Thread Ilya Kulakov

Ilya Kulakov added the comment:

> If you're worried about blocking the event loop just to acquire the threading 
> lock that's part of threading.Event, you can use run_in_executor()

I'm more worried to delay invocation of a "synchronous" report because of 
outstanding tasks in event loop's queue. Given my situtation, that may not even 
happen because outstanding tasks may stop the loop by raising their own 
exceptions.

I'm willing to sacrifice them (i.e. I'm ok with not sending them) in order to 
send information about exception "for sure".

--

___
Python tracker 

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



[issue26673] Tkinter error when opening IDLE configuration menu (Tcl/Tk 8.6)

2016-05-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Mark, changing the default font from Courier to TkFixedFont has introduced or 
exposed a bug in any of IDLE, tkinter, or tk 8.6.4 on Linux.  The result is 
that trying to open the configuration menu fails with TclError.  What do your 
think is the best solution?

Mathias, it seems to me that fontsize should alsways be an Intvar.  I have no 
idea why StringVar is used, except possibly as a workaround when the code was 
written.

--
nosy: +markroseman

___
Python tracker 

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



[issue26673] Tkinter error when opening IDLE configuration menu (Tcl/Tk 8.6)

2016-05-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Anyone seeing problem: In /Lib/idlelib/configHandler.py, about line 685, in "if 
size < 0:", change '<' to '<='.  Remove the workaround of overriding 
'TkFixedFont' with 'courier'.  Does this fix the problem?

--

___
Python tracker 

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



[issue24745] Better default font for editor

2016-05-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This change caused a regression on Linux with 8.6.4 because TkFixedFont ends up 
with size = 0.  Cannot open configuration file.  See #26673.

--

___
Python tracker 

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



[issue26903] ProcessPoolExecutor(max_workers=64) crashes on Windows

2016-05-09 Thread Steve Dower

Steve Dower added the comment:

> Some quick Googling strongly suggests there's no reasonably general way to 
> overcome the Windows-defined MAXIMUM_WAIT_OBJECTS=64 for implementations that 
> call the Windows WaitForMultipleObjects().

The recommended way to deal with this is to spin up threads to do the wait 
(which sounds horribly inefficient, but threads on Windows are cheap, 
especially if they are waiting on kernel objects), and then wait on each thread.

Personally I think it'd be fine to make the _winapi module do that 
transparently for WaitForMultipleObjects, as it's complicated to get right (you 
need to ensure you map back to the original handle, timeouts and cancellation 
get complicated, there are real race conditions (mainly for auto-reset events), 
etc.), but in all circumstances it's better than just failing immediately. 
Handling it within multiprocessing isn't a bad idea, but won't help other users.

I'd love to write the code to do it, but I doubt I'll get time (especially 
since I'm missing the PyCon US sprints this year). Happy to help someone else 
through it. We're going to see Python being used on more and more multicore 
systems over time, where this will become a genuine issue.

--

___
Python tracker 

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



[issue26903] ProcessPoolExecutor(max_workers=64) crashes on Windows

2016-05-09 Thread Steve Dower

Changes by Steve Dower :


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



[issue26632] __all__ decorator

2016-05-09 Thread Ethan Furman

Ethan Furman added the comment:

For the standalone version I suggest a disclaimer about the `from ... import *` 
ability.  Something like:

`from ... import *` should not be used with packages that do not have an 
__all__ unless they support that usage (check their docs).

--

___
Python tracker 

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



[issue26987] Comment/implementation disagreement in Thread._bootstrap_inner

2016-05-09 Thread Zachary Ware

New submission from Zachary Ware:

The comment at Lib/threading.py:925 notes that sys.stderr should be used if 
possible, but the implementation uses self._stderr in spite of checking 
_sys.stderr is not None.  I believe this was just an oversight in 644b677c2ae5, 
which added the check and also switched from _sys.stderr.write(...) to 
print(... file=...).

--
components: Library (Lib)
messages: 265208
nosy: serhiy.storchaka, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Comment/implementation disagreement in Thread._bootstrap_inner
type: behavior
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



[issue24185] Add Function for Sending File to Trash (or Recycling Bin)

2016-05-09 Thread Stephen Paul Chappell

Changes by Stephen Paul Chappell :


--
nosy: +Zero

___
Python tracker 

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



[issue26987] Comment/implementation disagreement in Thread._bootstrap_inner

2016-05-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Good catch! Yes, this is just my mistake. Could you please fix this? I can't 
commit right now.

--

___
Python tracker 

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



[issue26984] int() can return not exact int instance

2016-05-09 Thread Mark Dickinson

Mark Dickinson added the comment:

> But I think that the int constructor should convert its result to exact int.

Agreed. See also issue 17576 and previous discussions on python-dev (thread 
started in March, but most of the messages in April):

- https://mail.python.org/pipermail/python-dev/2013-March/125022.html
- https://mail.python.org/pipermail/python-dev/2013-April/125042.html

I don't have strong feelings about `__trunc__` (or `__floor__` and `__ceil__`); 
it seems fine to me for those to be returning something other than a strict int.

--

___
Python tracker 

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



[issue26632] __all__ decorator

2016-05-09 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On May 09, 2016, at 04:19 PM, Ethan Furman wrote:

>`from ... import *` should not be used with packages that do not have an
>__all__ unless they support that usage (check their docs).

Good idea; I added a warning-ish.

--

___
Python tracker 

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



[issue26987] Comment/implementation disagreement in Thread._bootstrap_inner

2016-05-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8842c02c02a2 by Zachary Ware in branch '3.5':
Issue #26987: Correct implementation to match comment
https://hg.python.org/cpython/rev/8842c02c02a2

New changeset 694dadd9f7bd by Zachary Ware in branch 'default':
Closes #26987: Merge with 3.5
https://hg.python.org/cpython/rev/694dadd9f7bd

--
nosy: +python-dev
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



[issue26814] [WIP] Add a new _PyObject_FastCall() function which avoids the creation of a tuple or dict for arguments

2016-05-09 Thread Jakub Stasiak

Changes by Jakub Stasiak :


--
nosy: +jstasiak

___
Python tracker 

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



[issue23507] Tuple creation is too slow

2016-05-09 Thread Jakub Stasiak

Changes by Jakub Stasiak :


--
nosy: +jstasiak

___
Python tracker 

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



[issue6338] Error message displayed on stderr when no C compiler is present with ctypes

2016-05-09 Thread Meador Inge

Changes by Meador Inge :


--
nosy: +meador.inge

___
Python tracker 

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



[issue26746] struct.pack(): trailing padding bytes on x64

2016-05-09 Thread Meador Inge

Meador Inge added the comment:

I'm not to crazy about the trailing padding syntax either.  The behavior is 
documented all the way back to Python 2.6.  So, I would be hesitant to change 
it now.

If the new 'T{...}' struct syntax from issue3132 ever gets added, then maybe we 
could address this there?

FWIW, internal and trailing padding is implementation defined by the C 
standard.  That being said, most compilers I have worked with add the trailing 
padding.

--
nosy: +meador.inge

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-05-09 Thread John Hagen

New submission from John Hagen:

I suggest that the AutoNumberedEnum be added to the standard library for the 
following reasons:

1) Provides a fundamental tool for defining a unique, abstract set of coupled 
members
2) Avoids boilerplate @enum.unique for a very common use case of enumerations
3) The code already exists in the Python documentation, so it has been vetted 
at some level

The AutoNumberedEnum also allows the developer to make a clearer distinction
between enumerations whose values have special meaning and those that do not.

Consider:

@enum.unique
class Color(enum.Enum):
red = 1
blue = 2
green = 3

@enum.unique
class Shape(enum.Enum):
"""Member values denote number of sides."""
circle = 1
triangle = 3
square = 4

With AutoNumberedEnum it's possible to better express the intent that 
the value of Color members does not hold special meaning, while
Shape members do:

class Color(enum.AutoNumberedEnum):
red = ()
blue = ()
green = ()

@enum.unique
class Shape(enum.Enum):
"""Member values denote number of sides."""
circle = 1
triangle = 3
square = 4

For enumerations with many members (10s), there becomes a maintenance
issue when inserting new enumerations into the list:

@enum.unique
class Color(enum.Enum):
aquamarine = 1
blue = 2
fushia = 3
# inserting a member here (perhaps because it's clearest to keep these in 
alphabetic order)
# results in having to increment all following members
...
green = 40
red = 41

Most other languages have support for naming enumerations
without explicitly declaring their values (albeit with 
specialized syntax that makes it cleaner):

C++: http://en.cppreference.com/w/cpp/language/enum
C#: https://msdn.microsoft.com/en-us/library/sbbt4032.aspx
Java: https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
Rust: https://doc.rust-lang.org/book/enums.html

Currently, a developer can copy the code from the Python docs into
his or her project, or add a dependency on aenum.  I would argue
that it belongs in the standard library.

If there are objections to it being too magical, I would argue
it's already spelled out in the docs, so it's being prescribed
as a solution already.  I think it should be very clear when you
derive from "AutoNumberedEnum" what is going on.

The code is very simple, so I would
hope maintenance would not be difficult.

--
components: Library (Lib)
messages: 265214
nosy: John Hagen, ethan.furman
priority: normal
severity: normal
status: open
title: Add AutoNumberedEnum to stdlib
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-05-09 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +barry, eli.bendersky

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-05-09 Thread Ethan Furman

Ethan Furman added the comment:

On the other hand, if you use aenum you can do:

class Color(AutoNumber):
red
green
blue

And isn't that better*?  ;)

* For those in danger of swallowing their tongue over the magic involved: The 
magic is turned off as soon as any descriptor is defined (property, function, 
etc.).

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-05-09 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Wow Ethan, that's quite interesting.  I'm not sure if I like it or not. :)

It's better than having to assign a dummy value to the enum items, and if we 
did require that, I'd suggest just throwing away the values for autonumbering.

But not having to specify any values at all is probably better, although it 
does look weird!

/me goes to look at the magic you're using...

--

___
Python tracker 

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



[issue26549] co_stacksize is calculated from unoptimized code

2016-05-09 Thread Meador Inge

Meador Inge added the comment:

Strictly speaking, the stack size is calculated *after* the peephole optimizer 
is run, but the code that computes the stack depth operates on the basic block 
graph instead of the assembled and optimized byte code.

Anyway, the conclusion is the same as Brett noted -- the stack depth analysis 
would need to be re-written to operate on the optimized bytecode array.

--
nosy: +meador.inge

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-05-09 Thread Ethan Furman

Ethan Furman added the comment:

It's in _EnumDict.__getitem__; there's some duplication in __setitem__ for 
supporting Python 2 (although with 2 you have to use either the empty tuple, or 
some other handy thing that may go in the __doc__ attribute, for example).

--

___
Python tracker 

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



[issue26989] error in installation of ez_setup.py

2016-05-09 Thread wangluyao

New submission from wangluyao:

There were some wrong in my installion of my ez_setup.py.Because my compute is 
64 bits,so I have to install ez_setup.py before I want to install 
pyserial-3.0.1-py2.py3-none-any.whl this model.
 But it tells me that"urllib2.URLError:"

--
components: Installation
files: QQ截图20160510101142.png
messages: 265219
nosy: wangluyao
priority: normal
severity: normal
status: open
title: error in installation of ez_setup.py
versions: Python 2.7
Added file: http://bugs.python.org/file42792/QQ截图20160510101142.png

___
Python tracker 

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



[issue26989] error in installation of ez_setup.py

2016-05-09 Thread Xiang Zhang

Xiang Zhang added the comment:

It seems pypi is blocked in China, :-( so try pypi mirror in China. ez_setup.py 
seems to have --download-base option to let you specify alternative URL. I 
don't think this is a bug.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue14209] pkgutil.iter_zipimport_modules ignores the prefix parameter for packages

2016-05-09 Thread Łukasz Langa

Łukasz Langa added the comment:

Brett, Facebook is using the proposed patch in prod since last year. It works 
fine. Maybe we should just include it for the time being?

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue14209] pkgutil.iter_zipimport_modules ignores the prefix parameter for packages

2016-05-09 Thread Brett Cannon

Brett Cannon added the comment:

I don't deal with pkgutil so I have no problem if you want to go ahead and 
apply the patch if you think it's reasonable to accept, Łukasz.

--

___
Python tracker 

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



[issue26985] Information about CodeType in inspect documentation is outdated

2016-05-09 Thread Xiang Zhang

Xiang Zhang added the comment:

Attach patch.

--
keywords: +patch
Added file: http://bugs.python.org/file42793/inspect_doc.patch

___
Python tracker 

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



[issue26990] file.tell affect decoding

2016-05-09 Thread mfmain

New submission from mfmain:

C:\tmp>hexdump badtell.txt

00: 61 20 6B 0D 0A D2 BB B0-E3   a k..

C:\tmp>type test.py

with open(r'c:\tmp\badtell.txt', "r", encoding='gbk') as f:
while True:
pos = f.tell()
line = f.readline();
if not line: break
print(line)

C:\tmp>python test.py

a k

Traceback (most recent call last):
  File "test.py", line 4, in 
line = f.readline();
UnicodeDecodeError: 'gbk' codec can't decode byte 0xd2 in position 0:  
incomplete multibyte sequence


When I remove f.tell() statement, it decoded successfully.
I tried python3.4/3.5 x64 on win7/win10, it is all the same.

--
components: Unicode
messages: 265224
nosy: ezio.melotti, haypo, mfmain
priority: normal
severity: normal
status: open
title: file.tell affect decoding
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



[issue26989] error in installation of ez_setup.py

2016-05-09 Thread Benjamin Peterson

Changes by Benjamin Peterson :


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

___
Python tracker 

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



[issue26986] Enhance PyFunction_New documentation

2016-05-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bfc4c57a0986 by Benjamin Peterson in branch '3.5':
improve PyFunction_New docs (closes #26986)
https://hg.python.org/cpython/rev/bfc4c57a0986

New changeset 71afeb15f617 by Benjamin Peterson in branch 'default':
merge 3.5 (#26986)
https://hg.python.org/cpython/rev/71afeb15f617

--
nosy: +python-dev
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