[issue28826] Programming with Python 3.6

2016-12-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue28739] PEP 498: docstrings as f-strings

2016-12-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Eric, could you please make a review of the patch?

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



[issue21134] Segfault when stringifying UnicodeEncodeError (or UnicodeDecodeError) created with __new__()

2016-12-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
status: pending -> closed

___
Python tracker 

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



[issue20191] resource.prlimit(int, int, str) crashs

2016-12-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Following patch applies to resource.prlimit() the same solution as to 
resource.setrlimit().

--
components: +Extension Modules
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file45848/prlimit_refcount.patch

___
Python tracker 

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



[issue28930] bytes_methods.c won't recompile if related stringlib/* changed

2016-12-10 Thread STINNER Victor

STINNER Victor added the comment:

LGTM, you can push it to 3.6 and default.

--

___
Python tracker 

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



Re: % string formatting - what special method is used for %d?

2016-12-10 Thread Ian Kelly
On Sat, Dec 10, 2016 at 11:40 PM, Veek M  wrote:
> Well take a look at this:
> ###
> #!/usr/bin/python
>
> class Foo(int):
> def __init__(self, value):
> self.value = value
>
> def __str__(self):
> print '__str__'
> return str(self.value)
>
> def __int__(self):
> print '__int__'
> return self.value + 1
>
>
> #'%s' % Foo(10) # %s is mapped to __str__
> '%d' % Foo(20)
> ###
>
> here, '__str__' prints because when you do:
> '%s' % x
> the __str__ method is invoked. So internally %s invokes __str__
> independent of print.
>
> However the next line doesn't trigger any similar invocation with
> __int__ or__str__? (but int(Foo(10)) would invoked __int__)

This is probably because Foo inherits from int. Foo(20) is already an
int so there is no conversion to be done; Python simply uses the int
value and ignores the __int__ method in this case.

> Is there a way to trigger special methods using %d etc OR is this
> restricted to %s and why?

For an object that is already an int, probably not.

However you may want to revisit your decision to make Foo inherit from
int and question whether that is really sensible if you're also
wanting to override the __int__ method. What does that mean if
something is an int but also provides a method to convert to int? It's
a contradiction.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28783] Embedded/nuget packages incorrectly reference bdist_wininst

2016-12-10 Thread Steve Dower

Steve Dower added the comment:

I have a better fix for this issue in the attached patch. It doesn't require 
any change to setuptools in order to avoid crashing when installing from sdist 
(e.g. Cython).

As before, this only involves changing the nuget package and its build scripts, 
so there is zero risk to the main installer. It's even simpler than before too, 
because I can reuse the infrastructure that was added. (That said, I haven't 
tested this patch with a real build on the real build machine yet - I will do 
so before committing.)

Ned - can I get this in for 3.6.0? If not, I'll patch the file by hand before 
publishing the nuget packages.

--
nosy: +larry
priority: normal -> release blocker
resolution: fixed -> 
stage: resolved -> patch review
status: closed -> open
Added file: http://bugs.python.org/file45847/28783_1.patch

___
Python tracker 

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



Help in creating a dynamic/loop based on variables and CSV files

2016-12-10 Thread Umar Yusuf
Hi all,
I need your help with any of these questions?

1- 
http://stackoverflow.com/questions/41083699/python-create-dynamic-loop-based-on-variables-and-csv

2- 
http://stackoverflow.com/questions/41081800/python-pandas-how-to-use-dataframe-cell-to-search-another-dataframe-column-and

Thanks in advance for your time.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: % string formatting - what special method is used for %d?

2016-12-10 Thread Veek M
Steve D'Aprano wrote:

