[issue26118] String performance issue using single quotes

2016-01-15 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On Fri, Jan 15, 2016 at 07:56:39AM +, poostenr wrote:
> As I did more testing I noticed that appending data to the file slowed 
> down. The file grew initially with ~30-50KB increments and around 
> 500KB it had slowed down to ~3-5KB/s, until around 1MB the file grew 
> at ~1KB/s.

How are you appending to the file? In the code snippets below you merely 
say "append s to file", which is not Python code and could hide a 
multitude of sins. You're asking us to diagnose slow performance in code 
we can't see.

Or perhaps your disk is just badly fragmented, and as the file gets 
bigger, performance gets worse.

> Did conv.escape_string() change something about columnvalue

I don't know. What's conv.escape_string? Where does it come from, and 
what does it do? Again, you're asking us to diagnose code we can't see.

Perhaps you should run the profiler and see where your code is spending 
most of its time.

--

___
Python tracker 

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



[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Charles Daffern

New submission from Charles Daffern:

The shlex.quote and pipes.quote functions do not quote shell keywords.

Example shell keywords: done, time, coproc, while

Presumably the intent of the quote functions is to prevent the resulting string 
from altering the syntax of the script it is inserted into, which is why I 
think these need to be quoted.

We can't possibly know every shell keyword, so the only sensible thing to do 
here is to quote everything.

--
components: Extension Modules
messages: 258292
nosy: Charles Daffern
priority: normal
severity: normal
status: open
title: shlex.quote and pipes.quote do not quote shell keywords
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue26122] Isolated mode doesn't ignore PYTHONHASHSEED

2016-01-15 Thread Nick Coghlan

New submission from Nick Coghlan:

While working on the draft PEP 432 implementation, I noticed that -I isn't 
special cased for early processing the same way that -E is: 
https://hg.python.org/cpython/file/tip/Modules/main.c#l265

This means that when isolated mode is used to turn off environment variable 
access, PYTHONHASHSEED may still be read while configuring hash randomisation.

--
assignee: christian.heimes
messages: 258290
nosy: christian.heimes, ncoghlan
priority: normal
severity: normal
stage: test needed
status: open
title: Isolated mode doesn't ignore PYTHONHASHSEED
type: behavior
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue26072] pdb fails to access variables closed over

2016-01-15 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +georg.brandl
type:  -> behavior

___
Python tracker 

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



[issue26121] Use C99 functions in math if available

2016-01-15 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Currently the math module uses own implementation of some mathematical 
functions that are in C99 standard, but not in C89 standard: tgamma, lgamma, 
erf, erfc. Proposed patch makes it to use functions from standard C library if 
they are available. They are faster and presumably more accurate.

Here are microbenchmark results (time in microseconds):

  0.1 1  3 10 30
erf unpatched:   0.506  0.655  0.509  0.548  0.239
erf patched: 0.129  0.252  0.357  0.253  0.253

erfc unpatched:  0.508  0.646  0.532  0.522  0.251
erfc patched:0.129  0.239  0.373  0.371  0.307

0.11.5 3 10 10.5
gamma unpatched:   0.369  0.279  0.273  0.274  0.457
gamma patched: 0.24   0.23   0.412  0.741  0.682

lgamma unpatched:  0.351  0.338  0.478  0.627  0.52
lgamma patched:0.217  0.155  0.37   0.372  0.247

If some libm implementations are pretty bad, they can be disabled by undefining 
corresponding HAVE_XXX macros.

--
components: Extension Modules
files: math_libc_funcs.patch
keywords: patch
messages: 258288
nosy: mark.dickinson, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Use C99 functions in math if available
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41623/math_libc_funcs.patch

___
Python tracker 

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



[issue19475] Add timespec optional flag to datetime isoformat() to choose the precision

2016-01-15 Thread Alessandro Cucci

Alessandro Cucci added the comment:

I there anything else I can do for this?

--

___
Python tracker 

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



[issue26123] http.client status code constants incompatible with Python 3.4

2016-01-15 Thread Sebastian Rittau

New submission from Sebastian Rittau:

The HTTP status code constants in Python 3.5 http.client are not compatible 
with the constants in Python 3.4, since the str() behaviour is different. This 
breaks code: 

srittau@moby:~$ python3.5
Python 3.5.1+ (default, Jan 13 2016, 15:09:18) 
[GCC 5.3.1 20160101] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import http.client
>>> str(http.client.OK)
'HTTPStatus.OK'

vs:

rittau@moby:~$ python3.4
Python 3.4.4 (default, Jan  5 2016, 15:35:18) 
[GCC 5.3.1 20160101] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import http.client
>>> str(http.client.OK)
'200'

--
components: Library (Lib)
messages: 258291
nosy: srittau
priority: normal
severity: normal
status: open
title: http.client status code constants incompatible with Python 3.4
versions: Python 3.5

___
Python tracker 

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



[issue26121] Use C99 functions in math if available

2016-01-15 Thread Christian Heimes

Christian Heimes added the comment:

Faster: maybe. More accurate ... Mark can tell you some funny stories. :)

--
nosy: +christian.heimes

___
Python tracker 

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



[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread SilentGhost

Changes by SilentGhost :


--
components: +Library (Lib) -Extension Modules
nosy: +eric.araujo
versions:  -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue23606] ctypes.util.find_library("c") no longer makes sense

