[issue29571] test_re is failing when local is set for `en_IN`

2017-03-05 Thread Nick Coghlan

Nick Coghlan added the comment:

I'm with Serhiy on this one: if the "re" module isn't using 
locale.getpreferredencoding(), then there's something odd going on.

It just sounds like the disconnect on Windows is the opposite of the one we hit 
on Linux without Benjamin's patch, perhaps due to the UTF-8 mode changes - it 
wouldn't surprise me to learn that the re module is still using mbcs there 
instead of utf-8.

--

___
Python tracker 

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



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-05 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +407

___
Python tracker 

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



[issue29571] test_re is failing when local is set for `en_IN`

2017-03-05 Thread Benjamin Peterson

Benjamin Peterson added the comment:

getpreferredencoding() takes a completely different path on windows
(returns a codepage) and isn't related to the C locale.

--

___
Python tracker 

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



[issue29571] test_re is failing when local is set for `en_IN`

2017-03-05 Thread Benjamin Peterson

Benjamin Peterson added the comment:

But the test was never broken on windows.

On Sun, Mar 5, 2017, at 23:54, Serhiy Storchaka wrote:
> 
> Serhiy Storchaka added the comment:
> 
> I'm not sure this will help on Windows.
> 
> --
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue29571] test_re is failing when local is set for `en_IN`

2017-03-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And I don't understand why my fix doesn't work on Windows.

--

___
Python tracker 

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



[issue29571] test_re is failing when local is set for `en_IN`

2017-03-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'm not sure this will help on Windows.

--

___
Python tracker 

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



[issue29571] test_re is failing when local is set for `en_IN`

2017-03-05 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Yep, I think we should merge https://github.com/python/cpython/pull/422 and 
revert ncoghlan's change.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue5945] PyMapping_Check returns 1 for lists

2017-03-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed wording doesn't looks much informative to me. Maybe just say that 
PyMapping_Check() also returns 1 for sequences that support slicing? And 
recommend `PyMapping_Check() && !PySequence_Check()` for true mapping test?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue13566] Increase pickle compatibility

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file46703/pickle-old-strings-2.patch

___
Python tracker 

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



[issue29690] no %z directive for strptime in python2, doc says nothing about it

2017-03-05 Thread Mathieu Dupuy

Mathieu Dupuy added the comment:

Neither documentation is clear on whether each of those flags are available for 
strptime too. A precision should be added on a flag if it's not available for 
strptime. What do you think ?

--

___
Python tracker 

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



Re: Who still supports recent Python on shared hosting

2017-03-05 Thread Paul Rubin
John Nagle  writes:
> I'm looking for shared hosting that supports at least Python 3.4.

Open a ticket on buyshared.net and ask if they can install it for you.
They're good about stuff like that.

If it's for a cgi, you might alternatively be able to run it from your
own directory (you get ssh access which gives some flexibility).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Who still supports recent Python on shared hosting

2017-03-05 Thread Pete Forman
John Nagle  writes:

> I'm looking for shared hosting that supports
> at least Python 3.4.
>
> Hostgator: Highest version is Python 3.2.
> Dreamhost: Highest version is Python 2.7.
> Bluehost: Install Python yourself.
> InMotion: Their documentation says 2.6.
>
> Is Python on shared hosting dead?
> I don't need a whole VM and something I
> have to sysadmin, just a small shared
> hosting account.

I use OpenShift from Red Hat on their free hosting package. They offer
Python 3.5, 3.3 and 2.7.

-- 
Pete Forman
https://payg-petef.rhcloud.com
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29727] collections.abc.Reversible doesn't fully support the reversing protocol

2017-03-05 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue29695] Weird keyword parameter names in builtins

2017-03-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I do think it would be better to not have the deprecation.

--

___
Python tracker 

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



[issue29695] Weird keyword parameter names in builtins

2017-03-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I already merged the patch as 58d23e68068996c76cac78887ec67dee68cdbc72.

If you think that it would be better to remove without deprecation, the 
following patch does this.

--
Added file: http://bugs.python.org/file46702/remove-bad-keywords.patch

___
Python tracker 

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



Re: Who still supports recent Python on shared hosting

2017-03-05 Thread D'Arcy Cain

On 2017-03-05 09:39 PM, John Nagle wrote:

I'm looking for shared hosting that supports
at least Python 3.4.


http://www.VybeNetworks.com/

We have Python 2.7 and 3.6 installed.

--
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
--
https://mail.python.org/mailman/listinfo/python-list


Re: str.title() fails with words containing apostrophes

2017-03-05 Thread D'Arcy Cain

On 2017-03-05 03:40 PM, Terry Reedy wrote:

import re

def title(string):
return re.sub(r"\b'\w", lambda m: m.group().lower(), string.title())


Nice.  It lowercases a word char that follows an "'" that follows a word
without an intervening non-word char. It passes this test:
print(title("'time' isn't 'timeless'!"))
'Time' Isn't 'Timeless'!

It guess the reason not to bake this exception into str.title is that it
is language specific and could even be wrong if someone used "'" to
separate words (perhaps in a different alphabet).


Or, it doesn't handle exceptions.

print title("My name is D'Arcy")

Oops.

--
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
--
https://mail.python.org/mailman/listinfo/python-list


[issue29731] Ability to filter warnings to print current stack

2017-03-05 Thread Matthias Bussonnier

Changes by Matthias Bussonnier :


--
pull_requests: +406

___
Python tracker 

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



[issue5945] PyMapping_Check returns 1 for lists

2017-03-05 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage: needs patch -> patch review
versions:  -Python 3.4

___
Python tracker 

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



[issue29571] test_re is failing when local is set for `en_IN`

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden
resolution: fixed -> 
stage: resolved -> 
status: closed -> open

___
Python tracker 

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



[issue29730] unoptimal calls to PyNumber_Check

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +mark.dickinson, serhiy.storchaka

___
Python tracker 

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



[issue24329] __qualname__ and __slots__

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee: serhiy.storchaka -> xiang.zhang

___
Python tracker 

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



[issue29731] Ability to filter warnings to print current stack

2017-03-05 Thread Matthias Bussonnier

New submission from Matthias Bussonnier:

The warning module is extremely useful, especially the ability to change 
various level of verbosity and filter by multiple criteria. 

