[issue26216] run runtktests.py error when test tkinter

2016-01-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is rather import machinery issue. The simple reproducer:

$ ./python -c "import importlib; importlib.import_module('.bar', 'foo')"
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/importlib/__init__.py", line 126, in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 981, in _gcd_import
  File "", line 931, in _sanity_check
SystemError: Parent module 'foo' not loaded, cannot perform relative import

SystemError means programming error and shouldn't be triggered by user code.

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

___
Python tracker 

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



[issue26168] Py_BuildValue may leak 'N' arguments on PyTuple_New failure

2016-01-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Rather rare reference leak is not the worst bug here.

Following example

const char *s = ...;
PyObject *b = PyBytes_New(...);
return PyBuildValue("(Ns)s", b, s, PyBytes_AS_STRING(b));

works if s is correct UTF-8 encoded string. But if it is not correct UTF-8 
encoded string, the first "s" is failed and the inner tuple is deallocated 
together with the borrowed reference to b. The second "s" then reads freed 
memory.

--
type: resource usage -> crash

___
Python tracker 

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



[issue23601] use small object allocator for dict key storage

2016-01-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

If there are no objects, I'll apply the patch tomorrow.

--
assignee:  -> rhettinger
versions: +Python 3.6 -Python 3.5

___
Python tracker 

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



[issue26240] Docstring of the subprocess module should be cleaned up

2016-01-29 Thread Martin Panter

Martin Panter added the comment:

IMO the doc strings should be reduced down so that it is a concise summary, and 
divided or merged into doc strings of each class, method, function. Less 
important details should be moved to the main RST documentation (if they aren’t 
already there).

Regarding list2cmdline(), see the comment next to __all__ in the source code, 
and Issue 11827. BTW modifying __all__ would not automatically affect what is 
written in the RST files, which is where the “official” HTML docs come from :)

--
nosy: +martin.panter
stage:  -> needs patch
versions: +Python 2.7, Python 3.6

___
Python tracker 

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



[issue4806] Function calls taking a generator as star argument can mask TypeErrors in the generator

2016-01-29 Thread Martin Panter

Martin Panter added the comment:

I think this is ready to push for Python 3. Python 2 might need an extra 
Py_TPFLAGS_HAVE_ITER check, perhaps reusing some code from the Issue 5218 patch.

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



[issue25924] investigate if getaddrinfo(3) on OSX is thread-safe

2016-01-29 Thread A. Jesse Jiryu Davis

A. Jesse Jiryu Davis added the comment:

I've created a Mac OS 10.4 virtual machine and reproduced the getaddrinfo 
concurrency bug there using the attached h_resolv.c. The man page on that OS 
version indeed includes the "not thread-safe" warning.

The same test passes on my Mac OS 10.10 system.

I am convinced that getaddrinfo is thread-safe on Mac OS 10.5+, and I'm 
attaching a patch to disable the lock on these systems.

--
keywords: +patch
Added file: 
http://bugs.python.org/file41755/25924-getaddrinfo-is-thread-safe.patch

___
Python tracker 

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



[issue26240] Docstring of the subprocess module should be cleaned up

2016-01-29 Thread Antony Lee

New submission from Antony Lee:

subprocess.__doc__ currently contains copies for the docstrings of a bunch of 
functions in the module (... but not subprocess.run).  The docs for the Popen 
class should be moved into that class' docstring.  The module's docstring also 
mentions the list2cmdline "method" (actually a function, and the qualifier 
"method"/"function" is missing the second time this function is mentioned ("The 
list2cmdline is designed ...")), but that function doesn't appear in `__all__` 
and thus not in the official HTML docs (yes, I know pydoc 
subprocess.list2cmdline works).

--
assignee: docs@python
components: Documentation
messages: 259238
nosy: Antony.Lee, docs@python
priority: normal
severity: normal
status: open
title: Docstring of the subprocess module should be cleaned up
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



[issue26225] New misleading wording in execution model documenation

2016-01-29 Thread Martin Panter

Martin Panter added the comment:

Calling exec() with only one argument is equivalent to exec(..., globals(), 
locals()). It does not create a new scope for names. So an equivalent of your 
three-level example is more like

>>> i = 'global'
>>> def f():
... i = 'nonlocal'
... class_locals = dict()
... exec("print(i)\ni = 'local'\nprint(i)\n", globals(), class_locals)
... 
>>> f()
global
local

If exec() worked like a function rather than a class, the first print(i) would 
trigger an UnboundLocalError instead:

>>> i = 'global'
>>> def f():
... i = 'nonlocal'
... def g():
... print(i)
... i = 'local'
... g()
... 
>>> f()
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 6, in f
  File "", line 4, in g
UnboundLocalError: local variable 'i' referenced before assignment

In your first exec() example, i='nonlocal' is passed to exec() via the default 
locals parameter, and the exec() uses that value rather than deferring to its 
globals. To be a free variable, “i” has to be used but not defined. Even if you 
dropped the “i = 'local' ” assignment, it is still defined via the implicit 
locals parameter.

Your proposal for “Interaction with dynamic features” sounds reasonable.

--
nosy: +martin.panter

___
Python tracker 

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



[issue26214] textwrap should minimize number of breaks in extra long words

2016-01-29 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
type: behavior -> enhancement
versions:  -Python 2.7

___
Python tracker 

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



[issue26216] run runtktests.py error when test tkinter

2016-01-29 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26218] Set PrependPath default to true

2016-01-29 Thread Steve Dower

Steve Dower added the comment:

Sorry, not happening.

There's a very prominent checkbox on the first page of the installer, which was 
added under protest.

I'd suggest learning the py.exe launcher instead, which does not suffer from 
any of the issues that are caused by modifying the global PATH variable.

--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue26209] TypeError in smtpd module with string arguments

2016-01-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am guessing that 25 is the default port.  Autoconversion of 'host' to 
('host', 25) would be a new feature ('enhancement') that would have to wait for 
the next Python version (3.6 or later).  Is there any precedent for this in any 
other module?

Does 2.7 act the same as 3.5?  A doc improvement could go there also.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue25924] investigate if getaddrinfo(3) on OSX is thread-safe

2016-01-29 Thread Guido van Rossum

Guido van Rossum added the comment:

Thanks for the thorough work! Hopefully we can apply this fix to 3.5, 3.6 and 
even 2.7.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue26235] argparse docs: Positional * argument in mutually exclusive group requires a default parameter

2016-01-29 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +bethard

___
Python tracker 

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



[issue26222] Missing code in linux_distribution python 2.7.11

2016-01-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

>From the last two comments, it looks like this should be closed as 'not a bug'.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue26218] Set PrependPath default to true

2016-01-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Are you are referring to the option in the Windows installer to prepend the 
currently-being-installed Python directory (and the scripts directory) to the 
system PATH variable?  Is so, making this the default has been proposed and 
rejected before.  Some developers think it a bad idea. In any case, the current 
choice is not a bug.

--
components: +Windows
nosy: +paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware
type: behavior -> enhancement

___
Python tracker 

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



[issue26234] The typing module includes 're' and 'io' in __all__

2016-01-29 Thread Martin Panter

Martin Panter added the comment:

The __alldoc__ is an interesting idea to think about. Anyway, I haven’t 
actually tried the typing module yet, so I will let you decide the best way 
forward.

--

___
Python tracker 

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



[issue26168] Py_BuildValue may leak 'N' arguments on PyTuple_New failure

2016-01-29 Thread Martin Panter

Martin Panter added the comment:

Left a review.

Squidevil: You say if do_mkvalue() fails, the N object is not released. But 
looking at the code, I think it gets stored in the tuple, and then the tuple is 
released: . 
So the only leak I can see is if the tuple construction fails.

Serhiy’s patch fixes do_mktuple(), but I think the same problem would affect 
do_mkdict() and do_mklist() as well.

--
nosy: +martin.panter

___
Python tracker 

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



[issue26212] Python with ncurses6.0 will not load _curses module on Solaris 10

2016-01-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The tracker is not a help forum.  It is for patching CPython.  You might do 
better to ask for help in python-list or Stackoverflow or elsewhere to try to 
determine whether you need to do something different or if the problem is with 
Solaris or if indeed CPython needs to be patched somewhere.