2016-01-15 Thread Steve Dower

Steve Dower added the comment:

The msvcrt module? I don't think so.

--

___
Python tracker 

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



[issue26084] HTMLParser mishandles last attribute in self-closing tag

2016-01-15 Thread Ezio Melotti

Ezio Melotti added the comment:

This is not a bug, as described in the HTML5 standard[0], if an unquoted 
attribute value is followed by a /, the / is included (the "anything else" 
branch of that list).
This is also what browsers do: try to create an HTML document that includes 
 and open it in a browser, then use the inspector to examine 
the result -- you will see  (at least on firefox).
HTMLParser follows the HTML5 standard, so I'm closing this as "not a bug".
Thanks anyway for the report and to Xiang for pointing out that it's not a bug.

[0]: 
https://www.w3.org/TR/html5/syntax.html#attribute-value-%28unquoted%29-state

--
resolution:  -> not a bug
stage: test needed -> resolved
status: open -> closed
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



[issue26123] http.client status code constants incompatible with Python 3.4

2016-01-15 Thread SilentGhost

Changes by SilentGhost :


--
keywords: +3.5regression
nosy: +serhiy.storchaka
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



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

2016-01-15 Thread Ezio Melotti

Ezio Melotti added the comment:

LGTM unless you think we should also add a test that checks that the name of 
the incorrect type is included in the error message.

--
nosy: +ezio.melotti
stage:  -> commit review
type:  -> behavior
versions: +Python 3.5, Python 3.6 -Python 3.4

___
Python tracker 

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



[issue18595] zipfile: symlinks etc.

2016-01-15 Thread Thomas Kluyver

Changes by Thomas Kluyver :


--
nosy: +takluyver

___
Python tracker 

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



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

2016-01-15 Thread Carlo Beccarini

New submission from Carlo Beccarini:

Incorrect error message in the module asyncio.selector_events for the methods:
_SelectorSocketTransport.write
_SelectorSslTransport.write
_SelectorDatagramTransport.sendto.

The previous error was raising a Tuple:
TypeError: ('data argument must be byte-ish (%r)', )

Patched:
TypeError: data argument must be a bytes-like object, not 'str'

--
components: asyncio
files: patch.diff
keywords: patch
messages: 258294
nosy: Paradisee, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: Incorrect error message in the module asyncio.selector_events.
versions: Python 3.4
Added file: http://bugs.python.org/file41624/patch.diff

___
Python tracker 

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