It is though sometime hard to pinpoint why a warning was triggered, or actually 
what triggered a warning. This is often due to the fact that libraries don't 
set the `stacklevel=...`  correctly, that it is hard to get right (like at 
import time), or because warnings get triggered by complex, not obvious 
codepaths.

One workaround is to switch from `always`/`once` to "error" to raise 
exceptions, but that can be quite troublesome in production, if other warnings 
are encountered in the meantime.


Would it be accepted to add a warning filter type "stack" (or whatever name 
please you ...) that would not only print the current warning,  but the stack 
leading to it. That is to say output almost identical as "error" but not 
actually raising ?

Assuming above is reasonable, I have a working patch (both in the c and py 
implementation of warnings), though it can't seem to find how respect the 
`stacklevel=...` parameter unless `warn_explicit` is changed to allow an 
additional `frame` argument. Would adding this field be acceptable ?
Or arguably, if one is interested in the stack, ignoring the stacklevel may 
make sens as one may want to explore the full reason of the warning (ie its 
source that may be hidden by stacklevel=... ) , and not only what triggered it.

--
components: Library (Lib)
messages: 289066
nosy: mbussonn
priority: normal
severity: normal
status: open
title: Ability to filter warnings to print current stack
type: enhancement
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



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-05 Thread Xiang Zhang

Xiang Zhang added the comment:

The problem is now _PyBytes_FormatEx uses strchr to sniff %. It should use 
memchr instead.

--
assignee:  -> xiang.zhang
nosy: +xiang.zhang

___
Python tracker 

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



[issue29657] os.symlink: FileExistsError shows wrong message

2017-03-05 Thread Xiang Zhang

Xiang Zhang added the comment:

I agree with Eryk. The error message is misleading. When I see it, I take it as 
source -> destination. I think we should make the error message clearer, or 
document it in the OSError documentation.

--

___
Python tracker 

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



[issue15290] setAttribute() can fail

2017-03-05 Thread Craig Rodrigues

Craig Rodrigues added the comment:

Same issue was brought up in http://bugs.python.org/issue4851

--
nosy: +Craig Rodrigues

___
Python tracker 

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



Re: Who still supports recent Python on shared hosting

2017-03-05 Thread Chris Angelico
On Mon, Mar 6, 2017 at 1:39 PM, John Nagle  wrote:
> I'm looking for shared hosting that supports
> at least Python 3.4.
>
> Hostgator: Highest version is Python 3.2.
> Dreamhost: Highest version is Python 2.7.
> Bluehost: Install Python yourself.
> InMotion: Their documentation says 2.6.
>
> Is Python on shared hosting dead?
> I don't need a whole VM and something I
> have to sysadmin, just a small shared
> hosting account.

Heroku supports a number of Python versions:

https://devcenter.heroku.com/articles/python-support#supported-python-runtimes

I'm not sure how to list *every* supported Python version (the docs
only list the latest 2.7 and the latest 3.x at any given time), but I
poked around in https://lang-python.s3.amazonaws.com/ and found a
large number of versions that appear to be installable. You specify a
version with a file in your repository called "runtime.txt", and
they'll give you that version if they can, or kick back an error.

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


Who still supports recent Python on shared hosting

2017-03-05 Thread John Nagle
I'm looking for shared hosting that supports
at least Python 3.4.

Hostgator: Highest version is Python 3.2.
Dreamhost: Highest version is Python 2.7.
Bluehost: Install Python yourself.
InMotion: Their documentation says 2.6.

Is Python on shared hosting dead?
I don't need a whole VM and something I
have to sysadmin, just a small shared
hosting account.

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


[issue24329] __qualname__ and __slots__

2017-03-05 Thread Xiang Zhang

Xiang Zhang added the comment:

PR made. :-)

--

___
Python tracker 

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



[issue24329] __qualname__ and __slots__

2017-03-05 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +405

___
Python tracker 

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



[issue29719] "Date" of what's new is confusing

2017-03-05 Thread Ned Deily

Ned Deily added the comment:

Heh, it looks like we agree!

--

___
Python tracker 

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



[issue29719] "Date" of what's new is confusing

2017-03-05 Thread INADA Naoki

INADA Naoki added the comment:

I'm sorry, I was wrong.

https://docs.python.org/3.5/whatsnew/3.5.html

asyncio has "Updates in 3.5.1:" section.
provisional package will introduce updates in what's new in bugfix release.

So is it OK to just removing Date and Release field?
"Date (when this HTML is built)" and "Release (of branch this page is built)" 
are not good for "What's New In 3.6" page.

--

___
Python tracker 

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



[issue29719] "Date" of what's new is confusing

2017-03-05 Thread Ned Deily

Ned Deily added the comment:

> Additonally, unlike "changelog", "What's New" only shows difference between 
> 3.5 and 3.6.  It won't be updated to describe changes between 3.6.0 and 3.6.1.

That's not always true.  There are occasionally changes made in the What's New 
document for maintenance releases.  See, for example, 
https://docs.python.org/3.5/whatsnew/3.5.html.  You'll find references to 3.5.1 
and 3.5.2 there.

If it's truly bothering people, a better solution is to just remove the release 
and date directives.  They aren't there for earlier releases.  We can live 
without them.

--

___
Python tracker 

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



[issue4851] xml.dom.minidom.Element.cloneNode fails with AttributeError

2017-03-05 Thread Craig Rodrigues

Craig Rodrigues added the comment:

This looks like a duplicate of https://bugs.python.org/issue15290 .

15290 was closed as invalid, and the submitter was told that the
code should be changed to not rely on creating elements outside
of the document interface.

I encountered the same problem when trying to port Twisted to Python 3.

--
nosy: +Craig Rodrigues

___
Python tracker 

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



[issue29719] "Date" of what's new is confusing

2017-03-05 Thread INADA Naoki

INADA Naoki added the comment:

Additonally, unlike "changelog", "What's New" only shows difference between 3.5 
and 3.6.  It won't be updated to describe changes between 3.6.0 and 3.6.1.

--

___
Python tracker 

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



[issue29719] "Date" of what's new is confusing

2017-03-05 Thread INADA Naoki

INADA Naoki added the comment:

https://docs.python.org/3.7/whatsnew/3.6.html shows:
Release:3.7.0a0
Date:   February 15, 2017

Is it make sense for you?

--

___
Python tracker 

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



[issue29719] "Date" of what's new is confusing

2017-03-05 Thread Ned Deily

Ned Deily added the comment:

Sorry, I disagree.  I think the point of adding these directives is that shows 
for what release of 3.6.x they apply.  It is expected that the What's New 
documents may be updated during the lifecycle of a major release and having the 
release and date there lets the reader know that they are update.  For example, 
at the moment https://docs.python.org/3.6/whatsnew/3.6.html shows:

What’s New In Python 3.6
Release:3.6.1rc1
Date:   March 05, 2017

which is correct.

--

___
Python tracker 

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



Re: Online Python Editor with Live Syntax Checking

2017-03-05 Thread Jason Friedman
>
> I made a tool called PythonBuddy (http://pythonbuddy.com/).
>
> I made this so that MOOCs like edX or codecademy could easily embed and
> use this on their courses so students wouldn't have to go through the
> frustrations of setting up a Python environment and jump right into Python
> programming. Also, professors and teachers could easily set up a server and
> allow students to quickly test out their code with PythonBuddy online.
>
> Github repo: https://github.com/ethanche…/OnlinePythonLinterSyntaxChecker
>

Pretty cool.

Your Github link did not work for me.

This looks like Python 2.  Is there a reason you did not go with 3?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29571] test_re is failing when local is set for `en_IN`

2017-03-05 Thread Zachary Ware

Zachary Ware added the comment:

This seems to have broken test_re on Windows, see 
https://ci.appveyor.com/project/python/cpython/build/3.7.0a0.1

I found this change to be the culprit via git bisect, unfortunately we didn't 
have any working CI on Windows (buildbots were otherwise broken) at the time 
this was merged.

--
nosy: +zach.ware

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Eryk Sun

Eryk Sun added the comment:

> I don't have a specific problem that it causes. 

Adding an arbitrary directory ahead of the standard library in sys.path is a 
problem waiting to happen. This also happens when the import source is a zip 
file, e.g. a .pyz app.

--

___
Python tracker 

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



[issue29719] "Date" of what's new is confusing

2017-03-05 Thread INADA Naoki

Changes by INADA Naoki :


--
pull_requests: +404

___
Python tracker 

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



[issue29695] Weird keyword parameter names in builtins

2017-03-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I concur with Victor and Serhiy that we can bypass a deprecation phase here and 
just get it done.  In the rare case of int(x=3.14), the fix is trivial.

--
nosy: +rhettinger

___
Python tracker 

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



[issue29730] unoptimal calls to PyNumber_Check

2017-03-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

+1 for removing each of these calls to PyNumber_Check.

--
nosy: +rhettinger

___
Python tracker 

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



[issue29726] test_xmlrpc raises DeprecationWarnings

2017-03-05 Thread dillon.brock

dillon.brock added the comment:

The cherry-pick is causing a merge conflict because 3.6 and 3.5 do not include 
the SimpleXMLRPCDispatcherTestCase that this fix modifies. Should I backport 
that entire test case as well as the fix?

--

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Ned Batchelder

Ned Batchelder added the comment:

I don't have a specific problem that it causes. It's just a difference from any 
previous CPython version.

About the PyPy thing: it has always behaved this way:

$ for ver in 4.0.1 5.1.1 5.4.0 5.6.0; do 
py=/usr/local/pythonz/pythons/PyPy-$ver/bin/pypy; $py -V; $py main361; done
Python 2.7.10 (5f8302b8bf9f, Nov 18 2015, 10:38:03)
[PyPy 4.0.1 with GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]
['main361',
 '/Users/ned/foo',
 '/usr/local/pythonz/pythons/PyPy-4.0.1/lib_pypy/__extensions__',
 '/usr/local/pythonz/pythons/PyPy-4.0.1/lib_pypy',
 '/usr/local/pythonz/pythons/PyPy-4.0.1/lib-python/2.7',
 '/usr/local/pythonz/pythons/PyPy-4.0.1/lib-python/2.7/lib-tk',
 '/usr/local/pythonz/pythons/PyPy-4.0.1/lib-python/2.7/plat-darwin',
 '/usr/local/pythonz/pythons/PyPy-4.0.1/lib-python/2.7/plat-mac',
 
'/usr/local/pythonz/pythons/PyPy-4.0.1/lib-python/2.7/plat-mac/lib-scriptpackages',
 '/usr/local/pythonz/pythons/PyPy-4.0.1/site-packages']
Python 2.7.10 (b0a649e90b66, Apr 28 2016, 08:33:07)
[PyPy 5.1.1 with GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]
['main361',
 '/Users/ned/foo',
 '/usr/local/pythonz/pythons/PyPy-5.1.1/lib_pypy/__extensions__',
 '/usr/local/pythonz/pythons/PyPy-5.1.1/lib_pypy',
 '/usr/local/pythonz/pythons/PyPy-5.1.1/lib-python/2.7',
 '/usr/local/pythonz/pythons/PyPy-5.1.1/lib-python/2.7/lib-tk',
 '/usr/local/pythonz/pythons/PyPy-5.1.1/lib-python/2.7/plat-darwin',
 '/usr/local/pythonz/pythons/PyPy-5.1.1/lib-python/2.7/plat-mac',
 
'/usr/local/pythonz/pythons/PyPy-5.1.1/lib-python/2.7/plat-mac/lib-scriptpackages',
 '/usr/local/pythonz/pythons/PyPy-5.1.1/site-packages']
Python 2.7.10 (77392ad26350, Aug 28 2016, 05:07:44)
[PyPy 5.4.0 with GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]
['main361',
 '/Users/ned/foo',
 '/usr/local/pythonz/pythons/PyPy-5.4.0/lib_pypy/__extensions__',
 '/usr/local/pythonz/pythons/PyPy-5.4.0/lib_pypy',
 '/usr/local/pythonz/pythons/PyPy-5.4.0/lib-python/2.7',
 '/usr/local/pythonz/pythons/PyPy-5.4.0/lib-python/2.7/lib-tk',
 '/usr/local/pythonz/pythons/PyPy-5.4.0/lib-python/2.7/plat-darwin',
 '/usr/local/pythonz/pythons/PyPy-5.4.0/lib-python/2.7/plat-mac',
 
'/usr/local/pythonz/pythons/PyPy-5.4.0/lib-python/2.7/plat-mac/lib-scriptpackages',
 '/usr/local/pythonz/pythons/PyPy-5.4.0/site-packages']