> On Sat, 10 Dec 2016 06:06 pm, Veek M wrote:
> 
>> When we do:
>> 
>> print '%s %d' % ('hello', 10)
>> 
>> what special method is being invoked internally within the string-
>> format-specifier?
> 
> %d requires the argument to be an int, or able to be converted to int
> using the __int__ special method.
> 
> 
> py> class X(object):
> ... def __int__(self):
> ... return 42
> ...
> py> "%d" % X()
> '42'
> 
> 
> 
>> format() invokes format__
>> print invokes __str__
> 
> print actually invokes __str__ or __repr__, whichever is available.
> 
> 
> 
>> I'm basically trying to make sense of:
>> 
>> raise TypeError('urkle urkle %s' % list(dictionary))
>> <=> raise TypeError('urkle urkle %s' % [ key1, val1, key2, val2 ]
> 
> 
> The raise TypeError part of the code is irrelevant to your question.
> You should always simplify your code to only the part that is
> relevant.
> 
> raise TypeError(some_string)
> 
> behaves the same regardless of how some_string is made.
> 
> 
>> So, the % operator reads the format specifier and notices %s and
>> therefore calls __str__ in the list class to figure out how to
>> represent
>> [ key1, val1, key2, val2 ].
>> 
>> However what if I use %d? How do the other format specs work?
> 
> 
> The format specifiers are similar to these:
> 
> %s => str(obj), which ends up calling __str__ or __repr__
> 
> %r => repr(obj), which ends up calling __repr__ or __str__
> 
> %c => chr(obj), or obj must be a string of length 1
> 
> %d %i %u => int(obj), which ends up calling __int__
> 
> %x %X => int(obj), then convert to hexadecimal
> 
> %o => int(obj), then convert to octal
> 
> %e %E %f %g %G => float(obj), which ends up calling __float__
> 
> %% => a literal % sign
> 
> 
> 
> 
> 

Well take a look at this:
###
#!/usr/bin/python

class Foo(int):
def __init__(self, value):
self.value = value

def __str__(self):
print '__str__'
return str(self.value)

def __int__(self):
print '__int__'
return self.value + 1


#'%s' % Foo(10) # %s is mapped to __str__
'%d' % Foo(20)
###

here, '__str__' prints because when you do:
'%s' % x
the __str__ method is invoked. So internally %s invokes __str__ 
independent of print.

However the next line doesn't trigger any similar invocation with 
__int__ or__str__? (but int(Foo(10)) would invoked __int__)

Is there a way to trigger special methods using %d etc OR is this 
restricted to %s and why?








-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2016-12-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Victor, you perhaps could just use NULL as default:

+source: object = NULL

--

___
Python tracker 

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



[issue25677] Syntax error caret confused by indentation

2016-12-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
assignee: serhiy.storchaka -> martin.panter

___
Python tracker 

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



[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Julien Palard

Julien Palard added the comment:

> You propose an automatic conversion of "None" into "-1"?  That's awful.  
> Please don't commit that patch to CPython.

Not really, I propose a way to do it with AC when needed. And the AC semantics 
introduced are not "Automatic conversion of None into -1" but "automatic "don't 
touch the C default" when the python default is given", so it's reusable for 
other values:

something: Py_ssize_t(c_default="-1") = None
something: Py_ssize_t(c_default="0") = None
something: Py_ssize_t(c_default="42") = None
…

And this semantic can be extended to other types too if needed:

something: a_type(c_default="a_c_side_default_value") = None

To get "a_c_side_default_value" when None is given.

I however did not introduced a way to keep the C default value by using 
something else than None in the Python side:

 - I'm not sure this is usefull to allow it but it can still be implemented if 
needed
 - Limiting to None permits to keep a type check so ``something: 
Py_ssize_t(c_default="-1") = "bar"`` will still fail at clinic.py runtime.

--

___
Python tracker 

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



[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Julien Palard

Julien Palard added the comment:

> It looks like you did it with a converter for 28754.  That's okay.  But not 
> in the default implementation.

It's not by default, we have to declare "… = None" in the AC declaration, which 
was an error before my patch (incompatible types…).

Before:

something: Py_ssize_t(c_default="-1") = None

> Py_ssize_t_converter: default value None for field something is not of 
type int

After:

something: Py_ssize_t(c_default="-1") = None

> If the None (default) value is provided, the c_default is untouched.

--

___
Python tracker 

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



[issue28929] Provide a link from documentation back to its source file

2016-12-10 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Hi,
This patch updates the Show Source link on the left of Docs menu and point it 
to github.
I tested it locally, and works for versions >= 3.5 
Please let me know if you have any feedback about this.
Thanks :)

Not sure if the older docs versions should be updated too? In that case, I'll 
need to prepare different patches for 3.4, 3.3 and 2.7

--
keywords: +patch
Added file: http://bugs.python.org/file45846/issue28929dev.patch

___
Python tracker 

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



[issue26483] docs unclear on difference between str.isdigit() and str.isdecimal()

2016-12-10 Thread Martin Panter

Changes by Martin Panter :


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



[issue28916] Not matched behavior of modulo operator % with the description of the documentation

2016-12-10 Thread Martin Panter

Changes by Martin Panter :


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



[issue26483] docs unclear on difference between str.isdigit() and str.isdecimal()

2016-12-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c15f122617d5 by Martin Panter in branch '3.5':
Issue #26483: Clarify str.isdecimal() and isdigit()
https://hg.python.org/cpython/rev/c15f122617d5

New changeset bc7fc85beed1 by Martin Panter in branch '3.6':
Issues #28916, #26483: Merge stdtypes.rst from 3.5
https://hg.python.org/cpython/rev/bc7fc85beed1

New changeset b11850871300 by Martin Panter in branch 'default':
Issues #28916, #26483: Merge stdtypes.rst from 3.6
https://hg.python.org/cpython/rev/b11850871300

--
nosy: +python-dev

___
Python tracker 

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



[issue28916] Not matched behavior of modulo operator % with the description of the documentation

2016-12-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 35e66eb101da by Martin Panter in branch '3.5':
Issue #28916: Correct description of %o and %x alternative forms
https://hg.python.org/cpython/rev/35e66eb101da

New changeset bc7fc85beed1 by Martin Panter in branch '3.6':
Issues #28916, #26483: Merge stdtypes.rst from 3.5
https://hg.python.org/cpython/rev/bc7fc85beed1

New changeset b11850871300 by Martin Panter in branch 'default':
Issues #28916, #26483: Merge stdtypes.rst from 3.6
https://hg.python.org/cpython/rev/b11850871300

New changeset 8359ee62dde3 by Martin Panter in branch '2.7':
Issue #28916: No special case for leading zeros with %x alternative form
https://hg.python.org/cpython/rev/8359ee62dde3

--
nosy: +python-dev

___
Python tracker 

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



[issue25458] ftplib: command response shift - mismatch

2016-12-10 Thread Ivan Pozdeev

Ivan Pozdeev added the comment:

Spawned the `urllib' issue to issue28931.

--

___
Python tracker 

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



[issue28931] urllib ignores FTP 226 response, breaking further FTP requests

2016-12-10 Thread Ivan Pozdeev

Changes by Ivan Pozdeev :


Added file: http://bugs.python.org/file45845/105577.patch

___
Python tracker 

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



[issue20191] resource.prlimit(int, int, str) crashs

2016-12-10 Thread Larry Hastings

Larry Hastings added the comment:

Sorry, Argument Clinic doesn't support automatic tuple unpacking for arguments. 
 It was almost never used, I don't think it was ever a good idea, and it would 
have made an already-too-complicated program even more complicated-er.

--

___
Python tracker 

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



[issue20191] resource.prlimit(int, int, str) crashs

2016-12-10 Thread Martin Panter

Changes by Martin Panter :


--
stage:  -> needs patch

___
Python tracker 

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



[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords

2016-12-10 Thread Martin Panter

Changes by Martin Panter :


--
dependencies: +resource.prlimit(int, int, str) crashs

___
Python tracker 

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



[issue20191] resource.prlimit(int, int, str) crashs

2016-12-10 Thread Martin Panter

Martin Panter added the comment:

Revision 4bac47eb444c fixed setrlimit(). Perhaps those changes can just be 
applied again to prlimit().

I’m not an Arg Clinic expert, but isn’t one of its purposes to imitate native 
Python function signatures? Since argument unpacking was dropped from Python 2 
to 3, I doubt Arg Clinic would grow support for this. I think the tuple should 
be unpacked inside the implementation body, just as a native Py 3 function has 
to unpack tuple arguments.

BTW I couldn’t get either Victor’s "\udbff" test case, nor Serhiy’s BadSequence 
test case to crash, but the original MyNum class from Issue 6083 does crash.

--
nosy: +martin.panter
versions: +Python 3.5, Python 3.6, Python 3.7 -Python 3.4

___
Python tracker 

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



[issue28934] _mboxMMDF#get_message should delegate to get_bytes

2016-12-10 Thread bpoaugust

bpoaugust added the comment:

On further investigation it sppears that overriding the get_bytes function does 
not help with unmangling >From.
However it would still be worth re-using the code.

--

___
Python tracker 

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



[issue28912] collections.abc.OrderedMapping

2016-12-10 Thread Joshua Bronson

Joshua Bronson added the comment:

Sorry to hear but thanks for the consideration. To follow up on your comments:

> nice to see Guido's reasons for giving a -0 on the proposal.

(Guido was giving his -0 on a proposal for collections.abc.Ordered, whereas the 
main proposal here is collections.abc.OrderedMapping, sorry if that was 
confusing.)


> I would add that I haven't see any code in the wild that would benefit from 
> testing isinstance(m, OrderedMapping) and taking some different action 
> depending on the result.

Just to give you another data point, bidict.orderedbidict has been released 
into the wild for a little over 10 months, and people are using it. 
OrderedMapping would give users the following benefits:

>>> noble = orderedbidict([(2, 'helium'), (10, 'neon'), (18, 'argon')])

>>> b = bidict(noble)  # Discards the order.
>>> b  # Calls BidictBase.__repr__.
bidict({10: 'neon', 18: 'argon', 2: 'helium'})

>>> noble  # Also calls BidictBase.__repr__.
orderedbidict([('Cairo', 'Egypt'), ('Lima', 'Peru'), ('Tokyo', 'Japan')])

>>> # i.e. BidictBase.__repr__ interrogates isinstance(self, OrderedMapping)
>>> # to reflect any ordering correctly in the string representation.

>>> # OrderedMapping.__eq__ also checks isinstance(other, OrderedMapping)
>>> # to conditionally turn on order-sensitivity:
>>> noble == collections.OrderedDict(noble.items())
True
>>> noble == collections.OrderedDict(reversed(noble.items()))
False
>>> noble == dict(reversed(noble.items()))  # order-insensitive
True

(collections.OrderedDict and sortedcontainers.SortedDict could reap these same 
benefits from an OrderedMapping class.)


> Grant's sortedcollection is more sequence-like than mapping-like and the 
> bidict has its own interesting properties and neither are substitutable for 
> an OrderedDict.

Hm, I don't quite follow this. OrderedDict, SortedDict, and orderedbidict are 
all OrderedMappings, and should therefore be passable to any function that 
expects an OrderedMapping.

This part I do follow:

> In other words, the only properties these cluster on is the ordered equality 
> feature.  IMO, that particular feature hasn't established itself as being 
> valuable It is an interesting idea but I believe it that it would clutter 
> the module, slightly drowning-out the ABCs that have more broad and 
> established utility.

But based on this rationale, I would have thought Reversible wouldn't have been 
added. It was only after I found https://bugs.python.org/issue25987 the other 
day and saw that Reversible will be in 3.6 that I thought OrderedMapping had a 
case of similar strength, and so it seemed worth taking the time to try to 
contribute it for 3.7.

In any case, thanks again for your consideration, and if you have any further 
thoughts to share, it'd be much appreciated.

--
nosy: +abarnert

___
Python tracker 

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



[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2016-12-10 Thread Martin Panter

Martin Panter added the comment:

Zach’s comments on float seem to have been addressed 
(https://bugs.python.org/review/20185/diff2/10940:10949/Objects/floatobject.c). 
The comments on the resource module were about return converters: 
. One 
has been addressed.

The other was about the rlimit2py() function, used in two places. One of these 
is resource.prlimit(), which is not converted to Arg Clinic in the patch. If we 
don’t convert it, I agree that leaving rlimit2py() as it is is simplest.

Given that the current prlimit() arg parsing is buggy (Issue 20191), it would 
be good to convert it to Arg Clinic in the process of solving the bug, but that 
could be done as a separate step.

Tangentially, the rlimit2py() function has special HAVE_LONG_LONG handling. 
This is no longer needed in 3.6; see Issue 27961. But again, I think it is 
better to review and commit the existing patch than to keep perfecting it :)

--

___
Python tracker 

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



[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2016-12-10 Thread Martin Panter

Martin Panter added the comment:

Julien, to help push these changes forward, I suggest start by rebasing and 
reviewing the conglomerate patch, since it seems that was almost ready.

Reading through the thread, it seems the current status is:

1. _crypt module handled elsewhere by Antoine

2. type, list, and float objects, the resource module, and Python/marshal.c are 
done by Vajrasky, in part of the conglomerate v4 patch. Zach said they look 
good, but wanted a second opinion from someone with good C knowledge. Check if 
Zach’s minor comments for float object and resource module were dealt with.

3. long object and gc module were updated by Vajrasky since last review, so 
probably need to check if there are any outstanding problems with them.

4. _bisect module by Julien via Issue 28754

5. Victor made a change to Python/_warnings.c, but there may be more to do

6. Not yet handled: Objects/exceptions.c, _thread, _bz2, nis modules.

--
nosy: +martin.panter
stage: needs patch -> patch review
versions: +Python 3.7 -Python 3.5

___
Python tracker 

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



[issue28912] collections.abc.OrderedMapping

2016-12-10 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thank you for the link, it was nice to see Guido's reasons for giving a -0 on 
the proposal.  I would add that I haven't see any code in the wild that would 
benefit from testing isinstance(m, OrderedMapping) and taking some different 
action depending on the result.

Grant's sortedcollection is more sequence-like than mapping-like and the bidict 
has its own interesting properties and neither are substitutable for an 
OrderedDict.  In other words, the only properties these cluster on is the 
ordered equality feature.  IMO, that particular feature hasn't established 
itself as being valuable (we don't see much use of it with the existing ordered 
dicts, and likewise in the database world, table equivalence based on exact 
order rather than content equivalence is uncommon).

Given the limited utility, I am going to decline the proposal.  It is an 
interesting idea but I believe it that it would clutter the module, slightly 
drowning-out the ABCs that have more broad and established utility.

One other thought is that the proposed OrderedMapping ABC might not fit well in 
a possible future Python where the behavior Python 3.6 ordered-and-compact 
dicts becomes guaranteed but where we retain the traditional unordered equality 
comparison.

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-12-10 Thread Larry Hastings

Larry Hastings added the comment:

We don't *have* to use a converter function, no.  But consider: someone 
somewhere will have to convert a PyObject * into a Py_ssize_t, also accepting 
None.  Doing it in a converter function means we can easily share the code with 
bisect_right, which should presumably behave the same way.  It also keeps all 
the argument parsing logic in the Argument Clinic domain instead of having some 
in AC and some in the implementation.

Is there some drawback to using a converter function?

--

___
Python tracker 

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



[issue25677] Syntax error caret confused by indentation

2016-12-10 Thread Martin Panter

Martin Panter added the comment:

Patch v6 strips the form feed, and adds an extra test.

--
Added file: http://bugs.python.org/file45844/cpython25677.v6.patch

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-12-10 Thread Julien Palard

Julien Palard added the comment:

Hi Raymond,

I don't like having the converters in the C implementation too, that's why I'm 
working on issue28933 to clean this.

> letting the C function handle both -1 and None in the implementation rather 
> than in AC?

It works, yes. But I prefer to clearly split responsibilities: AC being 
responsible of adapting argument from PyObjects to C types, and C functions 
being responsible of ... doing their job.

If the idea in issue28933 is accepted, we'll be able to declare hi as simply as:

hi: Py_ssize_t(c_default="-1") = None

meaning "C function will get a Py_ssize_t, default value for C code is -1, None 
is documented, and None can be passed to get the C default value", that's this 
last point "None can be passed to get the C default value" that I introduce in 
issue28933.

With this syntax, both C converters and the python hi_parameter_converter can 
be dropped.

--

___
Python tracker 

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



[issue1446619] extended slice behavior inconsistent with docs

2016-12-10 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



[issue28754] Argument Clinic for bisect.bisect_left

2016-12-10 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Why does this need a converter function?  I there is any reason this can't use 
"O" with "hi" defaulting to None (matching the pure python API) and letting the 
C function handle both -1 and None in the implementation rather than in AC?

--

___
Python tracker 

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



[issue28582] Invalid backslash syntax errors are not always accurate as to the location on the line where the error occurs

2016-12-10 Thread Martin Panter

Martin Panter added the comment:

I think there are actually two issues at play here:

1. The caret is not compensated for indentation removed from the code. This is 
what Issue 25677 was originally about. The current patch there will ensure that 
the behaviour is always like the second (top-level) case, no matter what the 
indentation was.

2. The caret points at the character before SyntaxError.offset. Sometimes the 
offset identifies the _end_ of the erroneous syntax, and the caret makes sense, 
because it points at the end of an invalid word (or directly at an invalid 
character). But other times, such as the invalid escape sequence, offset points 
at the _start_ of the invalid syntax, and the caret will point to the end of 
the previous valid syntax. This issue was brought up at the end of Issue 25677, 
but should probably be dealt with separately.

If you take the first case (indented function), and change the size of the 
indentation, you will see that the caret is no longer correct. It just happens 
that with four spaces, the two bugs kind of cancel each other out, and the 
positioning is actually better than it was designed to be :)

--
nosy: +martin.panter

___
Python tracker 

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



[issue28902] 3.6.0rc1 installer fails to install / uninstall.

2016-12-10 Thread Decorater

Decorater added the comment:

I found the registry keys for all python version Except for the keys that Adds 
it to path to manually uninstall the Add to Path. Other than that Everything 
Else has been found and take cared of manually thanks to Windows built in 
Registry Editor.

--

___
Python tracker 

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



[issue28928] IDLE crashes when opening .py file from Finder

2016-12-10 Thread Ned Deily

Ned Deily added the comment:

I'm glad you got it working.  The information at 
https://www.python.org/download/mac/tcltk/ pertains primarily to using Pythons 
from the python.org installers; it doesn't directly apply to Python instances 
built by and supplied by third-party distributors like Homebrew or MacPorts.  
So there is nothing wrong about them supplying and linking their Pythons with 
their own version of Tcl/Tk, be it 8.6.x or 8.5.x.  It would be good to figure 
out what the problem was that you saw and whether it is a general problem for 
other Homebrew users but that is out of scope for this tracker.

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



[issue28902] 3.6.0rc1 installer fails to install / uninstall.

2016-12-10 Thread Decorater

Changes by Decorater :


Added file: http://bugs.python.org/file45843/Python 3.6.0rc1 
(64-bit)_20161210164706.log

___
Python tracker 

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



[issue28902] 3.6.0rc1 installer fails to install / uninstall.

2016-12-10 Thread Decorater

Changes by Decorater :


Added file: http://bugs.python.org/file45842/Python 3.6.0rc1 
(64-bit)_20161210164706.log

___
Python tracker 

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



[issue28902] 3.6.0rc1 installer fails to install / uninstall.

2016-12-10 Thread Decorater

Changes by Decorater :


Removed file: http://bugs.python.org/file45842/Python 3.6.0rc1 
(64-bit)_20161210164706.log

___
Python tracker 

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



[issue28902] 3.6.0rc1 installer fails to install / uninstall.

2016-12-10 Thread Decorater

Decorater added the comment:

Well, not only that but now when I try to uninstall the 64 bit version it seems 
to not be able to find when on the "Add to path" part of Uninstaller
E:\ProgramData\Package Cache\{815FC13F-79DD-484C-8788-028D69569000}v3.6.121.0\
and some other folders.

I think What the webinstaller should do when it cant find the file/files is to 
download them again and then run the uninstall in case otherwise there is no 
other way to actually uninstall it.

--

___
Python tracker 

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



[issue28928] IDLE crashes when opening .py file from Finder

2016-12-10 Thread wkdewey

wkdewey added the comment:

The ultimate solution was to uninstall homebrew, since there is no obvious way 
to get it to use the right version of Tcl/Tk (8.5.18). And then to install the 
python binary from python.org, which does pick up the right version of Tcl/Tk. 

I can't remember why I was using homebrew, but the instructions at 
https://www.python.org/download/mac/tcltk/ (where you get pointed from IDLE) 
were a little unclear. I didn't realize that "if you are using OS X 10.9 or 
later and a Python from a python.org 64-bit/32-bit installer" didn't refer to 
the Python that came with macOS, or that I had to (or even could) install the 
python.org binary on top of the Python that was already there.

--
status: pending -> open

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-12-10 Thread Larry Hastings

Larry Hastings added the comment:

Okay, but do it with a converter function, not by changing the default behavior 
for Py_ssize_t.  The vast majority of uses of Py_ssize_t should not accept None.

--

___
Python tracker 

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



[issue28424] pkgutil.get_data() doesn't work with namespace packages

2016-12-10 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for the patch, Douglas!

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

___
Python tracker 

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



[issue28424] pkgutil.get_data() doesn't work with namespace packages

2016-12-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3484933ba904 by Brett Cannon in branch '3.5':
Issue #28424: Document pkgutil.get_data() doesn't work with namespace packages.
https://hg.python.org/cpython/rev/3484933ba904

New changeset c17d2a37d610 by Brett Cannon in branch '3.6':
Merge for issue #28424
https://hg.python.org/cpython/rev/c17d2a37d610

New changeset b396a2c97871 by Brett Cannon in branch 'default':
Merge for issue #28424
https://hg.python.org/cpython/rev/b396a2c97871

--
nosy: +python-dev

___
Python tracker 

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



[issue28925] Confusing exception from cPickle on reduce failure

2016-12-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think it is better to remove this code.

--
keywords: +patch
stage: needs patch -> patch review
Added file: 
http://bugs.python.org/file45841/load_classic_instance_error-2.7.patch

___
Python tracker 

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



[issue25035] Getter/setter for argparse keys

2016-12-10 Thread paul j3

paul j3 added the comment:

Yes, the information that `add_argument` returns a Action object is missing 
from the documentation.  It might be useful addition.

The documentation has many faults.  It isn't basic enough to be a tutorial, but 
many first time users use it as such, and get confused by its complexity.  But 
it also is not a formal reference document. And the automatic 'help(argparse)' 
isn't much better.

A regular user does not need to use the Action object directly.  But as a 
developer I often test argparse in an interactive shell (IPython), and the 
'out' line shows a 'str' of the object (as a summary of its attributes).  So 
assigning that object to a variable is just as natural to me as saving the 
parser object returned by argparse.ArgumentParser, or the group object returned 
by parser.add_argument_group.

--

___
Python tracker 

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



Can't find setuptools

2016-12-10 Thread Alonso López
Hi, I'm trying to install the package py-webrtcvad 
(github.com/wiseman/py-webrtcvad) and running into problems. Here's a summary 
of what I've tried so far:


·Installed Python 3.5 and set up the Windows path environment so that 
it works from any directory.

·Installed pip for Python.

·Tried to install the package with python -m pip install webrtcvad, but 
it failed, returning the error "Unable to find vcvarsall.bat".

·I found a blog that seems to deal with the problem vcvarsall.bat 
problem: 
blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/.
 Following the directions of that blog:

o   I installed Visual C++ Build Tools 2015. I tried running the program again 
straight away (without updating setuptools) and I received a lot of error 
messages which I didn't write down.

o   Following the directions in https://pypi.python.org/pypi/setuptools I 
removed the version of setuptools that came with my Python installation (v20), 
and installed the latest version (v30). This time the error message was 
"ImportError: No module named 'pip.utils.setuptools_build'".

o   Asked for assistance in the Python official chat. They made three 
suggestions:

§  Updating pip with python -m pip install --upgrade pip. Didn't work. Again, 
the error "ImportError: No module named 'pip.utils.setuptools_build'".

§  Reinstalling Visual C++ Build Tools 2015. No difference, same error again.

§  Reinstalling Python itself. The Python installer offers three choices: 
Repair, modify and uninstall.

·Repair: Didn't work. Same error.

·Modify: Doesn't look like it offers useful modifications for this.

·Uninstall: Uninstalled and reinstalled. Still the same error.
I'm out of ideas. Can you help me?

Thank you,

Alonso López

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28190] Cross-build _curses failed if host ncurses headers and target ncurses headers have different layouts

2016-12-10 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy:  -haypo

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-12-10 Thread Julien Palard

Julien Palard added the comment:

Hi Larry,

In any cases it looks like supporting hi=-1 and hi=None is mandatory: 

hi=None is the current implementation in the bisect (Python) module.
hi=-1 is the current implementation in the _bisect (C) module.

Both are currently living together, the C version takes over the Python version 
when available, but the Python version is older, so both -1 and None has been 
the "current implementation" during some time.

Raymond legitimately fear that someone, somewhere, used -1 in some code. We 
should not break it (even if it had never been documented).

So let's just accept both for the moment, and if deprecation of one or another 
should be discussed, let's do it later, in another issue. I'm _just_ trying to 
make AC move forward here, without breaking anything.

--

___
Python tracker 

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



[issue25711] Rewrite zipimport from scratch

2016-12-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Technically, will it be possible to freeze it?

I think yes. But I don't know how to do this. I hope on Brett's (or other 
import machinery expert) help.

Since zipimporter constructor is called only with string path by import 
machinery, the os module is not imported at initialization stage.

--

___
Python tracker 

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



[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2016-12-10 Thread paul j3

Changes by paul j3 :


--
priority: normal -> high

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-12-10 Thread Larry Hastings

Larry Hastings added the comment:

FWIW, pypy uses defaults of lo=0, hi=None.

https://bitbucket.org/pypy/pypy/src/25da7bc9719457aee57547993833d5168ba6aded/lib-python/2.7/bisect.py?at=default=file-view-default

--

___
Python tracker 

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



[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Larry Hastings

Larry Hastings added the comment:

It looks like you did it with a converter for 28754.  That's okay.  But not in 
the default implementation.

--

___
Python tracker 

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



[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Larry Hastings

Larry Hastings added the comment:

You propose an automatic conversion of "None" into "-1"?  That's awful.  Please 
don't commit that patch to CPython.

--

___
Python tracker 

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



Re: CLP stats: last 500 posts

2016-12-10 Thread Terry Reedy

On 12/10/2016 9:43 AM, Steve D'Aprano wrote:

On Sat, 10 Dec 2016 09:28 pm, Terry Reedy wrote:


The spammer will still be counted,


Why reward someone who actively evades defenses?  If you want to count
spam, it is mostly missing, at least as far as python-list is concerned.


Its not a reward. Spammers are not like trolls, they don't hang around to
see the result of their posts.


To me, the relevant difference is between posts related to python and 
those not.  It is usually clear which is which.


> There no evidence at all that this Italian

spammer is looking for replies or responses to his(?) posts. He apparently
just fires them out.

I think that it is relevant that comp.lang.python receives X spam messages
from a certain person. It gives a picture of the health of the newsgroup:
how much of it is spam? Hopefully only a small amount.


Python-list gets unrelated-to-python spam from lots of people.  They are 
not outliers (unlike jmf's now blocked trolls), but contaminents from a 
different universe.


I agree that the fraction of messages that are clearly spam has some 
interest in itself, and definitely should be as small as possible. But I 
contend that they should be excluded from a study of the universe of 
python-related messages.


My other point is that this small sliver that used to get passed through 
is extremely biased and statistically worthless as a study of 
python-list spamming.  If one wanted to study the rate and nature of 
contamination, or the effectiveness of filtering, one would need access 
to the raw stream of submissions.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


[issue16737] Different behaviours in script run directly and via runpy.run_module

2016-12-10 Thread Jason R. Coombs

Jason R. Coombs added the comment:

I've found some other inconsistencies with the use of python -m. One is the 
surprising behavior when running pip:

$ touch logging.py
$ pip --help > /dev/null
$ python -m pip --help > /dev/null
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", 
line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", 
line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", 
line 109, in _get_module_details
__import__(pkg_name)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/__init__.py",
 line 21, in 
from pip._vendor.requests.packages.urllib3.exceptions import 
DependencyWarning
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py",
 line 62, in 
from .packages.urllib3.exceptions import DependencyWarning
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py",
 line 27, in 
from . import urllib3
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py",
 line 8, in 
from .connectionpool import (
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py",
 line 35, in 
from .connection import (
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connection.py",
 line 44, in 
from .util.ssl_ import (
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/util/__init__.py",
 line 20, in 
from .retry import Retry
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/util/retry.py",
 line 15, in 
log = logging.getLogger(__name__)
AttributeError: module 'logging' has no attribute 'getLogger'

Obviously this is a case of don't create any files that mask stdlib or other 
modules that your call stack might try to import. But the takeaway is that you 
can't in general rely on `python -m` to launch behavior comparable to launching 
a script.


Additionally, this inconsistency led to a [subtle bug in pytest when launched 
with -m](https://github.com/pytest-dev/pytest/issues/2104). In that ticket, the 
recommended solution (at least thusfar) is "don't use -m". I imagine that 
pytest (and every other project that exposes a module for launching core 
behavior) could work around the issue by explicitly removing the cwd from 
sys.path, but that seems messy.

I imagine it could prove difficult to overcome the backward incompatibilities 
of changing this behavior now, so I don't have a strong recommendation, but I 
wanted to share these experiences and get feedback and recommendations.

--
nosy: +jason.coombs

___
Python tracker 

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



[issue25711] Rewrite zipimport from scratch

2016-12-10 Thread Gregory P. Smith

Gregory P. Smith added the comment:

So long as this code block that imports os is avoided, I believe that this can 
be properly frozen:

+if not isinstance(path, str):
+import os
+path = os.fsdecode(path)

But it should be easy to avoid that code path when the standard library is a 
zip file.

Otherwise it uses importlib (frozen), marshal (builtin), sys (builtin), time 
(builtin), and zlib [if present] (extension module).

--

___
Python tracker 

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



[issue28931] urllib ignores FTP 226 response, breaking further FTP requests

2016-12-10 Thread Ivan Pozdeev

Changes by Ivan Pozdeev :


--
keywords: +patch
Added file: http://bugs.python.org/file45840/105577.patch

___
Python tracker 

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



[issue28424] pkgutil.get_data() doesn't work with namespace packages

2016-12-10 Thread Brett Cannon

Changes by Brett Cannon :


--
versions: +Python 3.7 -Python 3.4

___
Python tracker 

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



[issue28424] pkgutil.get_data() doesn't work with namespace packages

2016-12-10 Thread Brett Cannon

Brett Cannon added the comment:

Patch LGTM.

--
stage:  -> commit review

___
Python tracker 

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



[issue28425] Python3 ignores __init__.py that are links to /dev/null

2016-12-10 Thread Brett Cannon

Brett Cannon added the comment:

Those results are expected as passing in a file by path means it's just read by 
open() and then passed to exec() while the others pass through import itself 
which has the os.path.isfile() check.

Since this is a change from Python 2.7 I would be willing to look at a patch 
that loosened things that was fully backwards-compatible, but it would be an 
enhancement and not a bugfix.

--

___
Python tracker 

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



[issue28929] Provide a link from documentation back to its source file

2016-12-10 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Thanks, Brett :) I think it's easier to update the existing Source Link to 
github. I'll work on a patch for this.

--

___
Python tracker 

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



[issue28924] Inline PyEval_EvalFrameEx() in callers

2016-12-10 Thread Brett Cannon

Brett Cannon added the comment:

Inlining wouldn't break Pyjion since all of its smarts would be in the 
trampoline function in PyInterpreterState. It may break other debuggers like 
Python Tools for Visual Studio, though (+steve.dower for that).

But is the overhead honestly that high to warrant inlining? What kind of perf 
gain do you see from doing this? My worry is that if the perf isn't that much 
better that inlining will simply make it harder to tweak that function in the 
future.

--
nosy: +dino.viehland, steve.dower

___
Python tracker 

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



[issue28929] Provide a link from documentation back to its source file

2016-12-10 Thread Brett Cannon

Brett Cannon added the comment:

Either idea works, but I want a link that someone who finds a spelling mistake 
can easily follow and submit a PR to fix the issue.

--

___
Python tracker 

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



[issue28935] distutils use ConfigParser in Python 3.x and fails to parse setup.cfg with percent sign

2016-12-10 Thread Axel Haustant

New submission from Axel Haustant:

Because of the Python 3.2 configparser renaming/refactoring, string 
interpolation has been enabled into distutils config parsing and so fails to 
read any setup.cfg with percent signs (try to perform string interpolation and 
fails).


To reproduce: create a project with a percent sign anywhere in the setup.cfg 
file and execute python setup.py egg_info.
It will pass on Python 2.x and fails on Python 3.x.

The attached patch suimply disable string interpolation in distutils config 
parsing.

That would be awesome to have this applied on any 3.x version (because project 
using tox to test against different Python versions also fails with the same 
issue Python 3.x and PyPI 3.x)

--
components: Distutils
files: disable-distutils-string-interpolation.patch
keywords: patch
messages: 282865
nosy: Axel Haustant, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: distutils use ConfigParser in Python 3.x and fails to parse setup.cfg 
with percent sign
type: crash
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: 
http://bugs.python.org/file45839/disable-distutils-string-interpolation.patch

___
Python tracker 

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



Re: CLP stats: last 500 posts

2016-12-10 Thread Peter Otten
Wildman via Python-list wrote:

> On Fri, 09 Dec 2016 16:07:16 -0500, DFS wrote:
> 
>> code (py2.7)
>> --
>> import sys as y,nntplib as t,datetime as d
>> s=''
>> g=y.argv[1]
>> n=t.NNTP(s,119,'','')
>> r,a,b,e,gn=n.group(g)
>> def printStat(st,hd,rg):
>> r,d=n.xhdr(st,'%s-%s'%rg)
>> p=[]
>> for i in range(len(d)):
>> v=d[i][1]
>> if st=='Subject':v=v[4:] if v[:3]=='Re:' else v
>> p.append(v)
>> x=[(i,p.count(i)) for i in set(p)]
>> x.sort(key=lambda s:(-s[1],s[0].lower()))
>> print('Posts  %s %s'%(len(set(p)),hd))
>> for v in x: print(' %s %s'%(v[1],v[0]))
>> print
>> print 'As of '+d.datetime.now().strftime("%I:%M%p %B %d, %Y") + '\n'
>> m=(int(e)-int(y.argv[3])+1,int(e))
>> printStat("From","Posters",m)
>> printStat("Subject","Subjects",m)
>> printStat("User-Agent","User-Agents",m)
>> n.quit()
>> --
>> 
>> usage on Windows:
>> $ python stats.py group last N
>> $ python stats.py comp.lang.python last 500
> 
> Do you happen to have a translation of the code that will
> run on Linux?
> 
> $ ./nntp.py comp.lang.python last 500
> Traceback (most recent call last):
>   File "./nntp.py", line 7, in 
> n=t.NNTP(s,119,'','')
>   File "/usr/lib/python2.7/nntplib.py", line 119, in __init__
> self.sock = socket.create_connection((host, port))
>   File "/usr/lib/python2.7/socket.py", line 553, in create_connection
> for res in getaddrinfo(host, port, 0, SOCK_STREAM):
> socket.gaierror: [Errno -2] Name or service not known
> 

That's not a Linux problem. For the code to run in 

>> s=''

>> n=t.NNTP(s,119,'','')

you need to replace the '<...>' strings with a real news server, user, and 
password. If you use Gmane no password is required:

n = t.NNTP("news.gmane.org")

However, they use a different name for the "comp.lang.python" group, so you 
have to modify the command line accordingly:

$ python stats.py gmane.comp.python.general last 500


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: CLP stats: last 500 posts

2016-12-10 Thread Wildman via Python-list
On Sat, 10 Dec 2016 12:31:33 -0500, DFS wrote:

> On 12/10/2016 12:06 PM, Wildman wrote:
>> On Fri, 09 Dec 2016 16:07:16 -0500, DFS wrote:
>>
>>> code (py2.7)
>>> --
>>> import sys as y,nntplib as t,datetime as d
>>> s=''
>>> g=y.argv[1]
>>> n=t.NNTP(s,119,'','')
>>> r,a,b,e,gn=n.group(g)
>>> def printStat(st,hd,rg):
>>> r,d=n.xhdr(st,'%s-%s'%rg)
>>> p=[]
>>> for i in range(len(d)):
>>> v=d[i][1]
>>> if st=='Subject':v=v[4:] if v[:3]=='Re:' else v
>>> p.append(v)
>>> x=[(i,p.count(i)) for i in set(p)]
>>> x.sort(key=lambda s:(-s[1],s[0].lower()))
>>> print('Posts  %s %s'%(len(set(p)),hd))
>>> for v in x: print(' %s %s'%(v[1],v[0]))
>>> print
>>> print 'As of '+d.datetime.now().strftime("%I:%M%p %B %d, %Y") + '\n'
>>> m=(int(e)-int(y.argv[3])+1,int(e))
>>> printStat("From","Posters",m)
>>> printStat("Subject","Subjects",m)
>>> printStat("User-Agent","User-Agents",m)
>>> n.quit()
>>> --
>>>
>>> usage on Windows:
>>> $ python stats.py group last N
>>> $ python stats.py comp.lang.python last 500
>>
>> Do you happen to have a translation of the code that will
>> run on Linux?
>>
>> $ ./nntp.py comp.lang.python last 500
>> Traceback (most recent call last):
>>   File "./nntp.py", line 7, in 
>> n=t.NNTP(s,119,'','')
>>   File "/usr/lib/python2.7/nntplib.py", line 119, in __init__
>> self.sock = socket.create_connection((host, port))
>>   File "/usr/lib/python2.7/socket.py", line 553, in create_connection
>> for res in getaddrinfo(host, port, 0, SOCK_STREAM):
>> socket.gaierror: [Errno -2] Name or service not known
> 
> 
> That code runs unchanged on py2.7 on Linux (I just now tested it).
> 
> You just need to put in your own credentials for the newsserver, user 
> and password (lines 2 and 4).

OK, thanks.  That didn't occur to me although it should have.
 
-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28754] Argument Clinic for bisect.bisect_left

2016-12-10 Thread Julien Palard

Julien Palard added the comment:

Maybe wait for issue28933.

--

___
Python tracker 

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



[issue28934] _mboxMMDF#get_message should delegate to get_bytes

2016-12-10 Thread bpoaugust

New submission from bpoaugust:

At present both _mboxMMDF#get_message and get_bytes read the file directly.

However the code in get_bytes duplicates some of the code in get_message. 
get_message should be recoded to use get_bytes.

It would then be possible to override get_bytes (which is also used by 
get_string) in order to transform the input stream e.g. to unmangle '>From ' 
lines.

But in any case it makes sense to reuse the code - DRY

--
components: email
messages: 282863
nosy: barry, bpoaugust, r.david.murray
priority: normal
severity: normal
status: open
title: _mboxMMDF#get_message should delegate to get_bytes
type: enhancement

___
Python tracker 

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



Pexpect

2016-12-10 Thread Iranna Mathapati
Hi Team,



The fallowing script(function) is working if its in PDB mode(trace line by
line) but same script is not working if its remove/comment PDB and run one
shot.



log.info("Time out expection")

uut_con1 = pexpect.spawn('telnet %s'%power_ip)

uut_con1.logfile = sys.stdout

uut_con1.delaybeforesend = None

time.sleep(30)

uut_con1.send("%s\r" % username)

uut_con1.expect([r"Password:"],timeout=30)

uut_con1.send("%s\r" % pass_word)

time.sleep(30)

uut_con1.send("\r")

uut_con1.expect([r'#?'],timeout=30)

uut_con1.send("power outlets %d off\r"%outlet)

uut_con1.expect([r'wish to turn outlet'],timeout=30)

uut_con1.send("y\r")

uut_con1.send("\r")

uut_con1.expect([r'#?'],timeout=30)

uut_con1.send("power outlets %d on\r"%outlet)

uut_con1.expect([r'wish to turn outlet'],timeout=30)

uut_con1.send("y\r")

uut_con1.send("\r")

uut_con1.expect([r'#?'],timeout=30)

uut_con1.close()

uut_con.close()

time.sleep(300)


check_prompt(self,username,pass_word,dev_ip,dev_port,power_ip,outlet)



*I got fallowing error:*



2016-12-10T02:24:42: %aetest-INFO: Time out expection

Trying 172.31.206.143...

Connected to 172.31.206.143.

Escape character is '^]'.

Login for PX2 CLI

Username: admin

power outlets 21 off



Welcome to PX2 CLI!

Last login: 2001-06-30 11:53:59 EDT [CLI (Telnet) from 172.31.144.6]



#

# power outlets 21 off



yower outlets 21 on outlet 21 off? [y/n] y



power outlets 21 on

# 2016-12-10T02:26:12: %aetest-ERROR: Caught exception during execution:

2016-12-10T02:26:13: %aetest-ERROR: Traceback (most recent call last):

2016-12-10T02:26:13: %aetest-ERROR:   File
"/auto/n3k-qa/CODC/rajtamil/pyATS2.7/hlite/eor/systest/scripts/NAT/ATS_CLEAN_N9K.py",
line 354, in connect_devices

2016-12-10T02:26:13: %aetest-ERROR:
check_prompt(self,username,pass_word,dev_ip,dev_port,power_ip,outlet)

2016-12-10T02:26:13: %aetest-ERROR:   File
"/auto/n3k-qa/CODC/rajtamil/pyATS2.7/hlite/eor/systest/scripts/NAT/ATS_CLEAN_N9K.py",
line 282, in check_prompt

2016-12-10T02:26:13: %aetest-ERROR: uut_con1.expect([r'wish to turn
outlet'],timeout=30)

2016-12-10T02:26:13: %aetest-ERROR:   File
"/auto/n3k-qa/CODC/svanalin/pyats2/lib/python2.7/site-packages/pexpect/spawnbase.py",
line 321, in expect

2016-12-10T02:26:13: %aetest-ERROR: timeout, searchwindowsize, async)

2016-12-10T02:26:13: %aetest-ERROR:   File
"/auto/n3k-qa/CODC/svanalin/pyats2/lib/python2.7/site-packages/pexpect/spawnbase.py",
line 345, in expect_list

2016-12-10T02:26:13: %aetest-ERROR: return exp.expect_loop(timeout)

2016-12-10T02:26:13: %aetest-ERROR:   File
"/auto/n3k-qa/CODC/svanalin/pyats2/lib/python2.7/site-packages/pexpect/expect.py",
line 107, in expect_loop

2016-12-10T02:26:13: %aetest-ERROR: return self.timeout(e)

2016-12-10T02:26:13: %aetest-ERROR:   File
"/auto/n3k-qa/CODC/svanalin/pyats2/lib/python2.7/site-packages/pexpect/expect.py",
line 70, in timeout

2016-12-10T02:26:13: %aetest-ERROR: raise TIMEOUT(msg)

2016-12-10T02:26:13: %aetest-ERROR: TIMEOUT: Timeout exceeded.

2016-12-10T02:26:13: %aetest-ERROR: 

2016-12-10T02:26:13: %aetest-ERROR: command: /usr/bin/telnet

2016-12-10T02:26:13: %aetest-ERROR: args: ['/usr/bin/telnet',
'172.31.206.143']

2016-12-10T02:26:13: %aetest-ERROR: buffer (last 100 chars): ' 21 off?
[y/n] y\r\n\r\npower outlets 21 on\r\n# '

2016-12-10T02:26:13: %aetest-ERROR: before (last 100 chars): ' 21 off?
[y/n] y\r\n\r\npower outlets 21 on\r\n# '

2016-12-10T02:26:13: %aetest-ERROR: after: 

2016-12-10T02:26:13: %aetest-ERROR: match: None

2016-12-10T02:26:13: %aetest-ERROR: match_index: None

2016-12-10T02:26:13: %aetest-ERROR: exitstatus: None

2016-12-10T02:26:13: %aetest-ERROR: flag_eof: False

2016-12-10T02:26:13: %aetest-ERROR: pid: 9163

2016-12-10T02:26:13: %aetest-ERROR: child_fd: 18

2016-12-10T02:26:13: %aetest-ERROR: closed: False

2016-12-10T02:26:13: %aetest-ERROR: timeout: 30

2016-12-10T02:26:13: %aetest-ERROR: delimiter: 

2016-12-10T02:26:13: %aetest-ERROR: logfile: ', mode
'w' at 0xf7712078>

2016-12-10T02:26:13: %aetest-ERROR: logfile_read: None

2016-12-10T02:26:13: %aetest-ERROR: logfile_send: None

2016-12-10T02:26:13: %aetest-ERROR: maxread: 2000

2016-12-10T02:26:13: %aetest-ERROR: ignorecase: False

2016-12-10T02:26:13: %aetest-ERROR: searchwindowsize: None

2016-12-10T02:26:13: %aetest-ERROR: delaybeforesend: None

2016-12-10T02:26:13: %aetest-ERROR: delayafterclose: 0.1

2016-12-10T02:26:13: %aetest-ERROR: delayafterterminate: 0.1

2016-12-10T02:26:13: %aetest-ERROR: searcher: searcher_re:

2016-12-10T02:26:13: %aetest-ERROR: 0: re.compile("wish to turn outlet")

2016-12-10T02:26:13: %aetest-INFO: The result of subsection connect_devices
is => ERRORED





Regards,
Iranna M
-- 

[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Julien Palard

Julien Palard added the comment:

Proposed a patch, but I'm not a huge fan of modifying getargs.c. If it's 
accepted, I'll obviously need to write tests before this is merged.

--
keywords: +patch
Added file: http://bugs.python.org/file45838/issue28933.diff

___
Python tracker 

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



[issue28933] AC: Accept None as a Py_ssize_t default value

2016-12-10 Thread Julien Palard

Changes by Julien Palard :


--
title: AC: Accept None as a default value for any type -> AC: Accept None as a 
Py_ssize_t default value

___
Python tracker 

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



[issue28933] AC: Accept None as a default value for any type

2016-12-10 Thread Julien Palard

New submission from Julien Palard:

Today, writing an AC declaration like:

something: Py_ssize_t(c_default="-1") = None

Leads to the almost obvious "Py_ssize_t_converter: default value None for field 
something is not of type int".

But it actually make sense: 
 - Accept None as a default python value
 - Document "something=None" in the docstring
 - Write `Py_ssize_t something = -1` in the C code
 - Don't try to parse the argument if it's the default value, keeping the value 
from the C initialization

In other words, it's a "Give -1 to the C implementation when argument is not 
given or None, and it may be usefull, typically I'll use it in issue28754.

--
components: Argument Clinic
messages: 282861
nosy: larry, mdk
priority: normal
severity: normal
status: open
title: AC: Accept None as a default value for any type
versions: Python 3.7

___
Python tracker 

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



Re: CLP stats: last 500 posts

2016-12-10 Thread Wildman via Python-list
On Fri, 09 Dec 2016 16:07:16 -0500, DFS wrote:

> code (py2.7)
> --
> import sys as y,nntplib as t,datetime as d
> s=''
> g=y.argv[1]
> n=t.NNTP(s,119,'','')
> r,a,b,e,gn=n.group(g)
> def printStat(st,hd,rg):
>   r,d=n.xhdr(st,'%s-%s'%rg)
>   p=[]
>   for i in range(len(d)):
>   v=d[i][1]
>   if st=='Subject':v=v[4:] if v[:3]=='Re:' else v
>   p.append(v)
>   x=[(i,p.count(i)) for i in set(p)]
>   x.sort(key=lambda s:(-s[1],s[0].lower()))
>   print('Posts  %s %s'%(len(set(p)),hd))
>   for v in x: print(' %s %s'%(v[1],v[0]))
>   print
> print 'As of '+d.datetime.now().strftime("%I:%M%p %B %d, %Y") + '\n'
> m=(int(e)-int(y.argv[3])+1,int(e))
> printStat("From","Posters",m)
> printStat("Subject","Subjects",m)
> printStat("User-Agent","User-Agents",m)
> n.quit()
> --
> 
> usage on Windows:
> $ python stats.py group last N
> $ python stats.py comp.lang.python last 500

Do you happen to have a translation of the code that will
run on Linux?

$ ./nntp.py comp.lang.python last 500
Traceback (most recent call last):
  File "./nntp.py", line 7, in 
n=t.NNTP(s,119,'','')
  File "/usr/lib/python2.7/nntplib.py", line 119, in __init__
self.sock = socket.create_connection((host, port))
  File "/usr/lib/python2.7/socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known

-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28932] Fail compile Python 3.6.0rc1 on OpenBSD 6.0

2016-12-10 Thread Alexandr Shadchin

New submission from Alexandr Shadchin:

In OpenBSD not exist sys/random.h.

--
components: Build, Installation
files: patch-Python_random_c
messages: 282860
nosy: Alexandr Shadchin
priority: normal
severity: normal
status: open
title: Fail compile Python 3.6.0rc1 on OpenBSD 6.0
type: compile error
versions: Python 3.6
Added file: http://bugs.python.org/file45837/patch-Python_random_c

___
Python tracker 

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



[issue28849] do not define sys.implementation._multiarch on Android

2016-12-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b3ba41bf92c7 by Xavier de Gaye in branch '3.6':
Issue #28849: Do not define sys.implementation._multiarch on Android.
https://hg.python.org/cpython/rev/b3ba41bf92c7

New changeset 40e8b39199da by Xavier de Gaye in branch 'default':
Issue #28849: Merge 3.6.
https://hg.python.org/cpython/rev/40e8b39199da

--
nosy: +python-dev

___
Python tracker 

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



[issue28779] set_forkserver_preload() can crash the forkserver if preloaded module instantiate multiprocessing classes

2016-12-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Now fixed, closing.

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



[issue28779] set_forkserver_preload() can crash the forkserver if preloaded module instantiate multiprocessing classes

2016-12-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1a955981b263 by Antoine Pitrou in branch '3.5':
Issue #28779: multiprocessing.set_forkserver_preload() would crash the 
forkserver process if a preloaded module instantiated some multiprocessing 
objects such as locks.
https://hg.python.org/cpython/rev/1a955981b263

New changeset f3b9fd41b5cb by Antoine Pitrou in branch '3.6':
Issue #28779: multiprocessing.set_forkserver_preload() would crash the 
forkserver process if a preloaded module instantiated some multiprocessing 
objects such as locks.
https://hg.python.org/cpython/rev/f3b9fd41b5cb

New changeset 5456b699788f by Antoine Pitrou in branch 'default':
Issue #28779: multiprocessing.set_forkserver_preload() would crash the 
forkserver process if a preloaded module instantiated some multiprocessing 
objects such as locks.
https://hg.python.org/cpython/rev/5456b699788f

--
nosy: +python-dev

___
Python tracker 

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



Re: CLP stats: last 500 posts

2016-12-10 Thread Skip Montanaro
On Sat, Dec 10, 2016 at 4:28 AM, Terry Reedy  wrote:
>> comp.lang.python is a mirror of the python-list at python dot org mailing
>> list, which has an official web archive:
>>
>> https://mail.python.org/pipermail/python-list/
>
>
> These slanderous posts, in particular, are hand-removed from the archive
> when they get past the automatic filters.  They are no more part of
> python-list than other spam.

Are they still getting past SpamBayes? A couple months ago, I trained
the instance on m.p.o on a few of those spams. I haven't seen any
others since then, and no messages on the postmaster list discussing
them. I just skimmed the archives for November and December but saw no
examples. Generally, when Ralf or Mark delete spams, then manually
rewrite the Subject: and From: headers and zero out the message body.
I saw nothing like those placeholders either.

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28918] cross compiling xxlimited fails with "Py_LIMITED_API is incompatible with Py_DEBUG"

2016-12-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f9e0c864157c by Xavier de Gaye in branch '3.6':
Issue #28918: Fix the cross compilation of xxlimited when Python
https://hg.python.org/cpython/rev/f9e0c864157c

New changeset ff82dfd558df by Xavier de Gaye in branch 'default':
Issue #28918: Merge 3.6.
https://hg.python.org/cpython/rev/ff82dfd558df

--
nosy: +python-dev

___
Python tracker 

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



[issue28931] urllib ignores FTP 226 response, breaking further FTP requests

2016-12-10 Thread Ivan Pozdeev

Ivan Pozdeev added the comment:

The attached patch fixes this case. It still leaves the following problem:

>>> u=urllib.urlopen("ftp://ftp.zlatkovic.com/pub/libxml/md5sum.txt;).read()
>>> urllib.urlretrieve("ftp://ftp.zlatkovic.com/pub/libxml/md5sum.txt","t.bin;)
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Py\lib\urllib.py", line 98, in urlretrieve
return opener.retrieve(url, filename, reporthook, data)
  File "C:\Py\lib\urllib.py", line 245, in retrieve
fp = self.open(url, data)
  File "C:\Py\lib\urllib.py", line 213, in open
return getattr(self, name)(url)
  File "C:\Py\lib\urllib.py", line 558, in open_ftp
(fp, retrlen) = self.ftpcache[key].retrfile(file, type)
  File "C:\Py\lib\urllib.py", line 906, in retrfile
conn, retrlen = self.ftp.ntransfercmd(cmd)
  File "C:\Py\lib\ftplib.py", line 334, in ntransfercmd
host, port = self.makepasv()
  File "C:\Py\lib\ftplib.py", line 312, in makepasv
host, port = parse227(self.sendcmd('PASV'))
  File "C:\Py\lib\ftplib.py", line 830, in parse227
raise error_reply, resp
IOError: [Errno ftp error] 200 Type set to I

I reckon this can't be fully fixed without fixing `ftplib' first, see 
issue25458.

--

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-12-10 Thread Julien Palard

Changes by Julien Palard :


Added file: http://bugs.python.org/file45836/issue28754-9.diff

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-12-10 Thread Julien Palard

Julien Palard added the comment:

Added a test to ensure compatibility of both hi=None (introduced in original 
Python version) and hi=-1 (Introduced by the C version).

Modified Python version to be compatible with the C-introduced hi=-1, so that 
the new test pass.

--

___
Python tracker 

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



[issue28931] urllib ignores FTP 226 response, breaking further FTP requests

2016-12-10 Thread Ivan Pozdeev

New submission from Ivan Pozdeev:

>>> urllib.urlretrieve("ftp://ftp.zlatkovic.com/pub/libxml/md5sum.txt","t.bin;)
('t.bin', )
>>> urllib.urlretrieve("ftp://ftp.zlatkovic.com/pub/libxml/md5sum.txt","t.bin;)
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Py\lib\urllib.py", line 98, in urlretrieve
return opener.retrieve(url, filename, reporthook, data)
  File "C:\Py\lib\urllib.py", line 245, in retrieve
fp = self.open(url, data)
  File "C:\Py\lib\urllib.py", line 213, in open
return getattr(self, name)(url)
  File "C:\Py\lib\urllib.py", line 558, in open_ftp
(fp, retrlen) = self.ftpcache[key].retrfile(file, type)
  File "C:\Py\lib\urllib.py", line 906, in retrfile
conn, retrlen = self.ftp.ntransfercmd(cmd)
  File "C:\Py\lib\ftplib.py", line 334, in ntransfercmd
host, port = self.makepasv()
  File "C:\Py\lib\ftplib.py", line 312, in makepasv
host, port = parse227(self.sendcmd('PASV'))
  File "C:\Py\lib\ftplib.py", line 830, in parse227
raise error_reply, resp
IOError: [Errno ftp error] 200 Type set to I

The cause is the 226 Transfer Complete response being ignored, causing further 
response lines to be incorrectly matched to request lines.

The bug is a result of issue16270 for 3.x and issue26960 for 2.7.

--
components: Library (Lib)
files: ftp_error_illustration.txt
messages: 282853
nosy: Ivan.Pozdeev
priority: normal
severity: normal
status: open
title: urllib ignores FTP 226 response, breaking further FTP requests
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45835/ftp_error_illustration.txt

___
Python tracker 

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



Re: CLP stats: last 500 posts

2016-12-10 Thread Steve D'Aprano
On Sat, 10 Dec 2016 09:28 pm, Terry Reedy wrote:

>>> The spammer will still be counted,
> 
> Why reward someone who actively evades defenses?  If you want to count
> spam, it is mostly missing, at least as far as python-list is concerned.

Its not a reward. Spammers are not like trolls, they don't hang around to
see the result of their posts. There no evidence at all that this Italian
spammer is looking for replies or responses to his(?) posts. He apparently
just fires them out.

I think that it is relevant that comp.lang.python receives X spam messages
from a certain person. It gives a picture of the health of the newsgroup:
how much of it is spam? Hopefully only a small amount.


> These slanderous posts, in particular, are hand-removed from the archive
> when they get past the automatic filters.  They are no more part of
> python-list than other spam.

Indeed. But although c.l.p is a mirror of the mailing list, it is not a
*perfect* mirror. The two do diverge: some things go to the mailing list
but apparently never make it to the newsgroup, and some things get to the
newsgroup but don't make it to the mailing list.

The stats generated by DFS are relevant to that.


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue5322] Python 2.6 object.__new__ argument calling autodetection faulty

2016-12-10 Thread Tobias Hansen

Tobias Hansen added the comment:

This change breaks backward compatibility in Python 2.7. This is the example 
that also broke in #25731. In that case the change was reverted. See 
https://bugs.python.org/issue25731#msg262922

$ cat foo.pxd 
cdef class B:
cdef object b
$ cat foo.pyx 
cdef class A:
pass

cdef class B:
def __init__(self, b):
self.b = b
$ cat bar.py
from foo import A, B

class C(A, B):
def __init__(self):
B.__init__(self, 1)

C()
$ cython foo.pyx && gcc -I/usr/include/python2.7 -Wall -shared -fPIC -o foo.so 
foo.c
$ python -c 'import bar'
Traceback (most recent call last):
  File "", line 1, in 
  File "bar.py", line 7, in 
C()
TypeError: foo.A.__new__(C) is not safe, use foo.B.__new__()

--
nosy: +thansen

___
Python tracker 

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



[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2016-12-10 Thread Aviv Palivoda

Aviv Palivoda added the comment:

Pinging as mentioned in the devguide.

--

___
Python tracker 

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



[issue26960] urllib hangs when closing connection

2016-12-10 Thread Ivan Pozdeev

Ivan Pozdeev added the comment:

This fix has caused issue25458 to manifest itself in `urllib', too. AFAICS, 
it's impossible to fully fix `urllib' to correctly handle end-of-transmission 
response without fixing `ftplib' first.

--
nosy: +Ivan.Pozdeev

___
Python tracker 

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



[issue28815] test_socket fails if /proc/modules is existent but not readable

2016-12-10 Thread patrila

patrila added the comment:

Oops, sorry that was the draft version of the patch.
Attached the correct version. It was tested against "default" branch (but not 
against 2.7).

--
Added file: 
http://bugs.python.org/file45834/test_socket_isTipcAvailable_proc_modules.patch

___
Python tracker 

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



[issue28190] Cross-build _curses failed if host ncurses headers and target ncurses headers have different layouts

2016-12-10 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

@xdegaye: no-path-to-ncursesw.patch fixes a problem yet introducing a new one. 
With that patch auto-detection of ncurses include files are broken. Now users 
have to specify the path manually even for native builds.

--

___
Python tracker 

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



Painting Contractors in Vasant nagar | Painting Contractors in Rajaji nagar

2016-12-10 Thread busybizz bizz
Painting Contractors in Bangalore - List of top painting services, works, 
companies in Bangalore and get painting price, companies contact addresses, 
phone numbers, ratings and evaluations right away on busybizz.com
http://busybizz.com/Painting-Contractors-Bangalore.php
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28930] bytes_methods.c won't recompile if related stringlib/* changed

2016-12-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Makefile-bytes-methods-v2.patch LGTM.

--

___
Python tracker 

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



[issue28930] bytes_methods.c won't recompile if related stringlib/* changed

2016-12-10 Thread Xiang Zhang

Xiang Zhang added the comment:

> Alternatively just BYTESTR_DEPS can be used instead of BYTESMETHODS_DEPS. 
> This would make easier moving implementations between bytesobject.c and 
> bytes_methods.c.

Yes. The only downside of this is some changes may recompile bytes_methods.c 
unnecessarily but this is not a matter.

> But be aware of possible differences in 3.5.

In 3.5 bytes_methods.c doesn't rely on stringlib/*.

--
nosy: +haypo
versions:  -Python 3.5
Added file: http://bugs.python.org/file45833/Makefile-bytes-methods-v2.patch

___
Python tracker 

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



[issue25677] Syntax error caret confused by indentation

2016-12-10 Thread Martin Panter

Martin Panter added the comment:

(Long story short: need to strip form feeds in print_error_text(), but I agree 
that this otherwise does fix a bug.)

There is one minor regression that this patch causes IMO. Given the following 
file, where  represents a form feed character ('\014')

if True:
1 + 1 = 2

the error report now has a blank line (due to outputting the FF character) and 
extra indentation that wasn’t stripped:

  File "indent.py", line 2

1 + 1 = 2
^
SyntaxError: can't assign to operator

I think the fix for this is to strip form feed characters in 
print_error_text(), in Python/pythonrun.c.

Apart from that, I agree with Serhiy and Michael that it is okay to push this 
change. The bug that we are fixing is that SyntaxError.offset does not 
correspond with SyntaxError.text, due to indentation. Before the patch, the 
offset refers to the line without indentation removed, but the text has 
indentation removed. Here is a really bad case, where there is more indentation 
than code, print_error_text() tries to find the next line, and ends up printing 
a blank line:

>>> code = "if True:\n" + " "*16 + "1 + 1 = 2\n"
>>> with open("indent.py", "wt") as f: f.write(code)
... 
35
>>> try: compile(code, "indent.py", "exec")
... except SyntaxError as err:
... print("offset={err.offset} text={err.text!r}".format(err=err))
... raise
... 
offset=16 text='1 + 1 = 2\n'
Traceback (most recent call last):
  File "", line 1, in 
  File "indent.py", line 2

 ^
SyntaxError: can't assign to operator

In Michael’s original report, I was curious why the caret is only shifted three 
spaces, despite there being four spaces of indentation. This is because offset 
points to the start of the line, but the caret points to the character _before_ 
offset. So offset=0 and offset=1 are both represented by pointing at the first 
character on the line. This is related to Serhiy’s bug with inserting “1;”. In 
some cases (e.g. the line “1 +”), the offset is the string index _after_ the 
error. But in the case of “1;1 + 1 = 2”, offset is the index where the error 
(statement) begins.

Both pieces of indentation stripping code were added in revision 27f04d714ecb 
(year 2001). It is strange that only one stripped form feeds though. The column 
offset was only added later (revision 861c35cef7aa). So Python 2 will have some 
of its SyntaxError.text lines stripped of indentation, but it does not matter 
so much because SyntaxError.offset is not set in those cases.

--

___
Python tracker 

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



Re: CLP stats: last 500 posts

2016-12-10 Thread Terry Reedy

On 12/10/2016 3:13 AM, Steve D'Aprano wrote:

On Sat, 10 Dec 2016 03:15 pm, DFS wrote:



Normally I don't censor, at all.  But the spams are apparently way
off-topic, so I'll filter out Subjects containing certain keywords.


python-list is a spam-moderated list. 95+% of spam is filtered out.


Its not just the Subject, but also the fake Sender. There are at least five
distinct senders which are (apparently) defamatory messages in Italian.


This person actively evades our filters.


They're all pretty obvious spam, in all caps, with various email addresses.

"... MEGLIO ..." 




The spammer will still be counted,


Why reward someone who actively evades defenses?  If you want to count 
spam, it is mostly missing, at least as far as python-list is concerned.



comp.lang.python is a mirror of the python-list at python dot org mailing
list, which has an official web archive:

https://mail.python.org/pipermail/python-list/


These slanderous posts, in particular, are hand-removed from the archive 
when they get past the automatic filters.  They are no more part of 
python-list than other spam.


--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list


[issue28190] Cross-build _curses failed if host ncurses headers and target ncurses headers have different layouts

2016-12-10 Thread Xavier de Gaye

Xavier de Gaye added the comment:

> no, this is a very wrong simplification.  Both gcc and clang offer a method 
> to search for header files and libraries in a target specific location. 
> Please use these options.

Please open a new issue for the detection of the curses paths. The current 
issue is about the failure to cross compile _curses when /usr/include/ncursesw 
is added to these paths. See the original post and the original title.

--

___
Python tracker 

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



[issue20211] setup.py: do not add system header locations when cross compiling

2016-12-10 Thread Xavier de Gaye

Xavier de Gaye added the comment:

> this assumption is wrong for the multiarch case.

Please explain why it is wrong.

--

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-12-10 Thread Julien Palard

Julien Palard added the comment:

I was able to simplify my patch a bit, I think I should also add a test to 
ensure we keep the hi=-1 and hi=None compatibility in the future.

--
Added file: http://bugs.python.org/file45832/issue28754-8.diff

___
Python tracker 

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



[issue20211] setup.py: do not add system header locations when cross compiling

2016-12-10 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

xdegaye's explanation is incorrect. The actual scene is much more complicated. 
First, let me explain why things may be broken. The wrong directory is included 
only if all of the following conditions are met:

1. PYTHON_FOR_BUILD is not installed with --prefix=/usr. A common example is 
those which are installed with pyenv. This condition is here simply because of 
`os.path.normpath(sys.base_prefix) != '/usr'`
2. The build script uses $DESTDIR convention to compile CPython
3. Header files in $DESTDIR$PREFIX/include are not equivalent to 
$PREFIX/include. Here "equivalent" means they are for the same set of 
architecture/kernel/... This is a common case when cross compiling, while a 
famous exception is the multiarch framework on Debian-based systems.

For example, if I use --prefix=/usr and DESTDIR=/tmp/python3-android/build, 
INCLUDEDIR will be /usr/include, which should not be included. On the other 
hand, if I use --prefix=/tmp/python3-android/build/usr and omit DESTDIR, 
INCLUDEDIR is correct /tmp/python3-android/build/usr/include. With $DESTDIR 
specified, the build script has the responsibility to specify 
$DESTDIR$PREFIX/include in CPPFLAGS, or CPython interpreter core won't even 
build, so skipping adding INCLUDEDIR in setup.py is safe. However, for the 
latter case (not using DESTDIR), the build script still needs to specify 
correct CPPFLAGS. I see it as a CPython limitation and worth documentation.

For Debian's multiarch framework, paths are already handled by 
add_multiarch_paths(). I'm not sure whether $PREFIX/include should still be 
included or not. (I don't use Debian-based systems)

--

___
Python tracker 

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



  1   2   >