[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you please provide an 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



[issue26118] String performance issue using single quotes

2016-01-15 Thread poostenr

poostenr added the comment:

Thank you for your feedback Victor and Steven.

I just copied my scripts and 360MB of CSV files over to Linux.
The entire process finished in 4 minutes exactly, using the original python 
scripts.
So there is something different between my environments.
If it was a fragmentation issue, then I would expect to always have a slow 
performance on the Windows system. But I can influence the performance by 
alternating between the two original statements:
s = "{0},".format(columnvalue)   # fast
s = "'{0}',".format(columnvalue) # ~30x slower

I apologize for not being able to provide the entire code.
There is too much code to post at this time.

I am opening a file like this:
#logger = open(filename, rw, buffering, encoding)
logger = open('output.sql', 'a', 1, 'iso-8859-1')

I write to file:
logger.write(text+'\n')

I'm using a library to escape the string before saving to file.
import pymysql.converters as conv
<...>
for key in listkeys:
keyvalue = self.recordstats[key]
fieldtype   = keyvalue[0]
columnvalue = record[key]
columnvalue = conv.escape_string(columnvalue)
if (count > 1):
s = "{0},".format(columnvalue)  # No single quotes
else
s = "{0},".format(columnvalue)  # No single quotes
count -= 1
logger.write(s+'\n')

I appreciate the feedback and ideas so far.
Trying the profiler is on my list to see if it provides more insight.
I am not using Anaconda3 on Linux. Perhaps that has an impact somehow?

I never suspected inserting the two single quotes to cause such a problem in 
performance. I noticed it when I parsed ~40GB of data and it took almost a week 
to complete instead of my expected 6-7 hrs.
Just the other day I decided to remove the single quotes because it was the 
only thing left that I'd changed. I had discarded that change the past two 
weeks because that couldn't be causing the performance problem.

Today, I wasn't expecting such a big difference between running my script on 
Linux or Windows.

If I discover anything else, I will post an update.
When I get the chance I can remove redundant code and post the source.

--

___
Python tracker 

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



[issue26123] http.client status code constants incompatible with Python 3.4

2016-01-15 Thread Sebastian Rittau

Sebastian Rittau added the comment:

It is no doubt that is easy to work around. Once I found the problem it took 
about five minutes to fix it and roll a new release. And of course for Python 
3.5+ code it is better to use the enum http.HTTPStatus directly (I actually 
like that enum a lot). But this breaks existing code that should not break. It 
might be too late to change now, though.

As a side note, I would also have preferred str(HTTPStatus.OK) to return "OK" 
or "200" - the latter would mirror default format behaviour - instead of 
"HTTPStatus.OK", but this may be too late as well.

--

___
Python tracker 

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



[issue26114] Rewrite math.erf() and math.erfc() from scratch

2016-01-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 76eb752e5447 by Brett Cannon in branch '3.5':
Issue #26114: Remove a reference to 'Numerical Recipes'.
https://hg.python.org/cpython/rev/76eb752e5447

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

--
nosy: +python-dev

___
Python tracker 

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



[issue26114] Rewrite math.erf() and math.erfc() from scratch

2016-01-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset faac8f09020d by Brett Cannon in branch '2.7':
Issue #26114: Remove mention of 'Numerical Recipes'.
https://hg.python.org/cpython/rev/faac8f09020d

--

___
Python tracker 

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



[issue26114] Rewrite math.erf() and math.erfc() from scratch

2016-01-15 Thread Brett Cannon

Changes by Brett Cannon :


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



[issue26039] More flexibility in zipfile interface

2016-01-15 Thread Thomas Kluyver

Thomas Kluyver added the comment:

Attached is a first go at a patch enabling zipfile.open(blah, mode='w')

Files must be written sequentially, so you have to close one writing handle 
before opening another. If you try to open a second one before closing the 
first, it will raise RuntimeError. I considered doing something where it would 
write to temporary files and add them to the zip file when they were closed, 
but it seemed like a bad idea.

You can almost certainly break this by reading from a zip file while there's an 
open writing handle. Resolving this is tricky because there's a disconnect in 
the requirements for reading and writing: writing allows for a non-seekable 
output stream, but reading assumes that you can seek freely. The simplest fix 
is to block reading while there is an open file handle. I don't think many 
people will need to read one file from a zip while writing another, anyway.

I have used the lock, but I haven't thought carefully about thread safety, so 
that should still be checked carefully.

--
Added file: http://bugs.python.org/file41626/zipfile-open-w.patch

___
Python tracker 

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



[issue26118] String performance issue using single quotes

2016-01-15 Thread SilentGhost

SilentGhost added the comment:

poostenr, this is demonstrably not a problem with the CPython, which this bug 
tracker is about. There are few options available on the internet if you need 
help with your code: mailing lists and irc are among them.

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



[issue26121] Use C99 functions in math if available

2016-01-15 Thread Yury Selivanov

Changes by Yury Selivanov :


--
nosy: +brett.cannon

___
Python tracker 

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



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

2016-01-15 Thread Carlo Beccarini

Carlo Beccarini added the comment:

https://github.com/python/asyncio/pull/313

--

___
Python tracker 

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



[issue26123] http.client status code constants incompatible with Python 3.4

2016-01-15 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

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



[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be. But only if this doesn't make the documentation too verbose.

--
assignee:  -> docs@python
components: +Documentation
keywords: +easy
nosy: +docs@python
stage:  -> needs patch

___
Python tracker 

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



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

2016-01-15 Thread Carlo Beccarini

Changes by Carlo Beccarini :


--
type: behavior -> 
versions: +Python 3.4 -Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41625/patch.diff

___
Python tracker 

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



[issue19475] Add timespec optional flag to datetime isoformat() to choose the precision

2016-01-15 Thread R. David Murray

Changes by R. David Murray :


--
nosy:  -r.david.murray

___
Python tracker 

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



[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Charles Daffern

Charles Daffern added the comment:

It's definitely a corner case (in argv[0] position + is keyword), but here's an 
example:

>>> import subprocess
>>> import shlex
>>> subprocess.call(shlex.quote("done"), shell=True)
/bin/sh: 1: Syntax error: "done" unexpected
2

The expected output of this would be:

/bin/sh: 1: done: not found
127

This would be the output if shlex.quote("done") returned "'done'" or r'\done' 
or any other combination of escaped/quoted characters where the keyword would 
otherwise be.

--

___
Python tracker 

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



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

2016-01-15 Thread Guido van Rossum

Guido van Rossum added the comment:

Remember also to apply to asyncio's own GitHub repo.

--Guido (mobile)
On Jan 15, 2016 6:03 AM, "Ezio Melotti"  wrote:

>
> Ezio Melotti added the comment:
>
> LGTM unless you think we should also add a test that checks that the name
> of the incorrect type is included in the error message.
>
> --
> nosy: +ezio.melotti
> stage:  -> commit review
> type:  -> behavior
> versions: +Python 3.5, Python 3.6 -Python 3.4
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue26114] Rewrite math.erf() and math.erfc() from scratch

2016-01-15 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for the historical information, Mark! I'll either update the comment or 
flat-out delete it so it doesn't trip anyone else up.

I'll also scale back the scope of the update since it's just a cleanup and not 
an IP issue.

--
assignee:  -> brett.cannon
versions:  -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This does not seem to be a serious problem. In any case the command is failed. 
And usually argv[0] is predefined command name, not arbitrary user input. To be 
sure that it is existing program, you can use shutil.which().

I would close this issue as "won't fix".

--
resolution:  -> wont fix

___
Python tracker 

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



[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Charles Daffern

Charles Daffern added the comment:

In that case, should the documentation specify that shlex.quote is unsuitable 
for quoting command names?

--

___
Python tracker 

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



[issue26123] http.client status code constants incompatible with Python 3.4

2016-01-15 Thread Ethan Furman

Ethan Furman added the comment:

These changes were made in issue21793.

--

___
Python tracker 

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



[issue26123] http.client status code constants incompatible with Python 3.4

2016-01-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, this a side effect of using more human-friendly enums. This is not a 
problem if string representation is used in formatting human-readable messages, 
but if you need numerical representation, you could use str(int(code)), '%d' % 
code or '{:d}'.format(code).

--

___
Python tracker 

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



[issue26126] Possible subtle bug when normalizing and str.translate()ing

2016-01-15 Thread Peter Otten

Peter Otten added the comment:

There seems to be a connection to hash randomization. I consistently get

$ PYTHONHASHSEED=1 python3.6 ./normbug.py 
BUG ('The aenid oevre', '!=', 'The AEnid oevre')
$ PYTHONHASHSEED=0 python3.6 ./normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')

--
nosy: +peter.otten

___
Python tracker 

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



[issue26126] Possible subtle bug when normalizing and str.translate()ing

2016-01-15 Thread Mark Summerfield

New submission from Mark Summerfield:

I am using Python 3.4.3 on Xubuntu 14.04 LTS 64-bit.

I have a program that when run repeatedly sometimes what I expect, and 
sometimes does not:

$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
BUG ('The aenid oevre', '!=', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
BUG ('The aenid oevre', '!=', 'The AEnid oevre')
$ ~/tmp/normbug.py 
BUG ('The aenid oevre', '!=', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')

As you can see, sometimes the left (actual) is case-folded, and sometimes it 
isn't which is surprising given the code (which is attached).

Of course this could be a mistake on my part; maybe I've misunderstood how the 
unicode normalizing works.

--
files: normbug.py
messages: 258314
nosy: mark
priority: normal
severity: normal
status: open
title: Possible subtle bug when normalizing and str.translate()ing
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file41627/normbug.py

___
Python tracker 

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



[issue26126] Possible subtle bug when normalizing and str.translate()ing

2016-01-15 Thread Peter Otten

Peter Otten added the comment:

Not a bug. In your XFORMS dict you have

>>> ord("Æ") == 0xC6
True

Whether the value of "Æ" or 0xC6 is used by str.maketrans() depends on the 
order of the dict entries which in turn is determined by the keys' hash. Remove 
one and you should see consistent results.

--

___
Python tracker 

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



[issue26094] ConfigParser.get() doc to be updated according to the configparser.py header doc

2016-01-15 Thread Fred L. Drake, Jr.

Changes by Fred L. Drake, Jr. :


--
nosy: +fdrake

___
Python tracker 

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



[issue17633] zipimport's handling of namespace packages is incorrect

2016-01-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 07a615a8f9ad by Brett Cannon in branch '3.5':
Issue #17633: Improve support for namespace packages with zipimport.
https://hg.python.org/cpython/rev/07a615a8f9ad

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

--
nosy: +python-dev

___
Python tracker 

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



[issue26126] Possible subtle bug when normalizing and str.translate()ing

2016-01-15 Thread SilentGhost

Changes by SilentGhost :


--
status: open -> closed

___
Python tracker 

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



[issue26126] Possible subtle bug when normalizing and str.translate()ing

2016-01-15 Thread SilentGhost

SilentGhost added the comment:

Mark, your XFORMS dictionary contains this entry: 0x00C6: "ae"
It should be 'AE'. The same applies to 0x0152: "oe" which should be 'OE'.

--
nosy: +SilentGhost
resolution:  -> not a bug
stage:  -> resolved

___
Python tracker 

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



[issue26127] Broken link in docs for tokenize

2016-01-15 Thread Antony Lee

New submission from Antony Lee:

The docs for `tokenize.detect_encoding` state `Use open() to open Python source 
files: it uses detect_encoding() to detect the file encoding.`

Unfortunately, clicking on `open` redirects to the builtin `open` function, not 
to `tokenize.open` as it should.

--
assignee: docs@python
components: Documentation
messages: 258319
nosy: Antony.Lee, docs@python
priority: normal
severity: normal
status: open
title: Broken link in docs for tokenize
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



[issue26127] Broken link in docs for tokenize

2016-01-15 Thread SilentGhost

SilentGhost added the comment:

Here is the patch. Most of the fixes are however for the tokenize function that 
was for whatever reason linked to the module.

--
keywords: +patch
nosy: +SilentGhost
stage:  -> patch review
type:  -> behavior
Added file: http://bugs.python.org/file41628/issue26127.diff

___
Python tracker 

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



[issue17633] zipimport's handling of namespace packages is incorrect

2016-01-15 Thread Brett Cannon

Brett Cannon added the comment:

The fix for 3.5 is in https://hg.python.org/cpython/rev/07a615a8f9ad and 3.6 in 
https://hg.python.org/cpython/rev/87f87673af7b.

Thanks to Phil and Mike for tackling this problem!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.5

___
Python tracker 

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



[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr. added the comment:

It's not at all obvious that the intention is to ensure such an argument should 
be treated only as a command external to the shell.

If an application really wants to ensure the command is not handled as a shell 
built-in, it should use shell=False.

Making this clear in the documentation is reasonable.

--
nosy: +fdrake

___
Python tracker 

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



[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2016-01-15 Thread Charles Daffern

Charles Daffern added the comment:

>To be sure that it is existing program, you can use shutil.which()

I'd like to clear this up a little because this is worded as if 
shutil.which()'s success implies that the shell will not fail.

Here is the setup to demonstrate:

>>> import os, shlex, shutil, subprocess
>>> open("do", "w").write("#!/bin/sh\necho Something is being done...")
__main__:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='do' 
mode='w' encoding='UTF-8'>
41
>>> os.chmod("do", 0o700)


Here is the behaviour using shlex.quote:

>>> subprocess.call(shlex.quote("do"), shell=True, env={'PATH': '.'})
/bin/sh: 1: Syntax error: "do" unexpected
2


Here is the behaviour when quoting properly:

>>> subprocess.call("'do'", shell=True, env={'PATH': '.'})
Something is being done...
0


Here is the output of shutil.which:

>>> shutil.which("do", path=".")
'./do'


So checking shutil.which()'s success or failure will not guard against this 
case (though using its output would work around the problem).

>It's not at all obvious that the intention is to ensure such an argument 
>should be treated only as a command external to the shell.
>
>If an application really wants to ensure the command is not handled as a shell 
>built-in, it should use shell=False.

The shell will still search builtins if the argument is quoted, it just won't 
search for keywords. So, a quoted "bind", "shopt" or "jobs" will still work, 
but a quoted "case", "fi" or "done" will cause the shell to search for a 
command of that name rather than treating it as syntax.

Looking at the source, shlex.quote's refusal to quote certain arguments appears 
to be intentional. I would rather it quote slightly more carefully than 
necessary, than quote something incorrectly.

--

___
Python tracker 

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



[issue26128] Let the subprocess.STARTUPINFO constructor take arguments

2016-01-15 Thread Ram Rachum

New submission from Ram Rachum:

Right now when you want to use `subprocess.STARTUPINFO`, you need to do 
something like this: 

si = subprocess.STARTUPINFO()
si.dwFlags = subprocess.STARTF_USESTDHANDLES
subprocess.Popen(['whatever'], startupinfo=si)

It would be much nicer to do this: 

subprocess.Popen(
['whatever'],
startupinfo=subprocess.STARTUPINFO(
subprocess.STARTF_USESTDHANDLES
)
)

So I suggest that the `STARTUPINFO` constructor take an optional argument that 
sets the flags on it.

--
components: Library (Lib), Windows
messages: 258324
nosy: cool-RR, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Let the subprocess.STARTUPINFO constructor take arguments
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue26129] Difference in behaviour with grp.getgrgid and pwd.getpwuid

2016-01-15 Thread Simon Fraser

New submission from Simon Fraser:

grp.getgrgid is capable of accepting a string:

from grp import getgrgid
print(getgrgid('0'))

However, pwd.getpwuid can't do the same:

from pwd import getpwuid
print(getpwuid('0'))

Traceback (most recent call last):
  File "getpwuid_test.py", line 2, in 
print(getpwuid('0'))
TypeError: an integer is required

This seems to be because inside Modules/pwdmodule.c, getpwuid uses 
PyNumber_ParseTuple with a converter that uses PyNumber_Index to get a Python 
integer, and that raises an exception on failure.

However, in Modules/grpmodule.c, grp_getgrgid uses PyNumber_Long (Or 
PyNumber_Int for an old enough Python) as a conversion first, and as the 
documentation says at https://docs.python.org/3/c-api/number.html, this is the 
equivalent of running int(o), which can convert a string to an integer. Only 
then is it given to PyNumber_Index, by way of a helper function 
_Py_Gid_Converter

Should these have different behaviours? Is there a reason for the difference?

The behaviour of getgrgid seems more helpful, and it's odd that it doesn't 
apply to both functions. Is this undesirable behaviour in getgrgid or getpwuid?

--
components: Library (Lib)
messages: 258325
nosy: SimonFr
priority: normal
severity: normal
status: open
title: Difference in behaviour with grp.getgrgid and pwd.getpwuid
type: behavior
versions: Python 2.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



[issue26130] redundant local copy of a char pointer in classify in Parser\parser.c

2016-01-15 Thread Oren Milman

New submission from Oren Milman:

In Parser\parser.c in classify, the 'str' parameter is assigned into the local 
variable 's'. However, 'str' is not used anywhere else in the function, which 
makes 's' redundant.

My proposal is to simply remove 's', and just use 'str' instead.

The diff is attached.

I played a little with the interpreter, and everything worked as usual.
In addition, I run 'python -m test' (on my 64-bit Windows 10) before and after 
applying the patch, and got the same output:
354 tests OK.
1 test altered the execution environment:
test_subprocess
45 tests skipped:
test_bz2 test_crypt test_curses test_dbm_gnu test_dbm_ndbm
test_devpoll test_epoll test_fcntl test_fork1 test_gdb test_grp
test_idle test_ioctl test_kqueue test_lzma test_nis test_openpty
test_ossaudiodev test_pipes test_poll test_posix test_pty test_pwd
test_readline test_resource test_smtpnet test_socketserver
test_spwd test_sqlite test_ssl test_syslog test_tcl
test_threadsignals test_timeout test_tix test_tk test_ttk_guionly
test_ttk_textonly test_urllib2net test_urllibnet test_wait3
test_wait4 test_winsound test_xmlrpc_net test_zipfile64

--
components: Interpreter Core
files: patchDiff.txt
messages: 258326
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: redundant local copy of a char pointer in classify in Parser\parser.c
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41629/patchDiff.txt

___
Python tracker 

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



[issue26130] redundant local copy of a char pointer in classify in Parser\parser.c

2016-01-15 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +benjamin.peterson, brett.cannon, georg.brandl, ncoghlan, yselivanov

___
Python tracker 

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



[issue26130] redundant local copy of a char pointer in classify in Parser\parser.c

2016-01-15 Thread Georg Brandl

Georg Brandl added the comment:

Looks good to me. s was probably left over after a rewrite of the function.

--

___
Python tracker 

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



[issue21762] update the import machinery to only use __spec__

2016-01-15 Thread Brett Cannon

Brett Cannon added the comment:

So I am going to disagree with Nick about the module attributes and their 
usefulness (partially because I just made __spec__.parent take precedence over 
__package__ in issue #25791). While I get the idea of wanting a history of what 
did (not) change since import, keeping the duplicate information around is 
annoying. And I don't know how truly useful it is to know what things were 
compared to what they became.

If we shift to preferring specs compared to module attributes we can then begin 
to clean up __import__ itself by no longer grabbing the globals() and locals() 
and instead simply pass in the module's __spec__ object. It also simplifies the 
documentation such that we don't have to explain everything twice. If people 
really want to track what a value was relating to import before mutation they 
can simply store it themselves instead of making us do the bookkeeping for 
them. It would also make things such as module_from_spec() or 
loader.create_module() simpler since they only have to worry about setting 
__spec__ instead of that attribute plus a bunch of other ones.

--
priority: normal -> low
versions: +Python 3.6 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue26131] Raise ImportWarning when loader.load_module() is used

2016-01-15 Thread Brett Cannon

New submission from Brett Cannon:

Since loader.load_module() is documented as deprecated, we should consider 
raising an ImportWarning when it is used. That way when Python 2.7 support ends 
we can either remove it or have one more release where the various 
ImportWarnings turn into DeprecationWarnings and we finally clean up the import 
semantics to only be spec-based.

--
components: Interpreter Core
messages: 258333
nosy: brett.cannon, eric.snow, ncoghlan
priority: normal
severity: normal
stage: test needed
status: open
title: Raise ImportWarning when loader.load_module() is used
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



[issue24840] implement bool conversion for enums to prevent odd edge case

2016-01-15 Thread Ethan Furman

Ethan Furman added the comment:

Mike, my apologies.  In the future I'll make sure and read the docs before I go 
through with changes.

In the docs (https://www.python.org/dev/peps/pep-0435/#id35):

The reason for defaulting to 1 as the starting number and
not 0 is that 0 is False in a boolean sense, but enum members
all evaluate to True.

>From a newer discussion on Python Ideas and Python Dev:

Barry Warsaw:
I think in general enums are primarily a symbolic value and don't
have truthiness.  It's also so easy to override when you define
the enum that it's not worth changing the current behavior.

Guido van Rossum:
Honestly I think it's too late to change. The proposal to change
plain Enums to False when their value is zero (or falsey) would
be a huge backward incompatibility. I don't think there's a reasonable
path forward, and also don't think there's a big reason to regret
the current semantics.

Thank you, Gregory, for catching that.

--

___
Python tracker 

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



[issue26003] Issues with PyEval_InitThreads and PyGILState_Ensure

2016-01-15 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +haypo

___
Python tracker 

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



[issue25791] Raise an ImportWarning when __spec__.parent/__package__ isn't defined for a relative import

2016-01-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6908b2c9a404 by Brett Cannon in branch 'default':
Issue #25791: Raise an ImportWarning when __spec__ or __package__ are
https://hg.python.org/cpython/rev/6908b2c9a404

--
nosy: +python-dev

___
Python tracker 

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



[issue25791] Raise an ImportWarning when __spec__.parent/__package__ isn't defined for a relative import

2016-01-15 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for the patch, Rose! I did notice your review comments about the missing 
goto and the stacklevel and I simply added them myself.

--
resolution:  -> fixed
stage: test needed -> 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



[issue21235] importlib's spec module create algorithm is not exposed

2016-01-15 Thread Brett Cannon

Brett Cannon added the comment:

Due to lack of response, I'm assuming all issues are now addressed.

--
status: pending -> closed

___
Python tracker 

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



[issue26123] http.client status code constants incompatible with Python 3.4

2016-01-15 Thread Martin Panter

Martin Panter added the comment:

This affected the HTTP server log messages, discussed from 
 onwards. The first three patches 
proposed changed the HTTPStatus.__str__() implementation, which would have 
avoided the problem in general. But Demian’s final patch made a special case of 
checking for HTTPStatus objects in the logging code instead.

IMO it may have been better to change HTTPStatus.__str__() to use int.__str__() 
at the time.

--
nosy: +martin.panter

___
Python tracker 

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



[issue26123] http.client status code constants incompatible with Python 3.4

2016-01-15 Thread Ethan Furman

Ethan Furman added the comment:

Not using Enum's __str__ was discussed (I think during the initial Enum threads 
when PEP435 was being debated) and IIRC Guido was strongly against it as it 
took away half the purpose of using an Enum.

--

___
Python tracker 

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



[issue9372] pulldom.DOMEventStream.__getitem__ is broken

2016-01-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Similar outdated __getitem__ left in wsgiref.util.FileWrapper and 
fileinput.FileInput.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18287] PyType_Ready() should sanity-check the tp_name field

2016-01-15 Thread Rose Ames

Rose Ames added the comment:

There's still no check on tp_name.  The patch looks reasonable, applies 
cleanly, compiles, and doesn't break any tests - suggest it be merged.

--
nosy: +superluser

___
Python tracker 

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



[issue24832] Issue building viewable docs with newer sphinx (default theme -> classic)

2016-01-15 Thread Benjamin Peterson

Benjamin Peterson added the comment:

We build happily with 1.3.3 on docs.python.org, so looks like everything is 
okay.

--
resolution: third party -> 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



[issue26035] traceback.print_tb() takes `tb`, not `traceback` as a keyword argument

2016-01-15 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Thanks for the patch, Upendra Kumar. It's fixed now. Appreciate your taking 
care of other args and making the change meaningful.

--
assignee: docs@python -> orsenthil
nosy: +orsenthil
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue14771] Occasional failure in test_ioctl when run parallel with test_gdb

2016-01-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8b8ac7adbf49 by Martin Panter in branch '2.7':
Issue #14771: Redirect GDB's stdin to avoid messing the terminal settings
https://hg.python.org/cpython/rev/8b8ac7adbf49

New changeset c87cc05af8e7 by Martin Panter in branch '3.5':
Issue #14771: Redirect GDB's stdin to avoid messing the terminal settings
https://hg.python.org/cpython/rev/c87cc05af8e7

--
nosy: +python-dev

___
Python tracker 

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



[issue26094] ConfigParser.get() doc to be updated according to the configparser.py header doc

2016-01-15 Thread Martin Panter

Martin Panter added the comment:

Perhaps the doc string of the module should be condensed into a much shorter 
summary of the class and its methods, and the details should be moved to 
individual doc strings and the main documentation.

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



[issue26127] Broken link in docs for tokenize

2016-01-15 Thread Martin Panter

Martin Panter added the comment:

Oops that last commit was for Issue #14771

--

___
Python tracker 

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



[issue26127] Broken link in docs for tokenize

2016-01-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 620a37dbc686 by Martin Panter in branch 'default':
Issue #26127: Merge test_gdb fix from 3.5
https://hg.python.org/cpython/rev/620a37dbc686

--

___
Python tracker 

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



[issue14771] Occasional failure in test_ioctl when run parallel with test_gdb

2016-01-15 Thread Martin Panter

Changes by Martin Panter :


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



[issue26035] traceback.print_tb() takes `tb`, not `traceback` as a keyword argument

2016-01-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset daff4ced1b32 by Senthil Kumaran in branch '2.7':
Issue26035 - Correct the argument names used in the docs of the traceback 
module. Make it consistent with module args.
https://hg.python.org/cpython/rev/daff4ced1b32

--

___
Python tracker 

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



[issue26035] traceback.print_tb() takes `tb`, not `traceback` as a keyword argument

2016-01-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e40f6c3dc114 by Senthil Kumaran in branch '3.5':
Issue26035 - Correct the argument names used in the docs of the traceback 
module. Make it consistent with module args.
https://hg.python.org/cpython/rev/e40f6c3dc114

New changeset e96c1491896d by Senthil Kumaran in branch 'default':
Merge from 3.5
https://hg.python.org/cpython/rev/e96c1491896d

--
nosy: +python-dev

___
Python tracker 

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



[issue23883] __all__ lists are incomplete

2016-01-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 571632315c36 by Martin Panter in branch 'default':
Issue #23883: Missing fileinput.__all__ APIs; patch by Mauro SM Rodrigues
https://hg.python.org/cpython/rev/571632315c36

New changeset a2ffa9eedb1b by Martin Panter in branch 'default':
Issue #23883: Add missing APIs to calendar.__all__
https://hg.python.org/cpython/rev/a2ffa9eedb1b

New changeset 48090e08e367 by Martin Panter in branch 'default':
Issue #23883: Add missing APIs to tarfile.__all__
https://hg.python.org/cpython/rev/48090e08e367

New changeset a5d3ebb6ad2a by Martin Panter in branch 'default':
Issue #23883: Update news
https://hg.python.org/cpython/rev/a5d3ebb6ad2a

--

___
Python tracker 

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



[issue26126] Possible subtle bug when normalizing and str.translate()ing

2016-01-15 Thread Mark Summerfield

Mark Summerfield added the comment:

Thanks for looking at this. In my full translation dict I had some other 
mistakes of case, now all fixed:-)

--

___
Python tracker 

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



[issue23883] __all__ lists are incomplete

2016-01-15 Thread Martin Panter

Martin Panter added the comment:

I committed the last three patches to 3.6:

571632315c36: fileinput
a2ffa9eedb1b: calendar
48090e08e367: tarfile
a5d3ebb6ad2a: Update news

Please let me know if there are some outstanding patches here that I missed. 
Otherwise, I think we are up to step 6 in 
.

--

___
Python tracker 

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



[issue26116] CSV-module. The example code don't work. Have to be: reader = csv.reader(csvfile, dialect=dialect)

2016-01-15 Thread Василь Коломієць

Василь Коломієць added the comment:

))
Thanks!
Be happy!

--

___
Python tracker 

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



[issue26114] Rewrite math.erf() and math.erfc() from scratch

2016-01-15 Thread Mark Dickinson

Mark Dickinson added the comment:

The comment is unfortunate. The code in Modules/mathmodule.c *was* written from 
scratch (by me). All I took from Numerical Recipes was the idea of using 
continued fractions from one part of the domain and a power-series expansion 
for another part. If you compare the code with the NR code, there's really no 
similarity beyond that part.

Perhaps just deleting the NR reference is the way to go.

--

___
Python tracker 

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



[issue26114] Rewrite math.erf() and math.erfc() from scratch

2016-01-15 Thread Mark Dickinson

Mark Dickinson added the comment:

... and the way I read it, the NR licence applies specifically to their code, 
not to the basic numerical ideas set out in the text (which is all we're 
using). We're not using the actual code from NR at all.

IOW, IANAL but I really don't think there's an issue here.

--

___
Python tracker 

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



[issue26114] Rewrite math.erf() and math.erfc() from scratch

2016-01-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

erf() is a part of C99. May be move hand-writen implementation to 
Modules/_math.c and use libc erf() if available?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue23606] ctypes.util.find_library("c") no longer makes sense