Python 2.7.12 (aff251e54385, Nov 09 2016, 17:25:49)
[PyPy 5.6.0 with GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]
['main361',
 '/Users/ned/foo',
 '/usr/local/pythonz/pythons/PyPy-5.6.0/lib_pypy/__extensions__',
 '/usr/local/pythonz/pythons/PyPy-5.6.0/lib_pypy',
 '/usr/local/pythonz/pythons/PyPy-5.6.0/lib-python/2.7',
 '/usr/local/pythonz/pythons/PyPy-5.6.0/lib-python/2.7/lib-tk',
 '/usr/local/pythonz/pythons/PyPy-5.6.0/lib-python/2.7/plat-darwin',
 '/usr/local/pythonz/pythons/PyPy-5.6.0/lib-python/2.7/plat-mac',
 
'/usr/local/pythonz/pythons/PyPy-5.6.0/lib-python/2.7/plat-mac/lib-scriptpackages',
 '/usr/local/pythonz/pythons/PyPy-5.6.0/site-packages']
$ for ver in 2.4.0 5.5.0; do 
py=/usr/local/pythonz/pythons/PyPy3-$ver/bin/pypy3; $py -V; $py main361; done
Python 3.2.5 (b2091e973da6, Oct 19 2014, 18:30:58)
[PyPy 2.4.0 with GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)]
['main361',
 '/Users/ned/foo',
 '/usr/local/pythonz/pythons/PyPy3-2.4.0/lib_pypy/__extensions__',
 '/usr/local/pythonz/pythons/PyPy3-2.4.0/lib_pypy',
 '/usr/local/pythonz/pythons/PyPy3-2.4.0/lib-python/3',
 '/usr/local/pythonz/pythons/PyPy3-2.4.0/lib-python/3/lib-tk',
 '/usr/local/pythonz/pythons/PyPy3-2.4.0/lib-python/3/plat-darwin',
 '/usr/local/pythonz/pythons/PyPy3-2.4.0/lib-python/3/plat-mac',
 
'/usr/local/pythonz/pythons/PyPy3-2.4.0/lib-python/3/plat-mac/lib-scriptpackages',
 '/usr/local/pythonz/pythons/PyPy3-2.4.0/site-packages']
Python 3.3.5 (619c0d5af0e5, Oct 08 2016, 22:08:19)
[PyPy 5.5.0-alpha0 with GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]
['main361',
 '/Users/ned/foo',
 '/usr/local/pythonz/pythons/PyPy3-5.5.0/lib_pypy/__extensions__',
 '/usr/local/pythonz/pythons/PyPy3-5.5.0/lib_pypy',
 '/usr/local/pythonz/pythons/PyPy3-5.5.0/lib-python/3',
 '/usr/local/pythonz/pythons/PyPy3-5.5.0/lib-python/3/lib-tk',
 '/usr/local/pythonz/pythons/PyPy3-5.5.0/lib-python/3/plat-darwin',
 '/usr/local/pythonz/pythons/PyPy3-5.5.0/lib-python/3/plat-mac',
 
'/usr/local/pythonz/pythons/PyPy3-5.5.0/lib-python/3/plat-mac/lib-scriptpackages',
 '/usr/local/pythonz/pythons/PyPy3-5.5.0/site-packages']
$

--

___
Python tracker 

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



[issue29730] unoptimal calls to PyNumber_Check

2017-03-05 Thread Oren Milman

New submission from Oren Milman:

 current state 
if (PyNumber_Check(obj)) {
someVar = PyNumber_AsSsize_t(obj, SomeError);
if (someVar == -1 && PyErr_Occurred()) {
return errVal;
}
}
else {
PyErr_Format(PyExc_TypeError,
 "integer argument expected, got '%.200s'",
 Py_TYPE(obj)->tp_name);
return errVal;
}

Something similar to this happens in:
- Modules/mmapmodule.c in mmap_convert_ssize_t
- Modules/_io/_iomodule.c in _PyIO_ConvertSsize_t
- Modules/_io/stringio.c in:
* _io_StringIO_read_impl
* _io_StringIO_readline_impl
* _io_StringIO_truncate_impl

(Moreover, in:
- Objects/bytes_methods.c in parse_args_finds_byte
- Objects/exceptions.c in oserror_init
PyNumber_AsSsize_t is called only if PyNumber_Check returns true.)

Note that:
- PyNumber_Check checks whether nb_int != NULL or nb_float != NULL.
- PyNumber_AsSsize_t calls PyNumber_Index, which, before calling
  nb_index, raises a TypeError (with a similar error message) in case
  nb_index == NULL.
- The docs say '... when __index__() is defined __int__() should also be
  defined ...'.
So the behavior with and without the call to PyNumber_Check is quite the same.
The only potential advantage of calling PyNumber_Check is skipping the call to
PyNumber_AsSsize_t.
But PyNumber_AsSsize_t would be called also in case
nb_index == NULL and (nb_int != NULL or nb_float != NULL).
Thus, the only case in which the call to PyNumber_Check might be useful, is
when nb_int == nb_float == nb_index == NULL.


 proposed changes 
Either remove each of these calls to PyNumber_Check, or at least replace it
with a call to PyIndex_Check, which checks whether nb_index != NULL, and thus
would be more useful than PyNumber_Check.

Note that such a change shouldn't affect the behavior, except for a slightly
different wording of the error message in case a TypeError is raised.

--
components: IO
messages: 289048
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: unoptimal calls to PyNumber_Check
type: enhancement
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



[issue29104] Left bracket remains in format string result when '\' preceeds it

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +403

___
Python tracker 

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



[issue28682] Bytes support in os.fwalk()

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +402

___
Python tracker 

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



Re: How to access installed scripts on Windows?

