[issue27810] Add METH_FASTCALL: new calling convention for C functions

2016-08-21 Thread Stefan Behnel

Stefan Behnel added the comment:

I agree that this would be cool. There is a tiny bit of a backwards 
compatibility concern as the new function signature would be incompatible with 
anything we had before, but I would guess that any code that chooses to bypass 
PyObject_Call() & friends would at least fall back to using it if it finds 
flags that it cannot handle. Cython code definitely does and always did, but 
there might be bugs. This change is the perfect way to "find" those. ;-)

Anyway, Victor, I definitely appreciate your efforts in this direction.

--

___
Python tracker 

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



[issue27826] Null-pointer dereference in tuplehash() function

2016-08-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The simplest example:

import marshal
t = [],
t[0].append(t)
b = marshal.dumps(t)
b = bytearray(b)
b[2] = b'<'[0]
marshal.loads(b)

Create a recursive tuple containing a list containing a reference to original 
tuple. Marshal it and replace TYPE_LIST ('[') by TYPE_SET ('<'). Now marshalled 
data contains a recursive tuple containing a set containing a reference to 
original tuple. When a tuple is added to a set, it still is not initialized, 
and hash is calculated on a uninitialized tuple.

I believe it is not possible to create such structure without hacking marhal 
data or using C API. And it is hard to protect from such situation in marshal.c.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27792] bool % int has inconsistent return type.

2016-08-21 Thread Xiang Zhang

Xiang Zhang added the comment:

issue27792.patch tries to fix this.

BTW, Mark, do you think the fast path in long_mod is really needed? Actually 
the same fast path has already existed in l_divmod.

--
keywords: +patch
Added file: http://bugs.python.org/file44185/issue27792.patch

___
Python tracker 

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



[issue25532] infinite loop when running inspect.unwrap over unittest.mock.call

2016-08-21 Thread Hugo Geoffroy

Hugo Geoffroy added the comment:

Another argument for having the fix in `unwrap` rather than `signature` is that 
this bug does not actually seem to be called by `signature`, as the doctest 
module calls `unwrap` for "inspect.isroutine(inspect.unwrap(val))".

Also, this call does not even check for `ValueError`, which, if I'm not wrong, 
is something that should be corrected.

Maybe `unwrap` could be made recursive to make it respect recursion limits 
directly ? Otherwise, limiting the loop seems like a good idea.

(Temporarily, `from mock import call; call.__wrapped__ = None` seems to be a 
good workaround to prevent infinite memory allocation).

--

___
Python tracker 

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



[issue27826] Null-pointer dereference in tuplehash() function

2016-08-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

It may be better to focus on Python/marshal.c to see if there are ways to make 
it more robust (at least checking to see if all of the n entries allocated in a 
container were actually filled).

--

___
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-08-21 Thread Aaron Gallagher

Aaron Gallagher added the comment:

I'm not sure why one would pick and choose here—SHAKE is part of the NIST
SHA-3 standard.

--

___
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-08-21 Thread Donald Stufft

Donald Stufft added the comment:

> I asked a room full of network engineers about SHAKE and not a single one of 
> them had heard of it

Why would a network engineer know about a new variable length hashing 
algorithm? It's not really within their problem domain.

--

___
Python tracker 

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



[issue26488] hashlib command line interface

2016-08-21 Thread Guido van Rossum

Guido van Rossum added the comment:

I prefer not to go down this road. The modules that do this where I use it
are typically Python specific, e.g. pdb or timeit. In the past we sometimes
had little main() functions in modules for testing but I think we have
better ways to test modules these days.

--Guido (mobile)

--

___
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-08-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> The SHAKEs were low hanging fruits to implement, so I included them.

I don't think this is sufficient motivation.  Each new API is a permanent 
maintenance and documentation burden.  It is also a burden to every new user 
seeing the module and trying to decide which offering to use.  We should 
provide tools that we know people need and error on the side of economy.  I 
asked a room full of network engineers about SHAKE and not a single one of them 
had heard of it, so I think it would be premature to add to the standard 
library.

--
nosy: +rhettinger

___
Python tracker 

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



[issue26488] hashlib command line interface

2016-08-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Guido, would you can to opine on this?  Every now and then we get a request to 
make command-line utilities out of tools in the standard library.  Whether we 
should or not depends on whether the standard library intends to be primarily a 
library for Python code or whether it is also about providing general purpose 
toolkits that might be helpful in a non-unix environment.

We've has some of these that have met with success (for example, timeit, 
json.tool, and SimpleHTTPServer) and others that were just a waste or a were a 
pale shadow of their full featured Unix counterparts (or left to rot in the 
Tools directory).  

If we go further down this road, it would be nice for you to lay out the ground 
roads for what kind of command line tools would be acceptable, how stable their 
API would be, and whether they should be separated from the module itself.  Do 
you even want to be in the business of offering command-line APIs that 
duplicate commonly available Unix tools?

--
assignee:  -> gvanrossum
nosy: +gvanrossum

___
Python tracker 

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



[issue27435] ctypes library loading and AIX - also for 2.7.X (and later)

2016-08-21 Thread Martin Panter

Martin Panter added the comment:

The ctypes tests all seem to be protected with code that checks for None, and 
explicitly skip the test in that case. The skip message should be visible when 
you run the test in verbose mode.

We could avoid skipping these tests in 2.7 by adding a special case for AIX 
that loads the library via CDLL("libc.a(shr[_64].o)", RTLD_MEMBER). Like an 
extension of the special cases already at 
,
 but we have to set the RTLD_ flag as well as the library name.

--

___
Python tracker 

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



[issue26488] hashlib command line interface

2016-08-21 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: rhettinger -> 