2016-01-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Strictly there's nothing incorrect about the docs, and `cdll.msvcrt` is no 
> more incorrect than it has been since Python 2.4 or so (whenever we  stopped 
> using VC6). It will find the DLL and you can call the functions, but it isn't 
> the same DLL as the exports in the `msvcrt` module will call.

Is there a documentation of what functions are exposed through it?

--

___
Python tracker 

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



[issue26118] String performance issue using single quotes

2016-01-15 Thread STINNER Victor

STINNER Victor added the comment:

I implemented overkill optimization in _PyUnicodeWriter API used by 
str.format() and str%args. If the result is the input, the string is not copied 
by value, but by reference.

>>> x="hello"
>>> ("%s" % x) is x
True
>>> ("{}".format(x)) is x
True

If the format string adds something before/after, the string is duplicated:

>>> ("x=%s" % x) is x
False
>>> ("x={}".format(x)) is x
False

The optimization is implemented in _PyUnicodeWriter_WriteStr():

https://hg.python.org/cpython/file/32a4e7b337c9/Objects/unicodeobject.c#l13604

--
nosy: +haypo

___
Python tracker 

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



[issue26118] String performance issue using single quotes

2016-01-15 Thread STINNER Victor

STINNER Victor added the comment:

> If you see a factor of 30x difference in your code, I suspect it's not 
> related to str.format(), but some other processing in your code.