2017-03-05 Thread eryk sun
On Sun, Mar 5, 2017 at 2:35 AM, ddbug  wrote:
>
>> You can also develop using venv virtual environments. You can symlink
>> or shell-shortcut to the activation script of a virtual environment.
>
> Interesting idea. But I have not seen any installers or guidance how to 
> deploy something packaged
> as a venv to users. Can you share any pointers please?

Are we talking about scripts for programmers to work with libraries
that you publish (e.g. a command-line tool like cythonize), or
applications for end users and IT staff? Virtual environments are
primarily a solution for developers. For deployment to end users, take
a look at what Paul Moore is doing with pylaunch and the embedded
Python distribution:

https://github.com/pfmoore/pylaunch
https://docs.python.org/3/using/windows.html#embedded-distribution
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29196] Remove old-deprecated plistlib features

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +401

___
Python tracker 

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



[issue29729] UUID bytes constructor has too-tight an assertion

2017-03-05 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue28749] Fixed the documentation of the mapping codec APIs

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +400

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Eryk Sun

Eryk Sun added the comment:

That's not the current directory. It's the 'script' directory (i.e. the parent 
of main361), as set by PySys_SetArgv when Py_IsolatedFlag isn't set. 

The old behavior was for RunMainFromImporter to unconditionally replace this 
directory in sys.path with the import source for "__main__.py", which is the 
correct behavior, except I think it should try to get an absolute path. The 
resolution for #29319 changed this such that when sys.path[0] is non-empty it 
now inserts the import source at index 0 rather than replace index 0. It seems 
to me that this new logic should only be used in isolated mode. Otherwise it 
should be replacing this bogus script directory like it used to.

--
nosy: +eryksun

___
Python tracker 

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



[issue29724] Itertools docs propose a harmful “speedup” without any explanation

2017-03-05 Thread STINNER Victor

STINNER Victor added the comment:

> Victor will probably tell me I'm micro-benchmarking this the wrong way,
so to satisfy him I did one more run:

You are doing it the wrong way :-D Please replace Timeit(...) with
runner=perf.Runner() and then runner.timeit('bench1', ...).

Runner spaws multiples processes and then test if a comparison is
significant (perf compare_to a.json b.json).

Moreover, for microbenchmaks, I highly recommand to tune your system for
benchmarks: python3 -m perf system tune, and see also perf doc ;-)

5% is not significant on a microbenchmark, it can be pure noise.

--

___
Python tracker 

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



[issue29695] Weird keyword parameter names in builtins

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +399

___
Python tracker 

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



[issue24037] Argument Clinic: add the boolint converter

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +398

___
Python tracker 

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



[issue29645] webbrowser module import has heavy side effects

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +397

___
Python tracker 

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



Re: str.title() fails with words containing apostrophes

2017-03-05 Thread Terry Reedy

On 3/5/2017 2:38 PM, MRAB wrote:

On 2017-03-05 17:54, Steve D'Aprano wrote:

I'm trying to convert strings to Title Case, but getting ugly results
if the
words contain an apostrophe:


py> 'hello world'.title()  # okay
'Hello World'
py> "i can't be having with this".title()  # not okay
"I Can'T Be Having With This"


Anyone have any suggestions for working around this?


A bit of regex?

import re

def title(string):
return re.sub(r"\b'\w", lambda m: m.group().lower(), string.title())


Nice.  It lowercases a word char that follows an "'" that follows a word 
without an intervening non-word char. It passes this test:

print(title("'time' isn't 'timeless'!"))
'Time' Isn't 'Timeless'!

It guess the reason not to bake this exception into str.title is that it 
is language specific and could even be wrong if someone used "'" to 
separate words (perhaps in a different alphabet).


--
Terry Jan Reedy

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


[issue29728] Expose TCP_NOTSENT_LOWAT

2017-03-05 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


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



[issue29728] Expose TCP_NOTSENT_LOWAT

2017-03-05 Thread Nathaniel Smith

Changes by Nathaniel Smith :


--
pull_requests: +396

___
Python tracker 

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



[issue29729] UUID bytes constructor has too-tight an assertion

2017-03-05 Thread Nic Watson

New submission from Nic Watson:

The assertion:

  File "/usr/lib/python3.6/uuid.py", line 150, in __init__
assert isinstance(bytes, bytes_), repr(bytes)

is too specific (and IMHO, unpythonic).  One may want to pass a bytearray or a 
memoryview.  See int.from_bytes for an example that takes "bytes" but accepts 
anything that acts like a bytes.

A simple solution may be to delete the assertion (it worked for me).

Example code:

import uuid

b = uuid.uuid1().bytes
ba = bytearray(b)
print(uuid.UUID(bytes=b))

# another API that works similarly, accepts a bytearray
print(int.from_bytes(ba, byteorder='big'))

# fails on assertion
print(uuid.UUID(bytes=ba))

--
components: Extension Modules
messages: 289045
nosy: jnwatson
priority: normal
severity: normal
status: open
title: UUID bytes constructor has too-tight an assertion
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



Re: str.title() fails with words containing apostrophes

2017-03-05 Thread MRAB

On 2017-03-05 17:54, Steve D'Aprano wrote:

I'm trying to convert strings to Title Case, but getting ugly results if the
words contain an apostrophe:


py> 'hello world'.title()  # okay
'Hello World'
py> "i can't be having with this".title()  # not okay
"I Can'T Be Having With This"


Anyone have any suggestions for working around this?


A bit of regex?

import re

def title(string):
return re.sub(r"\b'\w", lambda m: m.group().lower(), string.title())

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


