[issue30277] Speeds up compiling cases-insensitive regular expressions

2017-05-05 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Currently _sre.getlower() takes two arguments. Depending on the bits set in the 
second argument it uses one of three algorithms for determining the lower case 
of the character -- Unicode, ASCII-only, and locale-depended. After resolving 
issue30215 _sre.getlower() no longer used for locale-depended case. Proposed 
patch replaces _sre.getlower() with two one-argument functions: 
_sre.ascii_tolower() and _sre.unicode_tolower(). This slightly speeds up 
compiling cases-insensitive regular expressions, especially containing ranges.

$ ./python -m timeit -s 'import sre_compile'  
'sre_compile.compile("(?i)ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0)'
Unpatched:  2000 loops, best of 5: 180 usec per loop
Patched:2000 loops, best of 5: 173 usec per loop

$ ./python -m timeit -s 'import sre_compile'  
'sre_compile.compile("(?ia)ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0)'
Unpatched:  2000 loops, best of 5: 175 usec per loop
Patched:2000 loops, best of 5: 168 usec per loop

$ ./python -m timeit -s 'import sre_compile'  'sre_compile.compile("(?i)[A-Z]", 
0)'
Unpatched:  500 loops, best of 5: 788 usec per loop
Patched:500 loops, best of 5: 766 usec per loop

$ ./python -m timeit -s 'import sre_compile'  
'sre_compile.compile("(?ia)[A-Z]", 0)'
Unpatched:  5000 loops, best of 5: 92 usec per loop
Patched:5000 loops, best of 5: 83.2 usec per loop

$ ./python -m timeit -s 'import sre_compile'  
'sre_compile.compile("(?i)[\u0410-\u042f]", 0)'
Unpatched:  2000 loops, best of 5: 141 usec per loop
Patched:2000 loops, best of 5: 122 usec per loop

$ ./python -m timeit -s 'import sre_compile'  
'sre_compile.compile("(?i)[\u-\u]", 0)'
Unpatched:  5 loops, best of 5: 59 msec per loop
Patched:10 loops, best of 5: 28.9 msec per loop

--
assignee: serhiy.storchaka
components: Library (Lib), Regular Expressions
messages: 293049
nosy: ezio.melotti, mrabarnett, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Speeds up compiling cases-insensitive regular expressions
type: performance
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



[issue30243] Core dump when use uninitialized _json objects

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 76a3e51a403bc84ed536921866c86dd7d07aaa7e by Serhiy Storchaka in 
branch 'master':
bpo-30243: Fixed the possibility of a crash in _json. (#1420)
https://github.com/python/cpython/commit/76a3e51a403bc84ed536921866c86dd7d07aaa7e


--

___
Python tracker 

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



[issue30277] Speeds up compiling cases-insensitive regular expressions

2017-05-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1567

___
Python tracker 

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



[issue30243] Core dump when use uninitialized _json objects

2017-05-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1568

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy: "As you said, calling close() can have side effects (for example 
invoking self._cont_handler.endDocument()). This was the argument against PR 
1444. It seems to me that if _entity_stack is not empty (this happens in case 
of error in entity parsing) the close() method does nothing. And maybe there 
are other leaks in entity parsing."

Right, it seems that the conclusion is that there is not only a high risk of 
regression because of unexpected side effects, but also an issue with unknown 
external parsers.

So finally I moved backward and proposed my change on ExpatParser.parse():

* the change has a narrow scope: only ExpatParser.parse() is modified, external 
unknown code is not impact, low risk of regression for external parsers.

* the change is well defined: it does exactly one thing, it makes sure that the 
source is closed, especially the inner file object or urllib object. My change 
makes sure that the sure is always closed, even if the close() method does 
nothing.

According to the long list of constraints for this fix, I don't think that we 
can do better.

I made one design choice: the close() method of byte and character streams are 
called twice, I didn't call setByteStream(None) / setCharacterStream(None) to 
avoid creating an inconsistent source. If you really care, maybe we can reset 
the source to a new xmlreader.InputSource() object instead.

--

___
Python tracker 

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



[issue30243] Core dump when use uninitialized _json objects

2017-05-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1569

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2017-05-05 Thread Louie Lu

Louie Lu added the comment:

But somehow in this case, List have no __text_signature__:

>>> str(i.signature(list))
'(iterable=(), /)'
>>> list.__text_signature__
'(iterable=(), /)'
>>> str(i.signature(List))
'(iterable=(), /)'
>>> List.__text_signature__
>>>

--

___
Python tracker 

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



[issue29094] Regression in zipfile writing in 2.7.13

2017-05-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage: commit review -> backport needed
versions:  -Python 2.7

___
Python tracker 

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



[issue30270] Remove sqlite3.Cache display method

2017-05-05 Thread Aviv Palivoda

Aviv Palivoda added the comment:

>From looking at the git blame this is there since 2006. Maybe this should be 
>dependent on issue #30262. Maybe at first there should be a deprecation 
>warning and then removing this later.
I understand that this might break someone's code but this is an undocumented 
method of an undocumented class in the sqlite3 module. I don't think that there 
will be a lot of people that use the sqlite3.Cache object.

--

___
Python tracker 

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



[issue30190] unittest's assertAlmostEqual improved error message

2017-05-05 Thread Berker Peksag

Changes by Berker Peksag :


--
components: +Library (Lib)
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

> I made one design choice: the close() method of byte and character streams 
> are called twice, I didn't call setByteStream(None) / 
> setCharacterStream(None) to avoid creating an inconsistent source. If you 
> really care, maybe we can reset the source to a new xmlreader.InputSource() 
> object instead.

Hum, I just modified my PR one more time to replace try/finally: 
self._close_source() with "try/except: self._close_source(); raise", so 
file.close() is now only called once.

--

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2017-05-05 Thread Louie Lu

Louie Lu added the comment:

And, another case, the __text_signature__ and i.signature() is similar, but not 
the same:

>>> range.__init__.__text_signature__
'($self, /, *args, **kwargs)'
  ^
>>> str(i.signature(range.__init__))
'(self, /, *args, **kwargs)'

So we can't simply compare-and-eliminate this case.

--

___
Python tracker 

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



[issue30278] The element div#sidebar on documentation requires the attribute role="button".

2017-05-05 Thread Kyle Thomas

New submission from Kyle Thomas:

Elements other than buttons which act as buttons require metadata to be 
accessible. Refer to
https://www.w3.org/TR/wai-aria-practices/examples/button/button.html

--
assignee: docs@python
components: Documentation
messages: 293056
nosy: Kyle Thomas, docs@python
priority: normal
severity: normal
status: open
title: The element div#sidebar on documentation requires the attribute 
role="button".
type: enhancement
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



[issue30119] (ftplib) A remote attacker could possibly attack by containing the newline characters

2017-05-05 Thread Berker Peksag

Changes by Berker Peksag :


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



[issue30243] Core dump when use uninitialized _json objects

2017-05-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1570

___
Python tracker 

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



[issue30279] Remove unused Python/thread_foobar.h

2017-05-05 Thread Masayuki Yamamoto

New submission from Masayuki Yamamoto:

Python/thread_foobar.h is the template code that is threading adaptation for 
new platforms, and it hasn't been used on actual platforms.  As a matter of 
fact, Python/thread_pthread.h and Python/thread_nt.h give concrete examples of 
adaptation, therefore, I think thread_foobar.h hasn't needed no more.  In 
addition, there was an issue that only changed thread_foobar.h to fix 
overlooking (issue21312).

python-dev: https://mail.python.org/pipermail/python-dev/2017-May/147840.html

--
components: Interpreter Core
messages: 293057
nosy: masamoto
priority: normal
severity: normal
status: open
title: Remove unused Python/thread_foobar.h
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



[issue29861] multiprocessing Pool keeps objects (tasks, args, results) alive too long

2017-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1571

___
Python tracker 

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



[issue30243] Core dump when use uninitialized _json objects

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 39b73dd5131ce205dcee3b9e24ba0fc28934d79c by Serhiy Storchaka in 
branch '3.6':
[3.6] bpo-30243: Fixed the possibility of a crash in _json. (GH-1420) (#1469)
https://github.com/python/cpython/commit/39b73dd5131ce205dcee3b9e24ba0fc28934d79c


--

___
Python tracker 

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



[issue30269] [2.7] test_release_task_refs() of test_multiprocessing.py is unstable

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

Oh, it's just a missed backport of the last bpo-29861 fix, only 2.7 miss a 
backport.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> multiprocessing Pool keeps objects (tasks, args, results) alive 
too long

___
Python tracker 

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



[issue30243] Core dump when use uninitialized _json objects

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset ee2294860e224c2b08cc6847d3c9a0ec3875c3d8 by Serhiy Storchaka in 
branch '3.5':
[3.5] bpo-30243: Fixed the possibility of a crash in _json. (GH-1420) (#1470)
https://github.com/python/cpython/commit/ee2294860e224c2b08cc6847d3c9a0ec3875c3d8


--

___
Python tracker 

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



[issue29861] multiprocessing Pool keeps objects (tasks, args, results) alive too long

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

> New changeset 685cdb9acc3fca04a9897d88b89771ddfd50e772 by Antoine Pitrou in 
> branch 'master':
> Relax test timing (bpo-29861) to avoid sporadic failures (#1120)

Oh, this change wasn't backported to 2.7 and caused the bpo-30269. I proposed a 
backport: https://github.com/python/cpython/pull/1472 I will merge it once 
tests pass ;-)

--
nosy: +haypo

___
Python tracker 

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



[issue30277] Speeds up compiling cases-insensitive regular expressions

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 7186cc29be352bed6f1110873283d073fd0643e4 by Serhiy Storchaka in 
branch 'master':
bpo-30277: Replace _sre.getlower() with _sre.ascii_tolower() and 
_sre.unicode_tolower(). (#1468)
https://github.com/python/cpython/commit/7186cc29be352bed6f1110873283d073fd0643e4


--

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:


New changeset ef9c0e732fc50aefbdd7c5a80e04e14b31684e66 by Victor Stinner in 
branch 'master':
bpo-30264: ExpatParser closes the source on error (#1451)
https://github.com/python/cpython/commit/ef9c0e732fc50aefbdd7c5a80e04e14b31684e66


--

___
Python tracker 

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



[issue29861] multiprocessing Pool keeps objects (tasks, args, results) alive too long

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:


New changeset fd6094cdebb5736745d164e0207de2d4cb0b50dc by Victor Stinner in 
branch '2.7':
Relax test timing (bpo-29861) to avoid sporadic failures (#1120) (#1472)
https://github.com/python/cpython/commit/fd6094cdebb5736745d164e0207de2d4cb0b50dc


--

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1573

___
Python tracker 

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



[issue30279] Remove unused Python/thread_foobar.h

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

Copy of my answer on the python-dev thread:

You can remove thread_foobar.h. I don't think that anyone still wants
to use this template. The other thread_*.h files can be used as
template as well.

Victor

--
nosy: +haypo

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1574

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1575

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

Oh, the fix for Python 2.7 is different. In fact, the file object was never 
explicitly closed by the parser. It is now always closed by the parser, on 
success or error.

--

___
Python tracker 

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



[issue30279] Remove unused Python/thread_foobar.h

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:


New changeset fdaeea620f8c78da89cddba4ab010c64535800e0 by Victor Stinner 
(Masayuki Yamamoto) in branch 'master':
bpo-30279: Remove unused Python/thread_foobar.h (#1473)
https://github.com/python/cpython/commit/fdaeea620f8c78da89cddba4ab010c64535800e0


--

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 0fe870f3f95ba883b2b06bc0d814bdab8d53df98 by Victor Stinner in 
branch '3.6':
bpo-30264: ExpatParser closes the source on error (#1451) (#1474)
https://github.com/python/cpython/commit/0fe870f3f95ba883b2b06bc0d814bdab8d53df98


--

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 0c9aa6ffd318c04ce23997b4704477d4a4d82829 by Victor Stinner in 
branch '3.5':
bpo-30264: ExpatParser closes the source on error (#1451) (#1475)
https://github.com/python/cpython/commit/0c9aa6ffd318c04ce23997b4704477d4a4d82829


--

___
Python tracker 

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



[issue30279] Remove unused Python/thread_foobar.h

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

I hope that your merged change will now make your work simpler ;-) I don't want 
to backport this change, so I close the issue.

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

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:


New changeset d81f9e24ea89c0aaded1e0d3f8d8076bbd58c19a by Victor Stinner in 
branch '2.7':
bpo-30264: ExpatParser now closes the source (#1476)
https://github.com/python/cpython/commit/d81f9e24ea89c0aaded1e0d3f8d8076bbd58c19a


--

___
Python tracker 

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



[issue29920] Document cgitb.text and cgitb.html

2017-05-05 Thread Berker Peksag

Berker Peksag added the comment:


New changeset c07b3a15be5e0a68a73b4c532861ed8de6932bd2 by Berker Peksag 
(masklinn) in branch 'master':
bpo-29920: Document cgitb.text() and cgitb.html() functions (GH-849)
https://github.com/python/cpython/commit/c07b3a15be5e0a68a73b4c532861ed8de6932bd2


--
nosy: +berker.peksag

___
Python tracker 

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



[issue30276] import hashlib makes many programs slow

2017-05-05 Thread Bernhard M. Wiedemann

Bernhard M. Wiedemann added the comment:

traced it down a bit further.
nearly all that time is spent in
import _hashlib
which probably means, it is spent in functions like PyInit__hashlib in 
Modules/_hashopenssl.c

I can see in strace that after loading libssl, libcrypto and libz,
it calls getpid and opens /dev/urandom 8 times
and most of the time is spent in the middle of these:

grep open...dev.uran strace.out
1493970277.542629 open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 4
1493970277.542847 open("/dev/urandom", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_CLOEXEC) 
= 4
1493970277.543370 open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 4
1493970277.543967 open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 4
1493970277.592232 open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 4
1493970277.592518 open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 4
1493970277.597778 open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 4
1493970277.598629 open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 4

--

___
Python tracker 

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



[issue30258] [2.7] regrtest: handle child process crash

2017-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1576

___
Python tracker 

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



[issue30243] Core dump when use uninitialized _json objects

2017-05-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue30243] Core dump when use uninitialized _json objects

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 5d7a18f3b65bd958d876391cca3c381396021639 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-30243: Fixed the possibility of a crash in _json. (GH-1420) (#1471)
https://github.com/python/cpython/commit/5d7a18f3b65bd958d876391cca3c381396021639


--

___
Python tracker 

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



[issue30255] test_xml_etree: python: Objects/sliceobject.c:176: _PySlice_AdjustIndices: Assertion `step >= -PY_SSIZE_T_MAX' failed.

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

> The change announces "... clip the step to [-PY_SSIZE_T_MAX, PY_SSIZE_T_MAX] 
> ...", but there is no explicit to clip the maximum to PY_SSIZE_T_MAX. Maybe 
> there is a bug on this side too! The code should be reviewed one more time.

Ok, I checked: _PySlice_Unpack() uses _PyEval_SliceIndex() to convert the step 
Python object into a C Py_ssize_t, so the code is already correct: it does 
"clip the step to [-PY_SSIZE_T_MAX, PY_SSIZE_T_MAX]" as announced ;-) I close 
the issue.

Thanks Serhiy for your work on fixing corner cases related to slices ;-)

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

___
Python tracker 

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



[issue30265] [2.7] test.support.unlink() should fail or emit a warning on WindowsError: [Error 32] The process cannot access the file ...

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 03b278895fa0db355af4e450eac71dd0532db394 by Victor Stinner in 
branch '2.7':
bpo-30265: support.unlink() don't catch any OSError (#1456)
https://github.com/python/cpython/commit/03b278895fa0db355af4e450eac71dd0532db394


--

___
Python tracker 

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



[issue30258] [2.7] regrtest: handle child process crash

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 228da42961ac9bf2990e6c191ecc9b762ead617c by Victor Stinner in 
branch '2.7':
bpo-30258: Fix handling of child error in regrtest (#1477)
https://github.com/python/cpython/commit/228da42961ac9bf2990e6c191ecc9b762ead617c


--

___
Python tracker 

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



[issue30265] [2.7] test.support.unlink() should fail or emit a warning on WindowsError: [Error 32] The process cannot access the file ...

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

Ok, fixed.

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

___
Python tracker 

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



[issue30258] [2.7] regrtest: handle child process crash

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

@Serhiy: I fixed the bug you found. Don't hesitate to propose directly a PR if 
I missed something (or open an issue, it's up to you).

At least, regrtest of Python 2.7 should now handle correctly crashes when using 
-jN.

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

___
Python tracker 

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



[issue30257] _bsddb: else misleadingly indented

2017-05-05 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

I applied my fix to 2.7, 3.5, 3.6 and master (3.7). Thanks for the helpful 
reviews Serhiy ;-)

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



[issue30095] HTMLCalendar allow custom classes

2017-05-05 Thread Walter Dörwald

Walter Dörwald added the comment:

See comments on Github

--

___
Python tracker 

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



[issue30280] Warning -- threading._dangling was modified by test_asyncio on FreeBSD 9

2017-05-05 Thread STINNER Victor

New submission from STINNER Victor:

On the FreeBSD 9 buildbot, I saw this warning:

Warning -- threading._dangling was modified by test_asyncio

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.x%203.6/builds/124/steps/test/logs/warnings%20%281%29

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.x%203.5/builds/78/steps/test/logs/warnings%20%281%29

--
components: Tests, asyncio
messages: 293082
nosy: haypo, yselivanov
priority: normal
severity: normal
status: open
title: Warning -- threading._dangling was modified by test_asyncio on FreeBSD 9
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



[issue19903] Idle: Use inspect.signature for calltips

2017-05-05 Thread Terry J. Reedy

Terry J. Reedy added the comment:

What is List?  Not a builtin.

I am guessing that $self means to remove for bound methods.  In any case, 
__text_signature__ is effectively private to inspect.signature.  We only care 
what the latter produces.

--

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This changes the behavior if pass a file object to the parser. When the parser 
failed it was possible to use the passed file object (for example call tell()). 
Now it is closed.

--

___
Python tracker 

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



[issue30258] [2.7] regrtest: handle child process crash

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

You just pressed the merge button 2 minutes before I finished a review.

--

___
Python tracker 

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



[issue30258] [2.7] regrtest: handle child process crash

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Do you mind to port changes to 3.x?

--

___
Python tracker 

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



[issue30276] import hashlib makes many programs slow

2017-05-05 Thread Christian Heimes

Christian Heimes added the comment:

I cannot reproduce the open /dev/urandom calls locally. You seem to be running 
an old Python version and/or old Kernel. Python prefers getrandom() over 
/dev/urandom. The urandom code caches the fd for /dev/urandom.

$ strace ./python -c 'import hashlib' 2>&1 | grep random
getrandom("\xe0\xa5\x00\xda\xe1\xce\x1a\x9c\xe7\x61\x71\xf2\x1d\x15\x63\x19\xdc\x60\x70\x3c\xef\xf6\xcb\xdb",
 24, GRND_NONBLOCK) = 24
open("/dev/urandom", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 3

The O_RDONLY|O_NOCTTY|O_NONBLOCK|O_CLOEXEC comes from OpenSSL.

What's your Python version, OpenSSL version, Kernel version and which 
platform/distribution are you on?

--
nosy: +haypo

___
Python tracker 

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



[issue29243] --enable-optimizations makes common build commands always need to compile from scratch

2017-05-05 Thread Tomas Orsava

Changes by Tomas Orsava :


--
pull_requests: +1577

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

> This changes the behavior if pass a file object to the parser. When the 
> parser failed it was possible to use the passed file object (for example call 
> tell()). Now it is closed.

If the high-level *function* parse() is called with a filename, the caller 
doesn't have access to the file object nor the parser.

If you use directly the parser class and pass an open file object, in that 
case, yes, my change closes the file.

If you want to keep the old behaviour for that case, we can change the code to 
only close the source if source is not a string (not isinstance(source, str)) 
in the ExpatParser.parse() method. Since the caller owns the file object, (s)he 
is responsible to close it.

Note: on parser success, the source is always closed, even if the user pass an 
already open file object.

I'm not convince that using the file object on parser error and using directly 
the ExpatParser class is a common use case. I expect that the XML parser reads 
more data than it needs (read ahead for speed), so I don't think that 
file.tell() will you exactly the file position where the XML parser failed.

--

___
Python tracker 

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



[issue30258] [2.7] regrtest: handle child process crash

2017-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1578

___
Python tracker 

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



[issue30258] [2.7] regrtest: handle child process crash

2017-05-05 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue30258] [2.7] regrtest: handle child process crash

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

> You just pressed the merge button 2 minutes before I finished a review.

Oh sorry, I didn't expect a review on this small change.

> Do you mind to port changes to 3.x?

I created https://github.com/python/cpython/pull/1479 for the 
run_tests_multiprocess() bugfix.

--

___
Python tracker 

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



[issue30276] import hashlib makes many programs slow

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

What is your Python version? It looks like an old version.

--

___
Python tracker 

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



[issue30276] import hashlib makes many programs slow

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

What is your OS? Which kind of computer is it? I'm surprised that you noticed 
open calls on /dev/urandom, it should be very quick, no?

--

___
Python tracker 

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



[issue30276] import hashlib makes many programs slow

2017-05-05 Thread Christian Heimes

Christian Heimes added the comment:

I rather suspect it's OpenSSL. It takes a bit to load and initialize 
libcrypto.so. On my system it takes about 17ms to import _hashlib. There is 
nothing we can do about it in CPython.

--

___
Python tracker 

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



[issue23404] 'make touch' does not work with git clones of the source repository

2017-05-05 Thread Nick Coghlan

Nick Coghlan added the comment:

As noted on python-dev, it would be helpful if this change was mentioned in the 
2.7, 3.5, and 3.6 What's New documents under a "Notable changes in maintenance 
releases" section.

For 2.7, that would be a retitling of the existing section "New features added 
to Python 2.7 maintenance releases": 
https://docs.python.org/dev/whatsnew/2.7.html#new-features-added-to-python-2-7-maintenance-releases

For 3.5 and 3.6, this would be a new entry at the end of the document, with 
"Change to handling of pre-generated files" as the sole subsection.

(As another example of an existing section along these lines, see 
https://docs.python.org/dev/whatsnew/3.4.html#changed-in-3-4-3)

--

___
Python tracker 

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



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

2017-05-05 Thread Matteo Bertini

Matteo Bertini added the comment:

Bumped in this bug yesterday, sadly a script working (by chance) in Python2 
doesn't work in Python3 because of this bug.

--
nosy: +naufraghi

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> If you use directly the parser class and pass an open file object, in that 
> case, yes, my change closes the file.

Or if the high-level *function* parse() is called with an open file object.

I don't know whether this is desirable change, but this change can break 
third-party code, therefore it should be documented in Misc/NEWS.

And it is worth to add a check in test_parse_bytes that the passed file object 
is closed after error.

--

___
Python tracker 

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



[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-05 Thread Xiang Zhang

New submission from Xiang Zhang:

The default value for stop in PySlice_Unpack should be -PY_SSIZE_T_MAX-1. 
Otherwise a sequence of length PY_SSIZE_T_MAX could get a wrong slicelength 
when doing L[::-1].

--
components: Interpreter Core
messages: 293097
nosy: serhiy.storchaka, xiang.zhang
priority: normal
severity: normal
stage: patch review
status: open
title: set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack
type: behavior
versions: Python 2.7, 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



[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-05 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +1579

___
Python tracker 

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



[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'm not sure that -PY_SSIZE_T_MAX-1 always is representable. I would use 
PY_SSIZE_T_MIN and add a static assert (Py_BUILD_ASSERT) that PY_SSIZE_T_MIN + 
1 <= -PY_SSIZE_T_MAX. Actually currently PY_SSIZE_T_MIN is -PY_SSIZE_T_MAX-1 by 
definition, but this can be changed in future.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue29243] --enable-optimizations makes common build commands always need to compile from scratch

2017-05-05 Thread Tomas Orsava

Tomas Orsava added the comment:

I've opened a PR#1478 that I believe fixes the issue.

--
nosy: +torsava

___
Python tracker 

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



[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

Hum, integer overflows are complex issues. It deserves an unit test, maybe even 
in C written in _testcapi?

--
nosy: +haypo

___
Python tracker 

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



[issue30276] import hashlib makes many programs slow

2017-05-05 Thread Bernhard M. Wiedemann

Bernhard M. Wiedemann added the comment:

I'm running openSUSE Tumbleweed with python-2.7.13 and python3-3.6.1
on an Intel Pentium N3530 with linux-4.10.12
There the total time of the "import _hashlib" oneliner varies between 100 and 
250 ms (python3 is a bit slower and the machine is slower when running on 
battery)

the urandom calls themselves are not slow, but probably the processing in 
between. Can't that be done on demand on first use?

This is (one minor part of) slowing down python CLI tools like OpenStack's
cinder help

--

___
Python tracker 

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



[issue30276] import hashlib makes many programs slow

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

> the urandom calls themselves are not slow, but probably the processing in 
> between. Can't that be done on demand on first use?

If the time is spent on loading OpenSSL, maybe you should try to
import hashlib on demand?

--

___
Python tracker 

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



[issue30262] Don't expose sqlite3 Cache and Statement

2017-05-05 Thread R. David Murray

R. David Murray added the comment:

If these objects have been exposed in the past, we won't simply delete them.  
At a minimum there would need to be a deprecation period, but is there a real 
motivation for deleting them?

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



[issue30262] Don't expose sqlite3 Cache and Statement

2017-05-05 Thread R. David Murray

R. David Murray added the comment:

Sorry, by "real motivation" I meant something beyond just cleaning up the 
API...that's a real motivation, it may just not be enough.

--

___
Python tracker 

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



[issue30268] Make mimetypes.guess_type accept path-like objects

2017-05-05 Thread R. David Murray

R. David Murray added the comment:

Why do you think this is a bug?

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



[issue30268] Make mimetypes.guess_type accept path-like objects

2017-05-05 Thread R. David Murray

R. David Murray added the comment:

To clarify my question, I don't think it is a bug, but the fact that you do 
might mean there needs to be a doc clarification.  Or it might not.  Or, there 
might be a desirable enhancement here, maybe relating to the pathlike protocol.

--

___
Python tracker 

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



[issue30268] Make mimetypes.guess_type accept path-like objects

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There were issues with mimetypes.guess_type() on Windows in Python 2 (issue9291 
and a number of duplicate issues). I afraid that adding support of bytes paths 
will return the hell from which we ran in Python 3.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue30262] Don't expose sqlite3 Cache and Statement

2017-05-05 Thread Berker Peksag

Berker Peksag added the comment:

Even if users somehow managed to create Cache and Statement objects themselves, 
they are basically implementation details of the module and there is no way to 
use them to mess with the internal state of the module via using the current 
API (e.g. Cursor.statement is not exposed)

--
stage:  -> patch review

___
Python tracker 

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



[issue24932] Use proper command line parsing in _testembed

2017-05-05 Thread Charalampos Stratakis

Charalampos Stratakis added the comment:

Downstream backporting of PEP 538 to the 3.6 branch also depends on this fix.

Would it be beneficial in any way to cherry-pick it for 3.6?

--
nosy: +cstratak

___
Python tracker 

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



[issue30282] object returned by tarfile.extractfile has an incorrect value of name attribute

2017-05-05 Thread Ondrej Kubecka

New submission from Ondrej Kubecka:

Consider the following code snippet:


import tarfile

tar1 = tarfile.open('tar1.tar.gz')
file_ = tar1.extractfile('FILE')
print(file_.name)


Up until 3.2.x, the value of name attribute would be 'FILE' as derived from 
tarinfo of the member. Starting with 3.3 (commits: b062a2fa 7a919e99) this 
value be obtained from tarfile.fileobj ("parent" tarball file) and would return 
'tar1.tar.gz' instead.

This does not seem to be correct as it's not a filename of the ExFileObject / 
_FileInFile / io.BufferedReader object itself which would otherwise be 
consistent with values normally found under name.

There is also a problem that this information no longer appears to be 
accessible at all looking at the object returned from extractfile alone.

And looking at release notes of 3.3, this does not seem to be intentional 
effect.

--
components: Library (Lib)
messages: 293111
nosy: Ondrej Kubecka
priority: normal
severity: normal
status: open
title: object returned by tarfile.extractfile has an incorrect value of name 
attribute
type: behavior
versions: 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



[issue29243] --enable-optimizations makes common build commands always need to compile from scratch

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:


New changeset a1054c3b0037d4c2a5492e79fc193f36245366c7 by Victor Stinner 
(torsava) in branch 'master':
bpo-29243: Fix Makefile with respect to --enable-optimizations (#1478)
https://github.com/python/cpython/commit/a1054c3b0037d4c2a5492e79fc193f36245366c7


--
nosy: +haypo

___
Python tracker 

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



[issue29243] --enable-optimizations makes common build commands always need to compile from scratch

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

I closed my issue #29641 as a duplicate of this one.

--

___
Python tracker 

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



[issue30276] import hashlib makes many programs slow

2017-05-05 Thread Bernhard M. Wiedemann

Bernhard M. Wiedemann added the comment:

This might work in some places, but if you look at real-world users like
urllib3/util/ssl_.py
> from hashlib import md5, sha1, sha256

or
twisted/words/protocols/jabber/xmlstream.py
> from hashlib import sha1

It would probably not need any openssl at all, but still gets the full penalty 
time from the import.
So you get all or nothing.
It would be nice to just get access to those few hashes you need for your 
protocal (because you certainly do not want to reimplement it).

--

___
Python tracker 

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



[issue30268] Make mimetypes.guess_type accept path-like objects

2017-05-05 Thread ProgVal

ProgVal added the comment:

@r.david.murray I don't think it's a bug either, but a possible enhancement.

@serhiy.storchaka We could simply do this: if isinstance(url, bytes):  url = 
os.fsdecode(url)

--

___
Python tracker 

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



[issue30276] import hashlib makes many programs slow

2017-05-05 Thread Christian Heimes

Christian Heimes added the comment:

If import of hashlib is slowed down by OpenSSL, then import of ssl module will 
be even slower.

Am 5. Mai 2017 17:57:41 MESZ schrieb "Bernhard M. Wiedemann" 
:
>
>Bernhard M. Wiedemann added the comment:
>
>This might work in some places, but if you look at real-world users
>like
>urllib3/util/ssl_.py
>> from hashlib import md5, sha1, sha256
>
>or
>twisted/words/protocols/jabber/xmlstream.py
>> from hashlib import sha1
>
>It would probably not need any openssl at all, but still gets the full
>penalty time from the import.
>So you get all or nothing.
>It would be nice to just get access to those few hashes you need for
>your protocal (because you certainly do not want to reimplement it).
>
>--
>
>___
>Python tracker 
>
>___

--

___
Python tracker 

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



[issue30281] set stop default to -PY_SSIZE_T_MAX-1 in PySlice_Unpack

2017-05-05 Thread Xiang Zhang

Xiang Zhang added the comment:

I am okay to use PY_SSIZE_T_MIN. But if we are worried about future change of 
PY_SSIZE_T_MIN, seems we also need to change the API doc of PySlice_Unpack(). 
Although _PyEval_SliceIndex's comment says it clips value to -PY_SSIZE_T_MAX-1, 
actually it uses PyNumber_AsSize_t and clips value to PY_SSIZE_T_MIN.

--

___
Python tracker 

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



[issue30192] hashlib module breaks with 64-bit kernel and 32-bit user space

2017-05-05 Thread Neil Schemenauer

Neil Schemenauer added the comment:

It should be backported in my opinion.

--

___
Python tracker 

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



[issue30223] Add Lib/test/__main__.py in 2.7

2017-05-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Victor for fixing this bug.

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

___
Python tracker 

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



[issue30283] [2.7] Backport test_regrtest (partially) on Python 2.7

2017-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
assignee:  -> haypo

___
Python tracker 

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



[issue30283] [2.7] Backport test_regrtest (partially) on Python 2.7

2017-05-05 Thread STINNER Victor

New submission from STINNER Victor:

I would like to continue to backport enhancements of regrtest from master to 
2.7. In master, regrtest has so many super useful features!

This week, Serhiy and me backported some basic features, but we introduced 
regressions. I now would like to backport test_regrtest to reduce risk of 
breaking things (like buildbots and the Python CI).

--
components: Tests
messages: 293120
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [2.7] Backport test_regrtest (partially) on Python 2.7
versions: Python 2.7

___
Python tracker 

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



[issue30284] Build CPython out of tree with a read-only source tree

2017-05-05 Thread STINNER Victor

New submission from STINNER Victor:

I tried to build CPython out of the source tree with a customized read-only 
source tree (chmod -R -w). I got an error when running tests: tests want to 
write into a build/ directory... in the source tree.

Attached patch fixes this issue.

--
components: Build
messages: 293121
nosy: haypo
priority: normal
severity: normal
status: open
title: Build CPython out of tree with a read-only source tree
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



[issue30284] Build CPython out of tree with a read-only source tree

2017-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +cstratak

___
Python tracker 

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



[issue30274] Make importlib.abc.ExtensionFileLoader.__init__() documentation match code

2017-05-05 Thread Brett Cannon

Brett Cannon added the comment:

Another option is to rename 'name' to 'fullname', make 'name' keyword-only, and 
then raise a DeprecationWarning if 'name' is used, eventually removing the 
keyword-only argument.

--

___
Python tracker 

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



[issue30284] Build CPython out of tree with a read-only source tree

2017-05-05 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1581

___
Python tracker 

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



[issue30192] hashlib module breaks with 64-bit kernel and 32-bit user space

2017-05-05 Thread Berker Peksag

Changes by Berker Peksag :


--
stage: patch review -> backport needed

___
Python tracker 

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



[issue30276] import hashlib makes many programs slow

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

I ran a quick benchmark on my laptop, Fedora 25:

haypo@selma$ python3 -m perf command -o ref.json -- python3 -c 'pass' && 
python3 -m perf command -o hashlib.json -- python3 -c 'import hashlib' && 
python3 -m perf compare_to ref.json hashlib.json  --table

+---+-+--+
| Benchmark | ref | hashlib  |
+===+=+==+
| command   | 26.7 ms | 30.2 ms: 1.13x slower (+13%) |
+---+-+--+

Importing hashlib only takes 3.5 ms on my laptop.

--

___
Python tracker 

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



[issue30270] Remove sqlite3.Cache display method

2017-05-05 Thread Brett Cannon

Brett Cannon added the comment:

With over 10 years of existence for that method, I can guarantee you someone 
relies on it, and so we should do a reasonable job to avoid breaking them 
without at least some warning first.

--

___
Python tracker 

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



[issue30284] Build CPython out of tree with a read-only source tree

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

Ah, there is one and only one failing test:

==
ERROR: test_synopsis_sourceless (test.test_pydoc.PydocDocTest)
--
Traceback (most recent call last):
  File "/home/haypo/prog/python/ro.master/Lib/test/test_pydoc.py", line 586, in 
test_synopsis_sourceless
synopsis = pydoc.synopsis(filename)
  File "/home/haypo/prog/python/ro.master/Lib/pydoc.py", line 253, in synopsis
mtime = os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: 
'/home/haypo/prog/python/ro.master/Lib/__pycache__/os.cpython-37.pyc'

--

___
Python tracker 

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



[issue30284] Build CPython out of tree with a read-only source tree

2017-05-05 Thread STINNER Victor

STINNER Victor added the comment:

test_synopsis_sourceless() should create a script, build it and test the 
generated .pyc file. So we control how the .pyc file is created.

--

___
Python tracker 

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



[issue30285] Optimize case-insensitive regular expressions

2017-05-05 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Matching and searching case-insensitive regular expressions is much slower than 
matching and searching case-sensitive regular expressions. Case-insensitivity 
requires converting every character in input string to lower case and disables 
some optimizations. But there are only 2669 cased characters (52 in ASCII 
mode). For all other characters in the pattern we can use case-sensitive 
matching.

Results of microbenchmarks:

$ ./python -m timeit -s "import re; p = re.compile(r'(?ai) +x'); s = ' 
'*1+'x'"  "p.match(s)"
Unpatched:  5000 loops, best of 5: 47.1 usec per loop
Patched:2 loops, best of 5: 17.6 usec per loop

$ ./python -m timeit -s "import re; p = re.compile(r'(?i) +x'); s = ' 
'*1+'x'"  "p.match(s)"
Unpatched:  2000 loops, best of 5: 109 usec per loop
Patched:2 loops, best of 5: 17.6 usec per loop

$ ./python -m timeit -s "import re; p = re.compile(r'(?ai)[ \t]+x'); s = ' 
'*1+'x'"  "p.match(s)"
Unpatched:  500 loops, best of 5: 537 usec per loop
Patched:5000 loops, best of 5: 84.2 usec per loop

$ ./python -m timeit -s "import re; p = re.compile(r'(?i)[ \t]+x'); s = ' 
'*1+'x'"  "p.match(s)"
Unpatched:  500 loops, best of 5: 608 usec per loop
Patched:5000 loops, best of 5: 84.1 usec per loop

$ ./python -m timeit -s "import re; p = re.compile(r'(?ai)/x'); s = ' 
'*1+'/x'"  "p.search(s)"
Unpatched:  1000 loops, best of 5: 226 usec per loop
Patched:2 loops, best of 5: 13.4 usec per loop

$ ./python -m timeit -s "import re; p = re.compile(r'(?i)/x'); s = ' 
'*1+'/x'"  "p.search(s)"
Unpatched:  1000 loops, best of 5: 284 usec per loop
Patched:2 loops, best of 5: 13.4 usec per loop

$ ./python -m timeit -s "import re; p = re.compile(r'(?ai)[/%]x'); s = ' 
'*1+'/x'"  "p.search(s)"
Unpatched:  500 loops, best of 5: 483 usec per loop
Patched:1000 loops, best of 5: 279 usec per loop

$ ./python -m timeit -s "import re; p = re.compile(r'(?i)[/%]x'); s = ' 
'*1+'/x'"  "p.search(s)"
Unpatched:  500 loops, best of 5: 549 usec per loop
Patched:1000 loops, best of 5: 279 usec per loop

The patch also optimizes searching some complex case-sensitive patterns. This 
is a side effect, I'll provide more comprehensive optimization in other issue.

$ ./python -m timeit -s "import re; p = re.compile(r'([xy])'); s = ' 
'*1+'x'"  "p.search(s)"
Unpatched:  500 loops, best of 5: 633 usec per loop
Patched:1000 loops, best of 5: 250 usec per loop

$ ./python -m timeit -s "import re; p = re.compile(r'((x|y)z)'); s = ' 
'*1+'xz'"  "p.search(s)"
Unpatched:  500 loops, best of 5: 716 usec per loop
Patched:1000 loops, best of 5: 250 usec per loop

--
assignee: serhiy.storchaka
components: Library (Lib), Regular Expressions
messages: 293127
nosy: ezio.melotti, mrabarnett, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Optimize case-insensitive regular expressions
type: performance
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



[issue30262] Don't expose sqlite3 Cache and Statement

2017-05-05 Thread R. David Murray

R. David Murray added the comment:

That's the same motivation, not a new one :)  Someone somewhere may be using 
them for something, they've been around for a long time.  I hope not, though.

--

___
Python tracker 

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



  1   2   >