--
nosy: +jcea, terry.reedy

___
Python tracker 

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



[issue26205] Inconsistency concerning nested scopes

2016-01-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Would 'three or more' be any clearer than 'at least three'?  They mean the 
same, but the first seems better to me in this context.

The real problem with this section are a) the use of Guido's first person 'I' 
and b) statements that were not changed when nested scope were added, but 
should have been.

"If a name is declared global, then all references and assignments go directly 
to the middle scope containing the module’s global names."

The global scope is no longer the middle scope.  Roscoe pointed at this.  With 
that removed, the sentence says that if a name is declared global, assignments 
go to global scope.  This would be more meaningful if prefixed by a revised 
version of the following, which is several paragraphs down.

"A special quirk of Python is that – if no global statement is in effect – 
assignments to names always go into the innermost scope."

The special quirk part should go; 'global' would now have to be 'global or 
nonlocal', but I now think the following, preceeding the revised 'global' 
sentence above, would be better.

"By default, assignments to names always go into the innermost, local, 
namespace."

In other words, I think the sentence Roscoe flagged is the least of the 
problems with this section.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue25934] ICC compiler: ICC treats denormal floating point numbers as 0.0

2016-01-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 296fb7c10a7d by Zachary Ware in branch '2.7':
Issue #25934: Default to /fp:strict for ICC builds
https://hg.python.org/cpython/rev/296fb7c10a7d

New changeset 747b415e96c4 by Zachary Ware in branch '3.5':
Issue #25934: Default to /fp:strict for ICC builds
https://hg.python.org/cpython/rev/747b415e96c4

New changeset c080ef5989f7 by Zachary Ware in branch 'default':
Issue #25934: Merge with 3.5
https://hg.python.org/cpython/rev/c080ef5989f7

--

___
Python tracker 

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



[issue26195] Windows frozen .exe multiprocessing.Queue access is denied exception

2016-01-29 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +jnoller, sbt

___
Python tracker 

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



[issue26168] Py_BuildValue may leak 'N' arguments on PyTuple_New failure

2016-01-29 Thread squidevil

squidevil added the comment:

Martin Panter: You're right.  The DECREF on v when itemfailed will decref the N 
object and prevent the leak.  My original analysis was wrong on that count.

You're right, do_mklist and do_mkdict (in 2.7.11 at least) have similar 
problems, bailing after list or dict creation failure, without continuing to 
process the rest of the items.

--

___
Python tracker 

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



[issue26239] distutils link-objects is not normalized

2016-01-29 Thread Jeremy Fergason

New submission from Jeremy Fergason:

When giving setup.cfg a link-objects argument build fails with an error message 
about cannot concatenate string with list.  

Need to add the following line to: Lib/distutils/command/build_ext.py

self.ensure_string_list('link_objects')

See patch here:

https://github.com/jdfergason/cpython/compare/master...jdfergason-distutils-fix?quick_pull=1

--
components: Distutils
messages: 259223
nosy: dstufft, eric.araujo, jdfergason
priority: normal
severity: normal
status: open
title: distutils link-objects is not normalized
versions: Python 2.7

___
Python tracker 

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



[issue26229] Make number serialization ES6/V8 compatible

2016-01-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Eric: I suspect he's talking about section 7.1.12.1 of the 6th edition of 
ECMA-262; a PDF can be found here: 
http://www.ecma-international.org/ecma-262/6.0/ECMA-262.pdf. Clause 6 applies 
to this particular example:

"""
If k <= n <= 21, return the String consisting of the code units of the k digits 
of the decimal representation of s (in order, with no leading zeroes), followed 
by nk occurrences of the code unit 0x0030 (DIGIT ZERO).
"""

here 'k' is the number of significant digits in the shortest possible 
representation (i.e., the number of significant digits that Python's repr will 
use), and n is the "adjusted exponent" of the input (so k = 16 and n = 21 in 
this case, because 10**20 <= target_value < 10**21).

I'm not convinced of the importance / value of making Python's json 
implementation exactly correspond to that of Google's JS engine, though. For 
one thing, there's no spec: ECMA-262 isn't good enough, since (as noted in the 
spec), the least significant digit isn't necessarily defined by their 
requirements, so it's still perfectly possible for two JS implementations to 
both conform with the specification and still give different output strings.

--

___
Python tracker 

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



[issue26168] Py_BuildValue may leak 'N' arguments on PyTuple_New failure

2016-01-29 Thread squidevil

squidevil added the comment:

It looks like this patch is against the "default" cpython (3.x) branch.  The 
2.7 branch is missing the if(itemfailed) code in do_mktuple whose else clause 
was modified by the patch.

It looks like some of this needs to be backported to 2.7?

--

___
Python tracker 

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



[issue26229] Make number serialization ES6/V8 compatible

2016-01-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

That said, someone interested in this should probably voice their concerns 
towards the JCS standardizers, as the restrictions it imposes on number 
serialization are clearly an impediment to implementing their protocol.

--

___
Python tracker 

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



[issue26229] Make number serialization ES6/V8 compatible

2016-01-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Here's the relevant part of the JCS document, from Appendix A of 
https://cyberphone.github.io/openkeystore/resources/docs/jcs.html#ECMAScript_Compatibility_Mode:

"""
Numbers *must* be expressed as specified by EMCAScript [ES6] using the improved 
serialization algorithm featured in Google's V8 JavaScript engine [V8]. That 
is, in the ECMAScript compatibility mode there are no requirements saving the 
textual value of numbers. This also means that the JCS Sample Signature in 
incompatible with the ECMAScript mode since it uses unnormalized numbers.
"""

I think exactly matching Google's implementation is an unreasonable 
requirement, and I don't see any evidence that JCS usage is widespread enough 
to warrant making changes to the JSON float output format.

--

___
Python tracker 

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



[issue26229] Make number serialization ES6/V8 compatible

2016-01-29 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue23601] use small object allocator for dict key storage

2016-01-29 Thread Julian Taylor

Julian Taylor added the comment:

ping, this has been sitting for 4 years and two python releases. Its about time 
this stupidly simple thing gets merged.

--

___
Python tracker 

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



[issue26194] Undefined behavior for deque.insert() when len(d) == maxlen

2016-01-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

*All* reasons look reasonable.  May be discuss this on Python-Dev or ask BDFL?

>From my point it looks that correct implementation of the insertion is too 
>complex and this feature should go only in development release (if any).

--

___
Python tracker 

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



[issue19883] Integer overflow in zipimport.c

2016-01-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue26207] distutils msvccompiler fails due to mspdb140.dll error on debug builds

2016-01-29 Thread Steve Dower

Changes by Steve Dower :


--
title: test_distutils fails on "AMD64 Windows7 SP1 3.x" buildbot -> distutils 
msvccompiler fails due to mspdb140.dll error on debug builds

___
Python tracker 

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



[issue26180] multiprocessing.util._afterfork_registry leak in threaded environment

2016-01-29 Thread Nir Soffer

Changes by Nir Soffer :


--
nosy: +nirs

___
Python tracker 

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



[issue23601] use small object allocator for dict key storage

2016-01-29 Thread Tim Peters

Tim Peters added the comment:

+1 from me.  Julian, you have the patience of a saint ;-)

--

___
Python tracker 

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



[issue1475692] replacing obj.__dict__ with a subclass of dict

2016-01-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Python uses concrete class API (PyDict_GetItem and like) for resolving 
attributes. Using general mapping API would slow down attribute lookup in 
common case. This is performance critical part of Python and we should be very 
careful changing it.

On the other side, you still can have a benefit from using dict subclasses as 
__dict__. OrderedDict allows you to iterate dict in predefined order, and 
defaultdict allows you to create attributes with default values on demand (but 
__getattr__ is more universal method).

See also issue10977.

--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue26229] Make number serialization ES6/V8 compatible

2016-01-29 Thread Eric V. Smith

Eric V. Smith added the comment:

Do you have a pointer to the spec which requires -0 vs. 
-3.333e+20, for example?

--
nosy: +eric.smith

___
Python tracker 

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




[issue26155] 3.5.1 installer issue on Win 7 32 bit

2016-01-29 Thread Steve Dower

Steve Dower added the comment:

Looks like the log files were attached just fine.

>From a first glance, the logs don't show anything being installed into your 
>documents folder.

Could you list the files you are seeing, where they are and where you believe 
they should be?

--

___
Python tracker 

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



[issue1475692] replacing obj.__dict__ with a subclass of dict

2016-01-29 Thread Torsten Landschoff

Torsten Landschoff added the comment:

I just bumped into this issue because I was shown by a colleague that my 
implementation of immutable objects (by replacing __dict__ with an 
ImmutableDict that inherits from dict and blocks write accesses) is ineffective 
- ouch!

I'd expect that Python either rejects subclasses of dict for obj.__dict__ or 
actually implements accessing correctly. Especially since the enum module 
created the impression for me that replacing __dict__ is a viable approach 
(enum.py uses __prepare__ in the meta class to provide a different dict class 
for enum types, just found https://www.python.org/dev/peps/pep-3115/).

Interestingly the PEP 3115 example code notes the following:

# Note that we replace the classdict with a regular
# dict before passing it to the superclass, so that we
# don't continue to record member names after the class
# has been created.

--
nosy: +torsten

___
Python tracker 

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



[issue26039] More flexibility in zipfile interface

2016-01-29 Thread Thomas Kluyver

Thomas Kluyver added the comment:

Thanks Serhiy for review comments.

--
Added file: http://bugs.python.org/file41754/zipinfo-from-file4.patch

___
Python tracker 

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



[issue26227] Windows: socket.gethostbyaddr(name) fails for non-ASCII hostname

2016-01-29 Thread STINNER Victor

STINNER Victor added the comment:

He he, no problem. Thanks again for the bug report. I'm surprised that
nobody reported it before.

--

___
Python tracker 

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



[issue26125] Incorrect error message in the module asyncio.selector_events.

2016-01-29 Thread Guido van Rossum

Guido van Rossum added the comment:

Usually Yury or Victor takes care of this sooner or later. If you want
to you can keep this open as a release blocker with that as a task.

--

___
Python tracker 

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



[issue26039] More flexibility in zipfile interface

2016-01-29 Thread Thomas Kluyver

Thomas Kluyver added the comment:

Here's a new version of the zf.open() patch following Martin's review (thanks 
Martin!).

I agree that it feels a bit awkward having two completely different actions for 
zf.open(), but it is a familiar interface, and since the mode parameter is 
already there, it requires a minimum of new public API. But I'm happy to add a 
new method like open_write() or write_handle() if people prefer that.

The comments on the other patch are minimal, I'll put a new version of that 
together as well.

--
Added file: http://bugs.python.org/file41752/zipfile-open-w3.patch

___
Python tracker 

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



[issue23548] TypeError in event loop finalizer, new in Python 3.4.3

2016-01-29 Thread 山本泰宇

山本泰宇 added the comment:

> I may workaround the bug during Python finalization if more users report this 
> issue.

+1 in my project:
https://github.com/cybozu/passh/issues/1

Anyway, I'd like to express my gratitude to asyncio.

--
nosy: +山本泰宇

___
Python tracker 

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



[issue26227] Windows: socket.gethostbyaddr(name) fails for non-ASCII hostname

2016-01-29 Thread Emanuel Barry

Emanuel Barry added the comment:

For future reference, Victor's patch does fix it, I was checking the wrong 
thing when testing.

--

___
Python tracker 

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



[issue26238] httplib use wrong hostname in https request with SNI support

2016-01-29 Thread lirenke

New submission from lirenke:

httplib give openssl SNI extension message like IP:PORT string. 
the apache server would return 400 code if SNI/request ServerName mismatch.

In class HTTPSConnection, we hope call self._get_hostport() before give the 
value to server_hostname.

===
if self._tunnel_host:
server_hostname = self._tunnel_host
else:
server_hostname = self.host

self.sock = self._context.wrap_socket(self.sock,
  
server_hostname=server_hostname)

===

--
components: Library (Lib)
messages: 259207
nosy: lvhancy
priority: normal
severity: normal
status: open
title: httplib use wrong hostname in https request with SNI support
versions: Python 2.7

___
Python tracker 

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



[issue26039] More flexibility in zipfile interface

2016-01-29 Thread Thomas Kluyver

Changes by Thomas Kluyver :


Added file: http://bugs.python.org/file41753/zipinfo-from-file3.patch

___
Python tracker 

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



[issue26125] Incorrect error message in the module asyncio.selector_events.

2016-01-29 Thread Berker Peksag

Berker Peksag added the comment:

https://github.com/python/asyncio/pull/313 has been merged. Do we need to 
commit this patch to the CPython repo or will it be merged with the next sync? 
(e.g. f4fe55dd5659)

--
nosy: +berker.peksag

___
Python tracker 

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



[issue26237] UnboundLocalError error while handling exception

2016-01-29 Thread Марк Коренберг

New submission from Марк Коренберг:

This works right in Python 2.7, but fails in python3:

UnboundLocalError: local variable 'e' referenced before assignment


def test():
try:
raise Exception('a')
except Exception as e:
pass
else:
return
print(e)

test()

--
messages: 259201
nosy: mmarkk
priority: normal
severity: normal
status: open
title: UnboundLocalError error while handling exception
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue26237] UnboundLocalError error while handling exception

2016-01-29 Thread STINNER Victor

STINNER Victor added the comment:

Yes, it's a deliberate change in the Python language. You have to copy "e" to a 
different variable:

err = None
try:
  ...
except Exception as exc:
  err = exc
print(err)

--
nosy: +haypo
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



[issue25698] The copy_reg module becomes unexpectedly empty in test_cpickle

2016-01-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
priority: normal -> high
stage:  -> patch review

___
Python tracker 

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



[issue26168] Py_BuildValue may leak 'N' arguments on PyTuple_New failure

2016-01-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Current code already decref obj if creating previous argument is failed. But a 
leak if PyTuple_New() fails is possible.

Proposed patch fixes this leak and adds a test for the case when creating 
previous argument is failed. Testing the failure of PyTuple_New() is 
problematic.

--
assignee:  -> serhiy.storchaka
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file41751/pybuildvalue_leak.patch

___
Python tracker 

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



[issue26173] test_ssl.bad_cert_test() exception handling

2016-01-29 Thread Martin Panter

Martin Panter added the comment:

I was mistaken about what test_wrong_cert() is doing. It tells the _server_ to 
check the _client’s_ certificate (the opposite way around from HTTPS for 
example). Now I understand this, I see it is fine for the client to raise 
ECONNRESET if the server rejected its certificate.

In separate-test.patch, I decoupled test_wrong_cert() from the other three 
bad_cert_test() tests because they are testing different stuff. Changes to 
test_wrong_cert():

* Fix ResourceWarning in my previous change by closing the SSL socket
* Catch socket.error rather than OSError to fix the buildbot failures in 2.7 
(The change does nothing in Python 3 because they are aliases.)
* Make test_wrong_cert() stricter by only allowing ECONNRESET or SSLError

Changes to the other three tests:

* Moved them to BasicSocketTests and do not run a server
* Only accept SSLError from wrap_socket(), drop OSError handling and connect() 
call

--
Added file: http://bugs.python.org/file41749/separate-test.patch

___
Python tracker 

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



[issue25698] The copy_reg module becomes unexpectedly empty in test_cpickle

2016-01-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

One solution is to skip tests caused deep recursion.

The better solution would be to fix import machinery to not produce empty 
modules.

--
keywords: +patch
Added file: http://bugs.python.org/file41748/issue25698_skip_tests.patch

___
Python tracker 

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



[issue12912] xmlrpclib.__version__ not bumped with updates

2016-01-29 Thread Berker Peksag

Berker Peksag added the comment:

xmlrpc.client.__version__ is used by Transport.user_agent and it has been 
changed to use sys.version[:3] in 197d703fb23e. It's too late for 2.7 so I 
think this can be closed now.

Thanks for the report, Rob!

--
nosy: +berker.peksag
resolution:  -> out of date
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue25698] The copy_reg module becomes unexpectedly empty in test_cpickle

2016-01-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch that makes import machinery to not left empty module in case of 
recursion error. I prefer this solution.

--
Added file: http://bugs.python.org/file41750/issue25698_fix_remove_module.patch

___
Python tracker 

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