___
Python tracker 

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



[issue27826] Null-pointer dereference in tuplehash() function

2016-08-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> but it might be better to avoid a crash here.

I'm reluctant to introduce changes like this, especially in the middle of a 
loop.  This code and code like it has been nonproblematic for Python's 26 year 
history.  The code throughout tupleobject.c assumes well-formed tuples (for 
example, tuplecontains and tupleitem do not have NULL checks before 
dereferencing).  At some point, the C code just has to trust its own structure 
invariants and people who run marshal or pickle have to trust their inputs.

--

___
Python tracker 

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



[issue27826] Null-pointer dereference in tuplehash() function

2016-08-21 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue21826] Performance issue (+fix) AIX ctypes.util with no /sbin/ldconfig present

2016-08-21 Thread Martin Panter

Martin Panter added the comment:

It looks like Bert’s patch adjusted two ldconfig calls; the first one was in a 
BSD-specific branch. Was this intended? Only the second call (default “else:” 
branch) seems applicable to AIX.

Perhaps the performance is improved now that the popen() shell calls have been 
replaced with more direct subprocess.Popen() calls; see revision a09ae70f3489 
and Issue 22636. If the 300 ms slowdown was due to the shell, that should no 
longer be a problem.

But if the slowdown is say inherent in fork(), I am not sure it is worth adding 
the proposed os.path.exists() check. Either try a way of spawning a child 
process without fork(), like Issue 20104. Or avoid calling find_library() in 
the first place, like I suggested at 
.

--
stage:  -> test needed

___
Python tracker 

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



[issue27823] Change bare AttributeError messages to be more informative

2016-08-21 Thread Emanuel Barry

Emanuel Barry added the comment:

Thanks for your comments Xiang. Yes, it's not equal to #27794, but it's one of 
the multiple ways to fix it, so I made a new issue about it.

The rationale between a bare `raise AttributeError` being changed is the idea 
that it carries no information, other than the fact there was an attribute 
error (it doesn't even mean the attribute doesn't exist, as it may). Also note 
that this only affects bare AttributeErrors inside of the magic methods 
dedicated to attribute lookup (and the descriptor machinery). In a regular 
function (or even just doing `foo.__getattribute__(bar)`), `raise 
AttributeError` does nothing special.

The argument "If you do want a good message, why not passing the message when 
raising?" is one I hear a lot when there's a suggestion to add a more 
convenient way to do something that can already be done. I've seen a lot of 
code (including code in the core Python distribution, both in Python and C) 
which lazily does `raise AttributeError(name)`. It's only half the information, 
and these uninformative error messages are left completely untouched by my 
patch. The patch will help reduce boilerplate in some code. I'm personally one 
of those people who go ahead and actually use the built-in error message in my 
own code, but if I can reduce the boilerplate needed while maintaining the same 
level of information and usefulness for debugging, I'll be happy.

On the other hand, the argument that Python hides away some magic is a valid 
concern. Python already has some magic in various places; the point is to 
determine whether this kind of magic is acceptable for Python and its users. I 
honestly don't know; I don't think the magic is too strong, but at the same 
time it's likely to surprise newcomers. We'll see what others think :)

--

___
Python tracker 

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



[issue27826] Null-pointer dereference in tuplehash() function

2016-08-21 Thread Artem Smotrakov

Changes by Artem Smotrakov :


--
keywords: +patch
Added file: http://bugs.python.org/file44184/tuplehash.patch

___
Python tracker 

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



[issue27826] Null-pointer dereference in tuplehash() function

2016-08-21 Thread Artem Smotrakov

New submission from Artem Smotrakov:

A null-pointer dereference may happen while deserialization incorrect data with 
marshal.loads() function.

Here is a test which reproduces this (see also attached 
marshal_tuplehash_null_dereference.py):


import marshal

value = (   # tuple1
"this is a string", #string1
[
1,  # int1
2,  # int2
3,  # int3
4   # int4
],
(   #tuple2
"more tuples",  #string2
1.0,# float1
2.3,# float2
4.5 # float3
),
"this is yet another string"
)

dump = marshal.dumps(value)

data = bytearray(dump)
data[10] = 40
data[4] = 16
data[103] = 143
data[97] = 245
data[78] = 114
data[35] = 188

marshal.loads(bytes(data))



This code modifies the serialized data with the following:
- update type of 'int2' element to TYPE_SET, 'int3' element becomes a length of 
the set
- update 'float3' element to TYPE_REF which points to tuple1

Here is a stack trace reported by ASan:

ASAN:SIGSEGV
=
==20296==ERROR: AddressSanitizer: SEGV on unknown address 0x0008 (pc 
0x00582064 bp 0x7ffc9e581310 sp 0x7ffc9e5812f0 T0)
#0 0x582063 in PyObject_Hash Objects/object.c:769
#1 0x5a3662 in tuplehash Objects/tupleobject.c:358
#2 0x5820ae in PyObject_Hash Objects/object.c:771
#3 0x5a3662 in tuplehash Objects/tupleobject.c:358
#4 0x5820ae in PyObject_Hash Objects/object.c:771
#5 0x58fac8 in set_add_key Objects/setobject.c:422
#6 0x59a85c in PySet_Add Objects/setobject.c:2323
#7 0x760d9d in r_object Python/marshal.c:1310
#8 0x76029d in r_object Python/marshal.c:1223
#9 0x760015 in r_object Python/marshal.c:1195
#10 0x7621dc in read_object Python/marshal.c:1465
#11 0x7639be in marshal_loads Python/marshal.c:1767
#12 0x577ff3 in PyCFunction_Call Objects/methodobject.c:109
#13 0x708a05 in call_function Python/ceval.c:4744
#14 0x6fb5a7 in PyEval_EvalFrameEx Python/ceval.c:3256
#15 0x70276f in _PyEval_EvalCodeWithName Python/ceval.c:4050
#16 0x70299f in PyEval_EvalCodeEx Python/ceval.c:4071
#17 0x6e07d7 in PyEval_EvalCode Python/ceval.c:778
#18 0x432354 in run_mod Python/pythonrun.c:980
#19 0x431e5b in PyRun_FileExFlags Python/pythonrun.c:933
#20 0x42e929 in PyRun_SimpleFileExFlags Python/pythonrun.c:396
#21 0x42caba in PyRun_AnyFileExFlags Python/pythonrun.c:80
#22 0x45f995 in run_file Modules/main.c:319
#23 0x4619c8 in Py_Main Modules/main.c:777
#24 0x41d258 in main Programs/python.c:69
#25 0x7f374629babf in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x20abf)
#26 0x41ce28 in _start 

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV Objects/object.c:769 PyObject_Hash
==20296==ABORTING



What happens when it tries to read int2 element:
- int2 element is now a set of length 3
- add int4 element to the set
- add tuple2 element
-- when it adds an element to a set, it calculates a hash of the element
-- when it calculates a hash of a tuple, it calculates hashes of all elements 
of the tuple
-- while calculating a hash of tuple2, it calculates a hash of tuple1 since 
#float3 now is a TYPE_REF which points to tuple1
-- but tuple1 is not complete yet: length of tuple1 is 4, but only string1 was 
added to it
-- tuplehash() function reads a length of a tuple, and then calls 
PyObject_Hash() for each element
-- but it doesn't check if all elements were added to the tuple
-- as a result, a null-pointer dereference happens in tuplehash() while reading 
second element of tuple1

https://hg.python.org/cpython/file/tip/Objects/tupleobject.c#l347

...
static Py_hash_t
tuplehash(PyTupleObject *v)
{
Py_uhash_t x;  /* Unsigned for defined overflow behavior. */
Py_hash_t y;
Py_ssize_t len = Py_SIZE(v);<= for tuple1 it returns 4, but tuple1 
contains only one element (string1)
PyObject **p;
Py_uhash_t mult = _PyHASH_MULTIPLIER;
x = 0x345678UL;
p = v->ob_item;
while (--len >= 0) {
y = PyObject_Hash(*p++);<= null-pointer dereference happens here 
while reading second element
...


I could reproduce it with python3.5, and latest build of 
https://hg.python.org/cpython (Aug 20th, 2016).

Here is a simple patch which updates tuplehash() to check "p" for null:

diff -r 6e6aa2054824 Objects/tupleobject.c
--- a/Objects/tupleobject.c Sat Aug 20 21:22:03 2016 +0300
+++ b/Objects/tupleobject.c Sat Aug 20 23:17:16 2016 -0700
@@ -355,7 +355,13 @@
 x = 0x345678UL;
 p = v->ob_item;
 while (--len >= 0) {
-y = PyObject_Hash(*p++);
+PyObject *next = *p++;
+if (next == NULL) {
+PyErr_SetString(PyExc_TypeError,
+"Cannot compute a hash, tuple seems to be 
invalid");
+return -1;
+}
+y = PyObject_Hash(next);
 if (y == -1)
 return -1;
 x = (x ^ y) * mult;


According to 

[issue27746] ResourceWarnings in test_asyncio

2016-08-21 Thread STINNER Victor

STINNER Victor added the comment:

STINNER Victor added the comment:
> @Paul: close() is asynchronous in Python :-)

Sorry. Async in asyncio...

--

___
Python tracker 

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



[issue27821] IDLE custom keymaps don't work anymore (Windows, Python 3.6.0a3)

2016-08-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

(Don't install .0a2, .0a1 is good enough as comparison.)

Are you saying that you see, in one line,
  (*) Use a Custom Key Set  [IDLE Classic Windows --]
(where -- is the select mini-button)

This would be wrong and would suggest that 'IDLE Classis Windows' was somehow 
added to .idlerc/config-keys.cfg and should be removed and your install 
retested.

Or do you see, on two lines
  ( ) Use a Built-in Key Set  [IDLE Classic Windows --]
  (*) Use a  Custom  Key Set  [Veky --]

This would be normal.  If so, please tell me one difference between the two key 
sets (quote the exact mis-matching lines) and what behavior tells you that the 
IDLE CW key set is being used in spite of Veky being selected.

I retested on my machine that there is a difference between I.C.W and Terry key 
sets and that switches the selection, back and forth, in the dialog switches 
the behavior back in Shell in the expected way.

--
stage:  -> test needed
type:  -> behavior

___
Python tracker 

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



[issue12713] argparse: allow abbreviation of sub commands by users

2016-08-21 Thread paul j3

paul j3 added the comment:

Another failure case:

parser.add_argument('--int', type=int, choices=[10,15,25])

'--int 15` puts 'int=15' in the Namespace.

'--int 2' puts 'int=2' in the Namespace, because it matches the 'str(25)'.

'--int 1' raises an error in the ambiguity error formatting code: 

 'choices': ', '.join(ac)}

This last error could be corrected with:

'choices': ', '.join(map(repr, ac))

=

The initial message for this issue stated:

So that this feature is not foisted on every programmer that uses  
argparse it could be made an option to the ArgumentParser class with 
the (possible) additional refinement of specifying a minimum number 
of characters for the abbreviations.

That was ignored in the subsequent discussion and patches.

Other Choices issues

http://bugs.python.org/issue16468 - argparse only supports iterable choices
http://bugs.python.org/issue16418 - long choices
http://bugs.python.org/issue16977 - choices='abc' case

I recommend closing this issue, and depend on aliases for subparsers 
abbreviations.  The interaction with 'choices' is just too complicated to 
handle as proposed here.

--

___
Python tracker 

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



[issue27825] Make the documentation for statistics' data argument clearer.

2016-08-21 Thread Ned Batchelder

New submission from Ned Batchelder:

The docs for statistics.mean say, "Return the sample arithmetic mean of data, a 
sequence or iterator of real-valued numbers."  Most of the functions in 
statistics have a `data` argument, but this function is the only one that says, 
"a sequence or iterator."  The examples all show lists.

The page would be better if the introduction mentioned what `data` could be, 
instead of having to guess that median can take an iterator because mean says 
that it can.

--
assignee: docs@python
components: Documentation
messages: 273318
nosy: docs@python, nedbat
priority: normal
severity: normal
status: open
title: Make the documentation for statistics' data argument clearer.

___
Python tracker 

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



[issue24444] In argparse empty choices cannot be printed in the help

2016-08-21 Thread paul j3

paul j3 added the comment:

This error is also produced by

help = ' '

that is, a help line with all blanks.  As long as there is a nonblank character 
in the help line it format fine.

This issue doesn't need to be resolved by itself, but should be considered if 
and when the formatting of choices is reworked.

--

___
Python tracker 

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



[issue27822] Fail to create _SelectorTransport with unbound socket

2016-08-21 Thread Paul McGuire

Paul McGuire added the comment:

Patch file attached.

--
keywords: +patch
Added file: http://bugs.python.org/file44182/ptm_27822.patch

___
Python tracker 

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



[issue27819] Always distribute sdist packages as gztar.

2016-08-21 Thread Jason R. Coombs

Changes by Jason R. Coombs :


--
status: open -> closed

___
Python tracker 

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



[issue27819] Always distribute sdist packages as gztar.

2016-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ed9cabce9c38 by Jason R. Coombs in branch 'default':
Issue #27819: Add more detail in What's New in 3.6.
https://hg.python.org/cpython/rev/ed9cabce9c38

--

___
Python tracker 

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



[issue27819] Always distribute sdist packages as gztar.

2016-08-21 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Good suggestions.

--
status: closed -> open

___
Python tracker 

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



[issue27746] ResourceWarnings in test_asyncio

2016-08-21 Thread STINNER Victor

STINNER Victor added the comment:

@Paul: close() is asynchronous in Python :-)

--

___
Python tracker 

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



[issue23229] add inf, nan, infj, nanj to cmath module

2016-08-21 Thread Mark Dickinson

Mark Dickinson added the comment:

Here's a patch that adds inf, infj, nan and nanj.

--
keywords: +patch
Added file: http://bugs.python.org/file44181/cmath_inf_nan.patch

___
Python tracker 

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



[issue27822] Fail to create _SelectorTransport with unbound socket

2016-08-21 Thread Guido van Rossum

Guido van Rossum added the comment:

Can you supply a patch yourself?

--Guido (mobile)

--

___
Python tracker 

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



[issue27823] Change bare AttributeError messages to be more informative

2016-08-21 Thread Xiang Zhang

Xiang Zhang added the comment:

-1. I don't think this is equal to issue27794. I don't hope when I use `raise 
AttributeError`, Python hides some magic and sets a message I totally don't 
want. If you do want a good message, why not passing the message when raising?

--

___
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-08-21 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue27643] test_ctypes fails on AIX with xlc

2016-08-21 Thread Michael Felt

Michael Felt added the comment:

I'll get to this asap. Have to install a new "clean" environment aka a 
new virtual machine.

On 18-Aug-16 02:43, Martin Panter wrote:
> Martin Panter added the comment:
>
> Michael, byref() is just a helper for passing an object’s address to a C 
> function. Calling func(byref(b), ...) in Python is equivalent to the C code
>
> unpack_bitfields(, ...)
>
> I still think the root problem is in unpack_bitfields(). When compiled with 
> XLC, your experiments confirm that it always returns unsigned values, and 
> with GCC, it returns signed values.
>
> It looks like you can detect XLC with the __IBMC__ and __xlC__ macros (not 
> sure if there is a practical difference). So perhaps we can fix this with
>
> #ifndef __xlC__
>
> --
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue27817] tkinter string variable misinterpreted as boolean

2016-08-21 Thread Andreas Bolsch

Andreas Bolsch added the comment:

I'm afraid I don't know Tcl nor python good enough to be able to strip this 
down to a reasonably simple test case.

However, I wonder what's going on there:

When the Tcl variable holding the radiobutton's value contains "x", "z", ..., 
value->typePtr always equals NULL in "FromObj" (both 2.7.8 and 2.7.12). But if 
the variable contains "y", "yes" etc., value->typePtr always equals 
app->OldBooleanType (again 2.7.8 and 2.7.12). And tcl8.6 has only one boolean 
type according to tclInt.h???

Now 2.7.8 doesn't handle that OldBooleanType in FromObj in any special way, 
whereas 2.7.12 does.

BTW: Setting Tkinter.wantobjects = 0 cures the problem but that's certainly not 
a sensible approach.

--

___
Python tracker 

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



[issue27435] ctypes library loading and AIX - also for 2.7.X (and later)

2016-08-21 Thread Michael Felt

Michael Felt added the comment:

The more common TESTED "behavior" issue is simply:

find_library("c") always returns None while it should be returning 
either libc.a(shr.o) in 32-bit mode and libc.a(shr_64.o) in 64-bit mode. 
If that gets corrected, then adding RTLD_MEMBER it's numerical 
equivalent is also needed.

michael@x071:[/home/michael]grep RTLD_MEMBER /usr/include/*.h
/usr/include/dlfcn.h:#defineRTLD_MEMBER 0x0004 /* 
Module name may indicate

I mention find_library("c") specifically as that is used as a core test 
in both Lib/ctypes/utils.py as well as the following tests in 
Lib/ctypes/test/*.py:

test_callback.py, test_error.py and test_loading.py

How can a test that is always returned None really be testing anything. 
In any case, what these test are "testing" something very different on 
AIX compared to Linux (and perhaps Solaris and OS/X).

So, how is the current behavior not a "bug" (that, for ages, has either 
been ignored and/or not understood  - and I go more for the later, as 
there have been a few issues re: performance concerns because ldconfig 
is (generally) not available on AIX. Again, the net result of 
find_library() is for default installs - to return None even when a real 
value should be returned.

On 11-Aug-16 17:10, Michael Felt wrote:
> Martin Panter added the comment:
> >
> >For 2.7, adding the automatic RTLD_MEMBER mode does not seem like a bug fix 
> >to me. Currently, I understand this code could load two separate libraries:
> >

--

___
Python tracker 

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



[issue27824] update ConfigParser docs regarding in-line comments

2016-08-21 Thread Joshua Haas

New submission from Joshua Haas:

Originally reported at http://bugs.python.org/issue27762 as a behavior bug but 
was determined to be won't fix. Thus I think this needs to be mentioned in the 
documentation at https://docs.python.org/2/library/configparser.html

I propose that directly after the following:

"(For backwards compatibility, only ; starts an inline comment, while # does 
not.)"

be added:

"Inline comments will not be recognised in lines that contain ; before the 
comment itself. To ensure that inline comments work as expected, do not use ; 
in config values."

--
assignee: docs@python
components: Documentation
messages: 273306
nosy: docs@python, jahschwa
priority: normal
severity: normal
status: open
title: update ConfigParser docs regarding in-line comments
type: 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



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

2016-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 81f229262921 by Serhiy Storchaka in branch 'default':
Issue #26984: int() now always returns an instance of exact int.
https://hg.python.org/cpython/rev/81f229262921

--
nosy: +python-dev

___
Python tracker 

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



[issue27823] Change bare AttributeError messages to be more informative

2016-08-21 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +rhettinger

___
Python tracker 

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



[issue26488] hashlib command line interface

2016-08-21 Thread Antonio Valentino

Antonio Valentino added the comment:

Hi all,
please note that to stay compatible with the GNU md5sum utility you should 
print the file name prefixed by a "*" if you read the file in binary mode.

Also when digests is checked, files to check should be opened in binary or text 
mode according the presence/absence of the "*" character before the file name.

A explicit error should be raised IMO if some specific mode is not supported 
(e.g. text mode) by the check function.

Also, since the tool supports different hashing algorithms the 
openssl/BSD-style output format could be more appropriate IMO:

MD5 (file01.dat) = 101b455ce70d2e73e1a4d92a3e8c29e1

FYI I wrote a the hashsum package [1] that provides a command line tool that is 
intended to be a "Python drop-in replacement for md5sum and co.".

If my understanding is correct you want to keep this patch as simple as 
possible but, if you are interested in, I could provide patches to:

* fix the GNU style output: binary ("*") vs text mode
* implement full support for the text mode
* implement full support for BSD-style output format

I could also convert the hassum.py utility [1] to be integrated directly in 
hashlib.

[1] https://github.com/avalentino/hashsum

--
nosy: +avalentino

___
Python tracker 

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



[issue21718] sqlite3 cursor.description seems to rely on incomplete statement parsing for detection

2016-08-21 Thread Tom Tanner

Tom Tanner added the comment:

will the fix 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



[issue21718] sqlite3 cursor.description seems to rely on incomplete statement parsing for detection

2016-08-21 Thread Berker Peksag

Changes by Berker Peksag :


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



[issue27794] setattr a read-only property; the AttributeError should show the attribute that failed

2016-08-21 Thread Emanuel Barry

Emanuel Barry added the comment:

Opened #27823 as a followup to this, and carried nosy list over.

--

___
Python tracker 

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



[issue21718] sqlite3 cursor.description seems to rely on incomplete statement parsing for detection

2016-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 45ef062734d6 by Berker Peksag in branch '3.5':
Issue #21718: cursor.description is now available for queries using CTEs
https://hg.python.org/cpython/rev/45ef062734d6

New changeset cf18375732ae by Berker Peksag in branch 'default':
Issue #21718: Merge from 3.5
https://hg.python.org/cpython/rev/cf18375732ae

--
nosy: +python-dev

___
Python tracker 

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



[issue27823] Change bare AttributeError messages to be more informative

2016-08-21 Thread Emanuel Barry

New submission from Emanuel Barry:

Attached patch changes bare attribute errors to add a useful error message. As 
such, `raise AttributeError` and `raise AttributeError(None)` (but not `raise 
AttributeError('')` for example) inside any of the attribute lookup or 
descriptor methods (__getattribute__, __getattr__, __setattr__, __delattr__, 
__get__, __set__, and __delete__). This is a followup to #27794.

As such, the following is now much more useful and less boilerplate:

class A:
_dynamic_names = {}
def __getattr__(self, name):
if name in self._dynamic_names:
return self._dynamic_names[name]
raise AttributeError

Then, doing the following:

A().spam

Will result in a `AttributeError("'A' object has no attribute 'spam'")`, while 
keeping the original traceback. The patch is pretty much complete, but I have a 
few concerns:

- Performance hit, especially on something that's used virtually everywhere and 
everytime (attribute access); although PEP 487's __set_name__ lookup already 
hurts performance slightly. The few micro-benchmarks I ran weren't very 
significant, but there is a small drop in performance nonetheless.
- Four new PyErr_* API functions, one which isn't used in the current patch, 
but since it's 3 lines I decided to leave it in anyway.
- I don't carry over the cause or context of the raised exception to the new 
one. Keeping the traceback around is pretty trivial, since it has its own slot 
in the thread state struct, but since not all exceptions are actual exceptions 
at the C level (and the new exceptions I raise aren't either, at the C level), 
I don't know how to carry over context or cause.

Oh, and exceptions set at the C level with e.g. `PyErr_SetNone` are also 
properly handled that way; this would fix #27794 as a side-effect, but a few 
lines will need to be changed (in Objects/descrobject.c) for this to work. Such 
changes are not included with the patch.

Thoughts, concerns, opinions, ideas? Maybe something I didn't think of?

--
components: Interpreter Core
files: change_attr_error_messages_1.patch
keywords: patch
messages: 273300
nosy: ebarry, r.david.murray, xiang.zhang, ztane
priority: normal
severity: normal
stage: patch review
status: open
title: Change bare AttributeError messages to be more informative
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file44180/change_attr_error_messages_1.patch

___
Python tracker 

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



[issue27746] ResourceWarnings in test_asyncio

2016-08-21 Thread Paul McGuire

Paul McGuire added the comment:

Ok, I will submit as a separate issue.

--

___
Python tracker 

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



[issue27746] ResourceWarnings in test_asyncio

2016-08-21 Thread Xiang Zhang

Xiang Zhang added the comment:

The patch I submitted is about to solve the resource leak in the test suite. 
Paul, your problem seems to need other triage.

--

___
Python tracker 

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



[issue27821] IDLE custom keymaps don't work anymore (Windows, Python 3.6.0a3)

2016-08-21 Thread Vedran Čačić

Vedran Čačić added the comment:

Windows 10. No, I jumped from .0a1 to .0a3. Now I installed .0a4 and have the 
same problem. I'm afraid of going back to .0a2, was taught long ago to never 
downgrade anything. :-) But I have 3.5.1 installed separately, and its IDLE 
keeps working without problem.

My config-main.cfg is
-
[EditorWindow]
font-bold = False
font-size = 12
font = consolas
height = 25

[General]
autosave = 1

[Keys]
default = False
name = Veky2

[Theme]
name = IDLE New


(Veky2 is what I've made after Veky stopped working, thinking that it got 
corrupted or something.) Yes, I know about regular semantics of name2, it's 
just that I was desperate. :-o

I tried running from the console (py -m idlelib, right?), and I don't see any 
error messages. It's just that every time I go to Options > Configure IDLE > 
Keys > Key Set, radiobutton Use a Custom Key Set is selected, and option IDLE 
Classic Windows is selected beside it. I can select Veky2 and click OK, but it 
doesn't switch, and the next time I go to the same place, it's IDLE Classic 
Windows again. :-(

--

___
Python tracker 

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



[issue27539] negative Fraction ** negative int not normalized

2016-08-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
nosy: +serhiy.storchaka
stage:  -> commit review

___
Python tracker 

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



[issue27821] IDLE custom keymaps don't work anymore (Windows, Python 3.6.0a3)

2016-08-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I use a custom key set also and have no problem before or after the Modern Unux 
patch (else I would not have applied it ;-). Did you have .0a2 installed?  
Which Windows?  

What I have in config-main.cfg is 

[Keys]
default = False
name = Terry

[Theme]
default = False
name = Custom Dark

name2 should not be set unless you are using Modern Unix of IDLE Dark 
respectively.  Anything else and IDLE will possibly not work. What did you see 
before editing?  Are you running IDLE from a console, so you can see errors 
printed?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27746] ResourceWarnings in test_asyncio

2016-08-21 Thread Martin Panter

Changes by Martin Panter :


--
stage: needs patch -> patch review

___
Python tracker 

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



[issue27810] Add METH_FASTCALL: new calling convention for C functions

2016-08-21 Thread Stefan Behnel

Changes by Stefan Behnel :


--
nosy: +scoder

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-21 Thread Stefan Behnel

Changes by Stefan Behnel :


--
nosy: +scoder

___
Python tracker 

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



[issue27822] Fail to create _SelectorTransport with unbound socket

2016-08-21 Thread Paul McGuire

Paul McGuire added the comment:

(issue applies to both 3.5.2 and 3.6)

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



[issue27746] ResourceWarnings in test_asyncio

2016-08-21 Thread Paul McGuire

Paul McGuire added the comment:

I was about to report this same issue - I get the error message even though I 
explicitly call transport.close(): 

C:\Python35\lib\asyncio\selector_events.py:582: ResourceWarning: unclosed 
transport <_SelectorDatagramTransport closing fd=232>

It looks like the _sock attribute of the Transport subclasses must be set to 
None in their close() methods. (The presence of a non-None _sock is used 
elsewhere as an indicator of whether the transport has been closed or not.

--
nosy: +Paul McGuire

___
Python tracker 

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



[issue27822] Fail to create _SelectorTransport with unbound socket

2016-08-21 Thread Paul McGuire

Paul McGuire added the comment:

To clarify how I'm using a socket without a bound address, I am specifying the 
destination address in the call to transport.sendto(), so there is no address 
on the socket itself, hence getsockname() fails.

--

___
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-08-21 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee: mark.dickinson -> serhiy.storchaka
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



[issue27822] Fail to create _SelectorTransport with unbound socket

2016-08-21 Thread Paul McGuire

New submission from Paul McGuire:

In writing a simple UDP client using asyncio, I tripped over a call to 
getsockname() in the _SelectorTransport class in asyncio/selector_events.py.


def __init__(self, loop, sock, protocol, extra=None, server=None):
super().__init__(extra, loop)
self._extra['socket'] = sock
self._extra['sockname'] = sock.getsockname()

Since this is a sending-only client, the socket does not get bound to an 
address. On Linux, this is not a problem; getsockname() will return ('0.0.0.0', 
0) for IPV4, ('::', 0, 0, 0) for IPV6, and so on. But on Windows, a socket that 
is not bound to an address will raise this error when getsockname() is called:

OSError: [WinError 10022] An invalid argument was supplied

This forces me to write a wrapper for the socket to intercept getsockname() and 
return None.

In asyncio/proactor_events.py, this is guarded against, with this code in the 
_ProactorSocketTransport class:

try:
self._extra['sockname'] = sock.getsockname()
except (socket.error, AttributeError):
if self._loop.get_debug():
logger.warning("getsockname() failed on %r",
 sock, exc_info=True)


Please add similar guarding code to the _SelectorTransport class in 
asyncio/selector_events.py.

--
components: asyncio
messages: 273290
nosy: Paul McGuire, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: Fail to create _SelectorTransport with unbound socket
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



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

2016-08-21 Thread Mark Dickinson

Mark Dickinson added the comment:

The patch LGTM. I'm still in two minds about whether `__trunc__` should be 
required to return a strict `int`, but for now it's probably better to go with 
the status quo.

--

___
Python tracker 

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



[issue27821] IDLE custom keymaps don't work anymore (Windows, Python 3.6.0a3)

2016-08-21 Thread Vedran Čačić

New submission from Vedran Čačić:

I had a custom keymap in IDLE. Since I installed 3.6.0a3, it doesn't work 
anymore. Worse, I cannot switch to anything except "IDLE Classic Windows" - 
Apply does nothing, but when I click OK, it doesn't switch.

I suppose https://hg.python.org/cpython/rev/e6e6c71776b0 is the suspect, but I 
can't be sure. I tried editing .idlerc by hand, setting name, name2 and 
default, but nothing seems to help. :-/

Please resolve this, I'm lost without my favorite Python IDE. :-o

--
assignee: terry.reedy
components: IDLE
messages: 273289
nosy: terry.reedy, veky
priority: normal
severity: normal
status: open
title: IDLE custom keymaps don't work anymore (Windows, Python 3.6.0a3)
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



[issue25604] [Minor] bug in integer true division algorithm

2016-08-21 Thread Mark Dickinson

Mark Dickinson added the comment:

Fixed for 2.7 and 3.6. I don't think it's worth backporting the fix to 3.5 
without evidence of actual incorrect results arising from this bug.

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



[issue25604] [Minor] bug in integer true division algorithm

2016-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 370bbeba21b3 by Mark Dickinson in branch '2.7':
Issue #25604: Fix bug in integer true division that could have resulted in 
off-by-one-ulp results in unusual cases.
https://hg.python.org/cpython/rev/370bbeba21b3

--

___
Python tracker 

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



[issue27539] negative Fraction ** negative int not normalized

2016-08-21 Thread Mark Dickinson

Mark Dickinson added the comment:

> How/when does this appear in 3.6 line?

After allowing a couple of days for review, I'll commit the issue_27539_fix 
patch to the 3.5 branch, then immediately merge it to the 3.6 "default" branch. 
So that fix should appear in the upcoming 3.6 beta1.

--

___
Python tracker 

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



[issue27539] negative Fraction ** negative int not normalized

2016-08-21 Thread Mark Dickinson

Mark Dickinson added the comment:

> Do I report a new issue and refer to this one?

Sure, that would work. A patch that included the change and a test that checks 
that `Fraction(3, 4, True)` raises TypeError would be good, too.

--

___
Python tracker 

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



[issue27539] negative Fraction ** negative int not normalized

2016-08-21 Thread Vedran Čačić

Vedran Čačić added the comment:

> it's independent of the fix, and should probably be a 3.6-only change.

Fair enough. Two questions:

How/when does this appear in 3.6 line? I guess there is a standard timeline of 
how bugfixes are "forwardported", but I don't know what it is.

How do I make the _normalize "kwonlyfication"? Do I report a new issue and 
refer to this one? I really think that accepting `Fraction(2, 3, 4)` is simply 
a bug (though I don't mind if it's fixed only in >=3.6).

--

___
Python tracker 

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



[issue25604] [Minor] bug in integer true division algorithm

2016-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b9e12ca6fdb6 by Mark Dickinson in branch 'default':
Issue #25604: Fix minor bug in integer true division, which could
https://hg.python.org/cpython/rev/b9e12ca6fdb6

--
nosy: +python-dev

___
Python tracker 

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



[issue27539] negative Fraction ** negative int not normalized

2016-08-21 Thread Mark Dickinson

Mark Dickinson added the comment:

Here's a patch (against the 3.5 tip). I've dropped the keyword-only 
`_normalize` change; I have no objections to that change, but it's independent 
of the fix, and should probably be a 3.6-only change.

--
Added file: http://bugs.python.org/file44179/issue_27539_fix.patch

___
Python tracker 

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



[issue16968] Fix test discovery for test_concurrent_futures.py

2016-08-21 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue27662] Check against PY_SSIZE_T_MAX instead of PY_SIZE_MAX in List_New

2016-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c7f9e66826a0 by Mark Dickinson in branch 'default':
Issue #27662: add missing Misc/NEWS entry.
https://hg.python.org/cpython/rev/c7f9e66826a0

--

___
Python tracker 

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



[issue27782] Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP

2016-08-21 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for your work too, Nick! :) Active reply from the core devs always gives 
me more motivation to open source.

--

___
Python tracker 

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



[issue16764] Make zlib accept keyword-arguments

2016-08-21 Thread Xiang Zhang

Xiang Zhang added the comment:

I think it's okay to close now.

--

___
Python tracker 

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



[issue27539] negative Fraction ** negative int not normalized

2016-08-21 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue27662] Check against PY_SSIZE_T_MAX instead of PY_SIZE_MAX in List_New

2016-08-21 Thread Mark Dickinson

Mark Dickinson added the comment:

List_New_Calloc_v2.patch applied. Thanks!

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



[issue27662] Check against PY_SSIZE_T_MAX instead of PY_SIZE_MAX in List_New

2016-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cd3d079ad2b5 by Mark Dickinson in branch 'default':
Issue #27662: don't use PY_SIZE_MAX for overflow checking in List_New. Patch by 
Xiang Zhang.
https://hg.python.org/cpython/rev/cd3d079ad2b5

--
nosy: +python-dev

___
Python tracker 

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



[issue27782] Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP

2016-08-21 Thread Nick Coghlan

Nick Coghlan added the comment:

Thanks for the bug report and the patch!

These kinds of collaborative interactions are my favourite aspect of open 
source participation :)

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



[issue27782] Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP

2016-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 913268337886 by Nick Coghlan in branch '3.5':
Issue #27782: Fix m_methods handling in multiphase init
https://hg.python.org/cpython/rev/913268337886

New changeset fb509792dffc by Nick Coghlan in branch 'default':
Merge #27782 fix from 3.5
https://hg.python.org/cpython/rev/fb509792dffc

--
nosy: +python-dev

___
Python tracker 

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



[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-21 Thread Antti Haapala

Antti Haapala added the comment:

Yeah, it definitely is a bug in CPython. open(mode='a') should always append to 
the end of the given file. 

If you're writing an append-only text log to some file-like object, that's the 
mode you use, not some version/platform/filesystem specific voodoo to find out 
what's the least incorrect way to work around Python implementation 
deficiencies.

--

___
Python tracker 

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



[issue25532] infinite loop when running inspect.unwrap over unittest.mock.call

2016-08-21 Thread Nick Coghlan

Nick Coghlan added the comment:

My current inclination is that the right fix here is to have a hard limit in 
inspect.unwrap() itself, on the basis of "we won't eat all the memory on your 
machine, even when other code produces an infinite chain of distinct 
__wrapped__ attributes" is a guarantee that function should aim to be offering.

Since the limit is arbitrary anyway, sys.getrecursionlimit() seems like a 
reasonable choice. The current id-based checked then just becomes a way to bail 
out early if there's an actual cycle in the wrapper chain, with the hard limit 
only being reached in the case of introspection on recursively generated 
attributes.

Looking at the current inspect.signature and pydoc handling, inspect.signature 
lets the ValueError escape, while pydoc intercepts it and handles it as "no 
signature information available".

The inspect.signature case seems reasonable, but in pydoc, it may be worth 
trying inspect.signature a second time, only with "follow_wrapped=False" set in 
the call.

(I'm somewhat regretting raising ValueError rather than RecursionError for the 
infinite loop detection case, but I'm not sure it's worth the effort to change 
it at this point - the main benefit from doing so in 3.6 would be to better 
enable the "don't follow the wrapper chain when it's broken" fallback in pydoc)

--

___
Python tracker 

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



[issue25532] infinite loop when running inspect.unwrap over unittest.mock.call

2016-08-21 Thread Nick Coghlan

Nick Coghlan added the comment:

The infinite loop reported here is an inspect.signature bug - it's supposed to 
prevent infinite loops, but we didn't account for cases where "obj.__wrapped__" 
implicitly generates a fresh object every time.

unittest.mock.Mock is the only case of that in the standard library, but it's 
far from the only Python mocking library out there, and we should give a clear 
exception in such cases, rather than eating up all the memory on the machine.

This further means that while I agree the idea of blacklisting certain 
attributes from auto-generation in unittest.mock.Mock is a reasonable one, I 
also think you'll end up with a better design for *unittest.mock* by 
approaching that from the perspective of:

- having a way to prevent certain attributes being auto-generated is clearly 
useful (e.g. the "assert_*" methods, "__wrapped__")
- it's useful to have that default "blocked attribute" list be non-empty
- it may be useful to have that default list be configurable by tests and test 
frameworks without needing to update mock itself

That would make more sense as its own RFE, with a reference back to this bug as 
part of the motivation, rather than pursuing it as the *fix* for this bug.

--

___
Python tracker 

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



[issue16764] Make zlib accept keyword-arguments

2016-08-21 Thread Martin Panter

Martin Panter added the comment:

All the interesting keyword arguments seem to work now (checking against my 
notes from earlier). Is there anything else anyone wants to do, or can we close 
this now?

--
stage: commit review -> resolved

___
Python tracker 

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



[issue25532] infinite loop when running inspect.unwrap over unittest.mock.call

2016-08-21 Thread Hugo Geoffroy

Hugo Geoffroy added the comment:

You are right, the fix would be better suited in `unwrap`. 

But, still, shouldn't any `__getattr__` implementation take care of not 
returning, for the `__wrapped__` attribute, a dynamic wrapper that provides the 
same attribute ? `__wrapped__` is commonly resolved to the innermost value 
without `__wrapped__`, which in this case never happens.

This would also avoid problems with introspection tools that resolve 
`__wrapped__` without the help of `unwrap` (before Python 3.4 IIRC).

--

___
Python tracker 

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