The performance of instructions like ("x=%s" % x) or ("x={}".format(x)) depend 
on the length of the string. Maybe poostenr has some very long strings?

--

Closed issues related to _PyUnicodeWriter API:

* issue #14716: Use unicode_writer API for str.format()
* issue #14687: Optimize str%tuple for the PEP 393
* issue #14744: Use _PyUnicodeWriter API in str.format() internals
* issue #16147: Rewrite PyUnicode_FromFormatV() to use the _PyUnicodeWriter API
* issue #17694: Enhance _PyUnicodeWriter API to control minimum buffer length 
without overallocation
* issue #19513: Use PyUnicodeWriter instead of PyAccu in repr(tuple) and 
repr(list)
* issue #19646: Use PyUnicodeWriter in repr(dict)

I'm listing these issues because they contain microbenchmarks script if you 
would like to play with them.

--

___
Python tracker 

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



[issue26114] Rewrite math.erf() and math.erfc() from scratch

2016-01-15 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 15.01.2016 10:05, Mark Dickinson wrote:
> 
> Mark Dickinson added the comment:
> 
> ... and the way I read it, the NR licence applies specifically to their code, 
> not to the basic numerical ideas set out in the text (which is all we're 
> using). We're not using the actual code from NR at all.
> 
> IOW, IANAL but I really don't think there's an issue here.

The license is a copyright license, so it only applies to the
actual code from the book. The ideas would have to be patented
to be protected. Copyright in some code or text is not enough
to (potentially) prevent someone else from reusing the ideas.

If someone is aware of a patent on the algorithm, we may have
an issue. Otherwise, there's no issue if we're using Mark's
implementation.

--

___
Python tracker 

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



[issue26114] Rewrite math.erf() and math.erfc() from scratch

2016-01-15 Thread Mark Dickinson

Mark Dickinson added the comment:

@Serhiy: Sure, that would work (the same way that we do for log1p). I *think* I 
tried this at the time, but it turns out that some libm implementations of erf 
and erfc are pretty bad, so our tests failed. (But I may be misremembering.)

In any case, the proposal to use the libm erf/erfc should be a separate issue, 
I think.

--

___
Python tracker 

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



[issue26092] doctest should allow custom sys.displayhook

2016-01-15 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +georg.brandl
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



[issue26084] HTMLParser mishandles last attribute in self-closing tag

2016-01-15 Thread Xiang Zhang

Xiang Zhang added the comment:

I don't think this is a bug. The HTML5 syntax spec tells:

If an attribute using the unquoted attribute syntax is to be followed by 
another attribute or by the optional "/" (U+002F) character allowed in step 6 
of the start tag syntax above, then there must be a space character separating 
the two.

So I think HTMLParser's behaviour is right.

The link is https://www.w3.org/TR/html5/syntax.html#attributes-0.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue26084] HTMLParser mishandles last attribute in self-closing tag

2016-01-15 Thread Xiang Zhang

Xiang Zhang added the comment:

Hmm, can not say the behaviour is right. But since the HTML doesn't follows the 
official rule, HTMLParser's behaviour is understandable and can not be 
identified as incorrect.

--

___
Python tracker 

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