[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Ned Deily

Ned Deily added the comment:

I think this is a result of the changes introduced with Issue29319.  Perhaps a 
more prominent NEWS entry is needed?  Nick?  Ned, does this change in behavior 
cause problems?

--
nosy: +ncoghlan, ned.deily

___
Python tracker 

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



[issue29727] collections.abc.Reversible doesn't fully support the reversing protocol

2017-03-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

One other thought:  array.array() object should probably be registered so that 
it recognizable as a Sequence and as Reversible.

--

___
Python tracker 

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



[issue29638] Spurious failures in test_collections in releak hunting mode after typing is imported

2017-03-05 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
pull_requests: +395

___
Python tracker 

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



[issue29724] Itertools docs propose a harmful “speedup” without any explanation

2017-03-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Additional note:  For folks interested in performance, it is common for people 
not to realize that function call overhead can dominate their timings (see this 
recent SO question as a recent, but typical example 
http://stackoverflow.com/questions/41772054 ).

In any case, the note needs to remain because people commonly move these 
recipes into production code and need to be warned that basic optimizations 
were skipped.  This is important in a module where improved performance is one 
of the primary goals.

--

___
Python tracker 

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



[issue29728] Expose TCP_NOTSENT_LOWAT

2017-03-05 Thread Nathaniel Smith

New submission from Nathaniel Smith:

https://github.com/python/cpython/pull/477

--
components: Library (Lib)
messages: 289041
nosy: njs
priority: normal
severity: normal
status: open
title: Expose TCP_NOTSENT_LOWAT

___
Python tracker 

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



[issue29727] collections.abc.Reversible doesn't fully support the reversing protocol

2017-03-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I don't think this is a bug.  The purpose collections.abc.Reversible is to 
recognize type where the behavior has been guaranteed, not to recognize all 
types where it happens to work.

Part of the original reason for introducing ABCs in the first place was that in 
general there is no reliable way to detect whether a class defining __getitem__ 
is a sequence or a mapping.

A creator of such a class either needs to subclass from Sequence or register as 
a Sequence.  The fact that reversed(Counter(10)) happens to work is no more 
interesting that the fact Counter(10)[5] happens to work eventhough 
isinstance(Counter, Sequence) returns False.

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue29638] Spurious failures in test_collections in releak hunting mode after typing is imported

2017-03-05 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
pull_requests: +394

___
Python tracker 

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



[issue29727] collections.abc.Reversible doesn't fully support the reversing protocol

2017-03-05 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

collections.abc.Reversible doesn't work with types that are supported by 
reserved() but neither have the __reversed__ method nor are explicitly 
registered as collections.abc.Sequence. For example:

>>> issubclass(array.array, collections.abc.Reversible)
False 

The reversing protocol as well as the iterating protocol is supported not only 
by special method, but implicitly if the class has implemented __getitem__ and 
__len__ methods.

>>> class Counter(int):
...   def __getitem__(s, i): return i
...   def __len__(s): return s
... 
>>> list(reversed(Counter(10)))
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
>>> issubclass(Counter, collections.abc.Reversible)
False

typing.Reversible starves from the same bug. See 
https://github.com/python/typing/issues/170.

--
components: Library (Lib)
messages: 289039
nosy: gvanrossum, rhettinger, serhiy.storchaka, stutzbach
priority: normal
severity: normal
status: open
title: collections.abc.Reversible doesn't fully support the reversing protocol
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue29724] Itertools docs propose a harmful “speedup” without any explanation

2017-03-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The reason that this comment was added was to note the recipes themselves are 
unoptimized and to provide some guideance on how that could be done.  The 
recipes themselves are provided in the cleaner looking form.

FWIW, localizing variables is one of the few code optimizations available to 
python programmers.  It is not uncommon in the standard library eventhough 
there are some people who just don't like it (including apparently the OP).

Sorry Chris, I'm going to reject this.  The note is correct, the optimization 
is valid, and so is the original purpose for adding it.

--
resolution:  -> not a bug
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



[issue29724] Itertools docs propose a harmful “speedup” without any explanation

2017-03-05 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue29638] Spurious failures in test_collections in releak hunting mode after typing is imported

2017-03-05 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

> Seems this has fixed issue25744.

This is interesting, if I remember correctly the relevant typing classes were 
added only recently. I will take a look at how to back-port this (probably this 
will require some code changes)

--

___
Python tracker 

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



[issue29638] Spurious failures in test_collections in releak hunting mode after typing is imported

2017-03-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Ivan! Seems this has fixed issue25744. Don't you mind to backport 
your changes to 3.6 and 3.5?

--
versions: +Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue25744] Reference leaks in test_collections

2017-03-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Closed in favor of issue29638. The latter has a patch.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Spurious failures in test_collections in releak hunting mode 
after typing is imported

___
Python tracker 

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



[issue29724] Itertools docs propose a harmful “speedup” without any explanation

2017-03-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I have got 15% speed up.

But two of my variants (the first and the second) speed up the calculation by 
2.8 and 3.6 times correspondingly. It doesn't make sense to talk about 
microoptimization of the example if rewriting it without using iterator tools 
can get much larger speed up.

The example still is good for the case when use vectors of large dimensions. 
But in that case the effect of the microoptimization is dwarfed by the time of 
iteration and calculation.

--

___
Python tracker 

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



[issue27476] Introduce a .github folder with PULL_REQUEST_TEMPLATE

2017-03-05 Thread Senthil Kumaran

Changes by Senthil Kumaran :


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

___
Python tracker 

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



[issue27476] Introduce a .github folder with PULL_REQUEST_TEMPLATE

2017-03-05 Thread Senthil Kumaran

Senthil Kumaran added the comment:

The .github directory needs to stay and is being used for other purposes (like 
providing contributing guidelines 
(https://github.com/blog/1184-contributing-guidelines)).

The old pull request template has already been deleted:
https://github.com/python/cpython/commit/6f0eb93183519024cb360162bdd81b9faec97ba6

This bug can be closed IMO.

--

___
Python tracker 

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



str.title() fails with words containing apostrophes

2017-03-05 Thread Steve D'Aprano
I'm trying to convert strings to Title Case, but getting ugly results if the
words contain an apostrophe:


py> 'hello world'.title()  # okay
'Hello World'
py> "i can't be having with this".title()  # not okay
"I Can'T Be Having With This"


Anyone have any suggestions for working around this?



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


[issue29638] Spurious failures in test_collections in releak hunting mode after typing is imported

2017-03-05 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

> If you just want to add a workaround in dash_R_cleanup, I think it would be 
> better to generate the list of all abstract classes and add three typing 
> classes to it.

Yes, I just updated the PR.

I have found something else unrelated to typing, this test (in exactly this 
order):

./python -m test -R 5:5 test_abc test_functools

fails with a reproducible pattern:

test_functools leaked [0, 3, 1, 0, 0] memory blocks, sum=4

If you are happy with the PR now, we could open two separate issues for 
possible bug in inspect.isabstract and refleak in test_functools after 
test_abc. (the latter however might be potentially somehow related to abc 
caches)

--

___
Python tracker 

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



[issue29724] Itertools docs propose a harmful “speedup” without any explanation

2017-03-05 Thread Leonid R.

Leonid R. added the comment:

I think this is a "last resort" optimization and shouldn't be encouraged, 
especially in the official documentation. There are plenty of real 
optimizations you can do before doing micro-optimizations like this, and there 
is no reason it should be mentioned in the docs.

--
nosy: +leovp

___
Python tracker 

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



[issue29724] Itertools docs propose a harmful “speedup” without any explanation

2017-03-05 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

The localization using keyword parameters is a very old trick to avoid global 
lookups. It does give a noticeable speedup, esp. when the localized variables 
are used in tight loops or the function itself is used in such loops.

The 5% speedup Steven measured matches my experience with this trick as well. 
In some cases, it can provide a more dramatic speedup, but this depends a lot 
on how the code is written.

--
nosy: +lemburg

___
Python tracker 

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



[issue29724] Itertools docs propose a harmful “speedup” without any explanation

2017-03-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

How it comparing with

return vec1[0]*vec2[0]+vec1[1]*vec2[1]+vec1[2]*vec2[2]

and

x1, y1, z1 = vec1
x2, y2, z2 = vec2
return x1*x2+y1*y2+z1*z2

and

x1, y1, z1 = vec1
x2, y2, z2 = vec2
return sum(a*b for a, b in zip(vec1, vec2))

?

A 5% speed up may be not enough high for cluttering the educational example.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29724] Itertools docs propose a harmful “speedup” without any explanation

2017-03-05 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On my computer, running Python 3.5 and continuing to do other tasks while the 
tests are running, I get a reproducible 5% speedup by using the "default 
values" trick. Here's my code:

import operator
def dotproduct(vec1, vec2):
return sum(map(operator.mul, vec1, vec2))

def dotproduct2(vec1, vec2, sum=sum, map=map, mul=operator.mul):
return sum(map(mul, vec1, vec2))

setup = 'from __main__ import a, b, dotproduct, dotproduct2'
from random import random as r
a = [[r(), r(), r()] for i in range(1)]
b = [[r(), r(), r()] for i in range(1)]
t1 = Timer('for v1, v2 in zip(a, b): dotproduct(v1, v2)', setup)
t2 = Timer('for v1, v2 in zip(a, b): dotproduct2(v1, v2)', setup)


I then ran and compared 

min(t1.repeat(number=200, repeat=10))
min(t2.repeat(number=200, repeat=10))

a few times while reading email and doing local editing of files. Normal 
desktop activity. Each time, t2 (the dotproduct with the micro-optimizations) 
was about 5% faster.

Victor will probably tell me I'm micro-benchmarking this the wrong way, so to 
satisfy him I did one more run:

py> import statistics
py> d1 = t1.repeat(number=200, repeat=10)
py> d2 = t2.repeat(number=200, repeat=10)
py>
py> statistics.mean(d1); statistics.stdev(d1)
5.277554708393291
0.15216686556059497
py> statistics.mean(d2); statistics.stdev(d2)
4.929395379964262
0.05397586490809523


So I'm satisfied that this trick gives a real, if small, speed up for at least 
the example given. YMMV.

--
nosy: +haypo
type:  -> performance

___
Python tracker 

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



[issue29726] test_xmlrpc raises DeprecationWarnings

2017-03-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Dillon! Could you backport your changes to 3.6 and 3.5?

--

___
Python tracker 

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



[issue29726] test_xmlrpc raises DeprecationWarnings

2017-03-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
nosy: +p...@motejlek.net, serhiy.storchaka
stage:  -> patch review
versions: +Python 3.5, Python 3.6

___
Python tracker 

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



[issue29726] test_xmlrpc raises DeprecationWarnings

2017-03-05 Thread dillon.brock

Changes by dillon.brock :


--
pull_requests: +393

___
Python tracker 

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



[issue29726] test_xmlrpc raises DeprecationWarnings

2017-03-05 Thread dillon.brock

New submission from dillon.brock:

In 3 unit tests, test_xmlrpc calls assertRaises(Exception, 
expectedRegex='method'), causing DeprecationWarnings. These calls should be 
replaced with assertRaisesRegex(Exception, 'method').

0:20:56 [378/404] test_xmlrpc
127.0.0.1 - - [05/Mar/2017 11:53:45] "POST / HTTP/1.1" 200 -
127.0.0.1 - - [05/Mar/2017 11:53:45] "POST / HTTP/1.1" 200 -
/home/dillon/src/cpython/Lib/test/test_xmlrpc.py:430: DeprecationWarning: 
'expected_regex' is an invalid keyword argument for this function
  with self.assertRaises(Exception, expected_regex='method'):
/home/dillon/src/cpython/Lib/test/test_xmlrpc.py:423: DeprecationWarning: 
'expected_regex' is an invalid keyword argument for this function
  with self.assertRaises(Exception, expected_regex='method'):
/home/dillon/src/cpython/Lib/test/test_xmlrpc.py:415: DeprecationWarning: 
'expected_regex' is an invalid keyword argument for this function
  with self.assertRaises(Exception, expected_regex='method'):

--
components: Tests
messages: 289026
nosy: dillon.brock
priority: normal
severity: normal
status: open
title: test_xmlrpc raises DeprecationWarnings
type: behavior
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



[issue29638] Spurious failures in test_collections in releak hunting mode after typing is imported

2017-03-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I just wonder is there any other negative consequences? inspect.isabstract() 
returning False for abstract class looks a bug to me.

If you just want to add a workaround in dash_R_cleanup, I think it would be 
better to generate the list of all abstract classes and add three typing 
classes to it.

clear_caches() is called before running every test, but ABC caches are cleared 
not so often.

--

___
Python tracker 

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



Re: [RELEASE] Python 3.6.1rc1 is now available

2017-03-05 Thread D'Arcy Cain

On 2017-03-05 07:01 AM, Ned Deily wrote:

On behalf of the Python development community and the Python 3.6 release
team, I would like to announce the availability of Python 3.6.1rc1.
3.6.1rc1 is the first release candidate for Python 3.6.1, the first
maintenance release of Python 3.6.  3.6.0 was released on 2017-12-22


from __future__ import 3.6.0

Did Guido finally get that time machine working?

--
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
--
https://mail.python.org/mailman/listinfo/python-list


[issue29724] Itertools docs propose a harmful “speedup” without any explanation

2017-03-05 Thread Steven D'Aprano

Changes by Steven D'Aprano :


--
nosy: +steven.daprano

___
Python tracker 

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



Re: [RELEASE] Python 3.6.1rc1 is now available

2017-03-05 Thread D'Arcy Cain

On 2017-03-05 07:01 AM, Ned Deily wrote:

On behalf of the Python development community and the Python 3.6 release
team, I would like to announce the availability of Python 3.6.1rc1.
3.6.1rc1 is the first release candidate for Python 3.6.1, the first
maintenance release of Python 3.6.  3.6.0 was released on 2017-12-22


from __future__ import 3.6.0

Did Guido finally get that time machine working?

--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@vex.net
VoIP: sip:da...@vex.net
--
https://mail.python.org/mailman/listinfo/python-list


[issue20774] collections.deque should ship with a stdlib json serializer

2017-03-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

FWIW, one of the design goal for deques was to make them easily substitutable 
for lists when needed.  This feature request is a nice-to-have that moves us a 
little closer.

That said, I think a __json__ attribute is too big of a hammer for this simple 
proposal.

Also, please add Bob Ippolito to all JSON issues.  He has excellent design 
sensibilities and considerable contact with users of the json module.

--
nosy: +bob.ippolito

___
Python tracker 

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



[issue29725] sqlite3.Cursor doesn't properly document "arraysize"

2017-03-05 Thread Jürgen A . Erhard

New submission from Jürgen A. Erhard:

It's an attribute mentioned in fetchmany and fetchall, but it's not in the list 
with those two, but it should be, since the section says "A Cursor instance has 
the following attributes and methods." and it is an attribute.

--
assignee: docs@python
components: Documentation
messages: 289023
nosy: docs@python, jae
priority: normal
severity: normal
status: open
title: sqlite3.Cursor doesn't properly document "arraysize"

___
Python tracker 

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



[issue20774] collections.deque should ship with a stdlib json serializer

2017-03-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

There is a difference.  An __json__ attribute would have to convert to a list 
first.  Adding support directly to the json module would allow the deque to be 
read directly.

I think you all are leaning towards premature generalization and making this 
harder than it needs to be.  Chris and Tarek's proposal is a reasonable and 
straight-forward, but it is not being pushed towards PEP territory and I think 
Guido would need to opine on whether to enshrine yet another dunder method that 
would infest the library and privilege the json serialization format over all 
formats.

--

___
Python tracker 

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



[issue29649] struct.pack_into check boundary error message ignores offset

2017-03-05 Thread Andrew Nester

Andrew Nester added the comment:

Thanks Serhiy! Just implemented new error messages in my PR for case you 
mentioned.

--

___
Python tracker 

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



[issue29724] Itertools docs propose a harmful “speedup” without any explanation

2017-03-05 Thread Chris Warrick

New submission from Chris Warrick:

The itertools recipes list [0] ends with the following dubious advice:

> Note, many of the above recipes can be optimized by replacing global lookups 
> with local variables defined as default values. For example, the dotproduct 
> recipe can be written as:
>
> def dotproduct(vec1, vec2, sum=sum, map=map, mul=operator.mul):
> return sum(map(mul, vec1, vec2))

This is presented in the document without any explanation. It may confuse 
beginners into always doing it in their code (as evidenced in #python today), 
leading to unreadable code and function signatures. There is also no proof of 
there being a significant speed difference by using this “trick”. In my 
opinion, this should not be part of the documentation, or should provide proof 
that it can provide a real, noticeable speedup and is not premature 
optimization.

(Added in [1] by Raymond Hettinger — added to nosy list)

[0]: https://docs.python.org/3/library/itertools.html#itertools-recipes
[1]: 
https://github.com/python/cpython/commit/fc91aa28fd8dad5280fd4d3a4747b5e08ee37ac0

--
assignee: docs@python
components: Documentation
messages: 289020
nosy: Kwpolska, docs@python, rhettinger
priority: normal
severity: normal
status: open
title: Itertools docs propose a harmful “speedup” without any explanation
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue29638] Spurious failures in test_collections in releak hunting mode after typing is imported

2017-03-05 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

> What if explicitly set __abstractmethods__ = True for these types?

Unfortunately this does not help. I think this is because dash_R_cleanup only 
clears caches for classes in collections.abc.__all__ and their immediate 
.__subclasses__(). Making this recursive (i.e. also clearing caches of 
__subclasses__() of __subclasses__() etc) will probably fix the problem 
(provided we also add __abstractmethods__ = True). However, this looks a bit 
too complex for me. I would rather add few more typing._cleanups (anyway this 
failure only happens with typing ABCs)

--

___
Python tracker 

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



[issue29638] Spurious failures in test_collections in releak hunting mode after typing is imported

2017-03-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What if explicitly set __abstractmethods__ = True for these types?

--

___
Python tracker 

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



Re: list of the lists - append after search

2017-03-05 Thread gvmcmt
On Thursday, March 2, 2017 at 9:33:14 PM UTC+5:30, Andrew Zyman wrote:
> Hello,
>  please advise.
> 
>  I'd like search and append the internal list in the list-of-the-lists.
> 
> Example:
>  ll =[ [a,1], [b,2], [c,3], [blah, 1000] ]
> 
>  i want to search for the internal [] based on the string field and, if 
> matches, append that list with a value.
> 
>   if internal_list[0] == 'blah':
>   ll[ internal_list].append = [ 'new value']
> 
> End result:
>  ll =[ [a,1], [b,2], [c,3], [blah, 1000, 'new value'] ]
> 
> 
> I came up with the following, but the second stmnt is not correct:
> 
> print [x for x in ll if x[0]== 'blah']
> print ll.index([x for x in ll if x[0]=='blah'])
> 
> output:
> ValueError: [['blah', 1]] is not in list
> 
> 
> 
> 
> thank you
> AZ


list_of_lists = [['a', 1], ['b', 2], ['c', 3], ['blah', 1000]]

for sublist in list_of_lists:
if sublist[0] == 'blah':
sublist.append('new value')


Hope that helps.
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >