[issue31671] IntFlag makes re.compile slower

2017-10-04 Thread Ethan Furman

Ethan Furman  added the comment:

INADA Naoki said:
> But while new instance is not created each time, 4 Python method
> calls (e,g.  IntFlag.__and__() -> IntFlag.__new__()
> -> IntFlag._missing_() -> IntFlag._create_pseudo_member_())
> are much slower than int & int.

Only the first two calls always happen -- the last two calls only happen for 
numbers that haven't been seen yet.  And yes, two Python level calls are much 
slower than an int & int.

--

___
Python tracker 

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



[issue31698] Add REQ_NAME to the node.h API

2017-10-04 Thread Jelle Zijlstra

New submission from Jelle Zijlstra :

See https://github.com/python/cpython/pull/1669#pullrequestreview-67229284

--
assignee: Jelle Zijlstra
components: Interpreter Core
messages: 303739
nosy: Jelle Zijlstra, yselivanov
priority: low
severity: normal
status: open
title: Add REQ_NAME to the node.h API
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



[issue31689] random.choices does not work with negative weights

2017-10-04 Thread Raymond Hettinger

Change by Raymond Hettinger :


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



[issue31689] random.choices does not work with negative weights

2017-10-04 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I'm content with the current exception.

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue31693] Document Py_GETENV

2017-10-04 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


--
keywords: +patch
pull_requests: +3864
stage:  -> patch review

___
Python tracker 

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



[issue31671] IntFlag makes re.compile slower

2017-10-04 Thread STINNER Victor

STINNER Victor  added the comment:

The perf module always starts with a "warmup" run to fill caches. If enum
has a cache, it should be filled automatically.

--

___
Python tracker 

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



[issue31634] Consider installing wheel in ensurepip by default

2017-10-04 Thread Donald Stufft

Donald Stufft  added the comment:

> * the current install time bundling of setuptools in `ensurepip` is likely to 
> be replaced by `pip` dynamically installing both `setuptools` & `wheel` when 
> asked to build from a source archive when no other build system has been 
> specified. With PEP 517 approved, it's entirely plausible that this will 
> happen as part of the `pip 10.0.0` release. So we *won't* be bundling wheel 
> as part of ensurepip, since doing so would conflict with the plan to unbundle 
> setuptools.

Actually PEP 518 provides the mechanism we need for this, and it's already 
implemented in pip's master branch (what will become pip 10). I don't remember 
off the top of my head if that covers 100% of the cases yet, but if it doesn't 
that's just a SMOP. It's entirely plausible that Python 3.7 ships without 
setuptools included in ensurepip.

--

___
Python tracker 

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



[issue31634] Consider installing wheel in ensurepip by default

2017-10-04 Thread Nick Coghlan

Nick Coghlan  added the comment:

As a shorter version of the above:

* the current install time bundling of setuptools in `ensurepip` is likely to 
be replaced by `pip` dynamically installing both `setuptools` & `wheel` when 
asked to build from a source archive when no other build system has been 
specified. With PEP 517 approved, it's entirely plausible that this will happen 
as part of the `pip 10.0.0` release. So we *won't* be bundling wheel as part of 
ensurepip, since doing so would conflict with the plan to unbundle setuptools.

* however, we *may* still end up bundling wheel with CPython at some point, 
*if* we decide to eliminate Lib/distutils entirely in favour of bundling 
setuptools & wheel.

So it isn't that bundling wheel is entirely out of the question - it's just not 
something we want to do as part of ensure*pip* specifically.

--

___
Python tracker 

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



[issue31634] Consider installing wheel in ensurepip by default

2017-10-04 Thread Nick Coghlan

Nick Coghlan  added the comment:

Of the listed benefits, I think the most interesting one is the fact it would 
enable pip's wheel cache by default for all installations, rather than relying 
on projects publishing pre-built wheel files to PyPI.

However, actually doing this would run counter to the design goal of declaring 
even the current installation of setuptools to be an implementation details 
that shouldn't be relied on: 
https://www.python.org/dev/peps/pep-0453/#automatic-installation-of-setuptools

This relates to the fact that in PyPA, we're aiming to reach a point where we 
treat setuptools & wheel as *optional* dependencies of pip, such that it's 
straightforward to create environments that only support installation of wheel 
files created elsewhere, and don't allow installations directly from source 
archives at all.

The recently approved PEP 517 represented a notable step in that direction.

That said, we're also discussing the possibility of changing the way we provide 
distutils to be dependent on automatic installation of setuptools [1], and if 
we *did* decide to go down that path, then I think it would be appropriate to 
consider installing both setuptools *and* wheel as part of an 
"ensuresetuptools" module, rather than just installing setuptools.

Accordingly, while I *am* going to close this (and the related PR), I'm going 
to close it as "postponed" rather than "rejected" - it isn't that we're 
definitely never going to do this, it's that there are other long term design 
considerations involved, and doing this prematurely has the potential to lock 
us out of design paths that we'd like to keep open.

[1] https://mail.python.org/pipermail/distutils-sig/2017-September/031540.html

--
resolution:  -> postponed
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



[issue31697] Regression in futures.as_completed with ProcessPoolExecutor.

2017-10-04 Thread coady

New submission from coady :

`futures.as_completed` is not generating process-based futures in completed 
order.  Reproduces with 3.7a0.

--
files: test.py
messages: 303733
nosy: coady
priority: normal
severity: normal
status: open
title: Regression in futures.as_completed with ProcessPoolExecutor.
versions: Python 3.7
Added file: https://bugs.python.org/file47193/test.py

___
Python tracker 

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



[issue31671] IntFlag makes re.compile slower

2017-10-04 Thread INADA Naoki

INADA Naoki  added the comment:

> IntFlag.__and__ does not create a new instance every time -- all new 
> instances are cached in the IntFlag machinery (so RegexFlag(7) is only 
> created once).

I'm sorry, I misunderstood.
But while new instance is not created each time, 4 Python method calls
(e,g.  IntFlag.__and__() -> IntFlag.__new__() -> IntFlag._missing_() -> 
IntFlag._create_pseudo_member_()) are much slower than int & int.

> If all the RegexFlag combinations are created before the regex compile 
> benchmark do we still see a speed-up?

I believe that's what Victor benchmarked.

--

___
Python tracker 

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



[issue30767] logging must check exc_info correctly

2017-10-04 Thread Matthew Patton

Change by Matthew Patton :


--
keywords: +patch
pull_requests: +3863
stage:  -> patch review

___
Python tracker 

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



[issue31696] don't mention GCC in sys.version when built with Clang

2017-10-04 Thread Benjamin Peterson

New submission from Benjamin Peterson :

When built with clang, Python reports that it was built with something like 
"GCC 4.2.1 Compatible Clang 4.0.0 (tags/RELEASE_400/rc1)". This is because 
clang pretends to be GCC 4.2.1 for the purposes of the __VERSION__ preprocessor 
macro. We should use __clang_version__ when clang is being used.

(Possibly we should simply use the first line of "$CC --version" as the 
compiler version of record rather than writing preprocessor tests in 
getcompiler.c.)

--
components: Build
keywords: easy (C)
messages: 303731
nosy: benjamin.peterson
priority: normal
severity: normal
status: open
title: don't mention GCC in sys.version when built with Clang
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



[issue30872] Update curses docs to Python 3

2017-10-04 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +3862

___
Python tracker 

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



[issue30872] Update curses docs to Python 3

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 300dd552b15825abfe0e367ac14cec4c3e050dbc by Serhiy Storchaka in 
branch 'master':
bpo-30872: Update the curses docs to Python 3. (#2620)
https://github.com/python/cpython/commit/300dd552b15825abfe0e367ac14cec4c3e050dbc


--

___
Python tracker 

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



[issue31695] Improve bigmem tests

2017-10-04 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

I think that the process of running bigmem tests should be improved.

1. Every bigmem test should run in separate process. It's effect on memory 
fragmentation shouldn't affect other tests.

2. Only one bigmem test should be run at the same time. Otherwise several 
parallel bigmem tests  can exhaust RAM and lead to swapping. In multiprocessing 
mode the process running a bigmem test should send a signal to other processes, 
wait until they finished their current tests and paused, run a bigmem test, and 
send a signal to other processes that they can continue.

3. The hard limit of addressed memory should be set for every bigmem test, 
according to the declared requirements. It is better to crash one test and 
report the failure, than hang on swapping.

4. All other tests should be run with the limit set to 2 GiB (or 1 GiB?). This 
will help to find memory consuming tests which should be made bigmem tests.

5. The maxrss of the process running a bigmem test should be reported in 
verbose mode after finishing a test.

--
components: Tests
messages: 303729
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Improve bigmem tests
type: enhancement

___
Python tracker 

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



[issue31684] Scientific formatting of decimal 0 different from float 0

2017-10-04 Thread Stefan Krah

Stefan Krah  added the comment:

> I'm also assuming that Decimal(0) sets both base and exponent to 0.

No, 0 is really special in the IBM specification. The magnitude is
kept, the precision is not.

>>> Decimal("0e10") * Decimal("0e20") 
Decimal('0E+30')


>>> Decimal("0.000e10")
Decimal('0E+7')

So we're basically doing the reverse of the above in formatting when a
precision is given.

--

___
Python tracker 

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



[issue31675] Tkinter: memory leak in splitlines() and split()

2017-10-04 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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



[issue31694] Running Windows installer with LauncherOnly=1 should not register the version as installed

2017-10-04 Thread Zachary Ware

Change by Zachary Ware :


--
assignee:  -> steve.dower
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue31694] Running Windows installer with LauncherOnly=1 should not register the version as installed

2017-10-04 Thread Tzu-ping Chung

New submission from Tzu-ping Chung :

After running

python-3.6.2-amd64.exe /quiet LauncherOnly=1

Python 3.6.2 is registered as installed, even though nothing is actually 
installed.

Running the installer again at this point shows an error indicating “this 
product is already installed”, and does not show me the usual 
repair/modify/uninstall options.

I have to run uninstallation with Control Panel before the installer works 
again.

--
components: Installation
messages: 303727
nosy: uranusjr
priority: normal
severity: normal
status: open
title: Running Windows installer with LauncherOnly=1 should not register the 
version as installed
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



[issue31675] Tkinter: memory leak in splitlines() and split()

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 328b5d0e64798cf17360c6b2a07c2b18f2798b88 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-31675: Fix memory leaks in Tkinter's methods splitlist() and split() 
(GH-3866) (#3876)
https://github.com/python/cpython/commit/328b5d0e64798cf17360c6b2a07c2b18f2798b88


--

___
Python tracker 

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



[issue31684] Scientific formatting of decimal 0 different from float 0

2017-10-04 Thread Aaron Meurer

Aaron Meurer  added the comment:

I meant that format() destroys information in a decimal in general. Obviously 
if you have n digits of precision and format with m < n, then you lose 
information. 

I also can't help but feel that we're mixing up "trailing zeros" (i.e., 
precision), and "exponent" (magnitude), which should be orthogonal. I'm 
assuming that a decimal is represented internally as base*10**exponent. I'm 
also assuming that Decimal(0) sets both base and exponent to 0. It doesn't make 
sense to me that a string formatting operation that requests a certain number 
of digits of precision should change the exponent. 

I get that 0.0 is different from 0.0, but in that case, they should print 
differently: as '0.0' and '0.0'. It seems sly to try to maintain that 
through a format operation via the exponent, especially when format *in 
general* loses precision information for a decimal anyway (by "format" I mean 
format with a set number of digits requested). Especially since that "trick" 
only works for exactly one number, zero. If you do 
'{:+.30e}'.format(Decimal('1.000')) or 
'{:+.10e}'.format(Decimal('1.000')), no such trick is used, 
because no such trick can be used. You just lose information. 

I'm sure my mental model is off here. I'm used to sympy.Float/mpmath.mpf where 
values like 0*2**i are normalized to i = 0 (e.g. mpmath.mpf((0, 0, 20, 
0))._mpf_ gives (0, 0, 0, 0)), so this problem never comes up in the code that 
I'm used to.

--

___
Python tracker 

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



[issue31657] unit test for optimization levels does not cover __debug__ case

2017-10-04 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

Thanks for this enhancement, Diana.

Since PR has been merged, and backport is not needed, I think this can be 
closed now. :)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue31684] Scientific formatting of decimal 0 different from float 0

2017-10-04 Thread Stefan Krah

Stefan Krah  added the comment:

I don't think format() destroys the information:

>>> '{:+.19e}'.format(Decimal("0.0e20"))
'+0.000e+34'


The original magnitude was e+15, after formatting it's still e+15.

--

___
Python tracker 

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



[issue31667] Wrong links in the gettext.NullTranslations class

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset ed77fbffa5bf81c8d16700370fe8bb63bbae1428 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
[3.6] bpo-31667: Fix gettext related links. (GH-3860) (#3886)
https://github.com/python/cpython/commit/ed77fbffa5bf81c8d16700370fe8bb63bbae1428


--

___
Python tracker 

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



[issue31688] scope error

2017-10-04 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Abdullah, in the future, please upload or post runnable Python code, not an 
image.  Output can be copied into a message.  If you think IDLE is doing 
something wrong, test by running the code directly with Python.  If your file 
is test.py, enter the following on a Command Prompt command line.
path-to-your-python-code-dir> python -m test.py

There would only be an IDLE issue (and then only maybe) if the code ran 
differently or produced different output in IDLE than with python directly.  
That is not the case here.

--
assignee: terry.reedy -> 
components: +Interpreter Core -IDLE

___
Python tracker 

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



[issue31684] Scientific formatting of decimal 0 different from float 0

2017-10-04 Thread Aaron Meurer

Aaron Meurer  added the comment:

I guess I would expect that to be captured by the number of zeros printed (and 
obviously doing a string format operation with a set number of digits destroys 
that information).

--

___
Python tracker 

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



[issue31684] Scientific formatting of decimal 0 different from float 0

2017-10-04 Thread Stefan Krah

Stefan Krah  added the comment:

Yes, from the point of view of decimal it's the right thing:

>>> x = Decimal("1e25").quantize(Decimal("1e30"))
>>> x
Decimal('0E+30')
>>> '{:+.19e}'.format(x)
'+0.000e+49'
>>> 

The original magnitude should be traceable (the example is not
perfect but the first thing that quickly came to mind).

--

___
Python tracker 

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



[issue31667] Wrong links in the gettext.NullTranslations class

2017-10-04 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +3861

___
Python tracker 

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



[issue31667] Wrong links in the gettext.NullTranslations class

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset c02a1f4ad8fcdbffad2911c5a31c71a17a89d713 by Serhiy Storchaka in 
branch 'master':
bpo-31667: Fix gettext related links. (#3860)
https://github.com/python/cpython/commit/c02a1f4ad8fcdbffad2911c5a31c71a17a89d713


--

___
Python tracker 

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



[issue30404] Make stdout and stderr truly unbuffered when using -u option

2017-10-04 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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



[issue30404] Make stdout and stderr truly unbuffered when using -u option

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 77732be801c18013cfbc86e27fcc50194ca22c8e by Serhiy Storchaka in 
branch 'master':
bpo-30404: The -u option now makes the stdout and stderr streams totally 
unbuffered. (#1667)
https://github.com/python/cpython/commit/77732be801c18013cfbc86e27fcc50194ca22c8e


--

___
Python tracker 

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



[issue30404] Make stdout and stderr truly unbuffered when using -u option

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

If there is a need in making redirected stdout line-buffered, a new option can 
be added in separate issue.

--

___
Python tracker 

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



[issue31557] tarfile: incorrectly treats regular file as directory

2017-10-04 Thread Joe Tsai

Joe Tsai  added the comment:

It creates a number of nested directories only because GNU (and BSD) tar 
implicitly create missing parent directories. If you cd into the bottom-most 
folder, you will see "foo.txt".

--

___
Python tracker 

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



[issue30397] Expose regular expression and match objects types in the re module

2017-10-04 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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



[issue30397] Expose regular expression and match objects types in the re module

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 0b5e61ddca73ad4fe597fb15065115b0285c8849 by Serhiy Storchaka in 
branch 'master':
bpo-30397: Add re.Pattern and re.Match. (#1646)
https://github.com/python/cpython/commit/0b5e61ddca73ad4fe597fb15065115b0285c8849


--

___
Python tracker 

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



[issue31676] test.test_imp.ImportTests.test_load_source has side effects

2017-10-04 Thread Brett Cannon

Brett Cannon  added the comment:

The whole imp module is deprecated so I'm personally not bothered by 
imp.load_source() not being strengthened to be more sane.

--

___
Python tracker 

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



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

PR 3885 is a preliminary but working implementation. Needed new tests and 
documentation.

>>> import re
>>> re.findall('(?i:[a-z]+)', ''.join(map(chr, range(0x1
['ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz', 'İı', 'ſ', 'K']
>>> re.findall('(?ia:[a-z]+)', ''.join(map(chr, range(0x1
['ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz']

The engine now uses separate opcodes for case-insensitive matching in ASCII, 
UNICODE and LOCALE modes. It may cause small speed up of matching, but slow 
down of compiling.

--

___
Python tracker 

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



[issue31683] a stack overflow on windows in faulthandler._fatal_error()

2017-10-04 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 8d5a3aad2f805dc0ea40829b751f58aa6c75305d by Victor Stinner in 
branch 'master':
bpo-31683: Py_FatalError() now supports long error messages (#3878)
https://github.com/python/cpython/commit/8d5a3aad2f805dc0ea40829b751f58aa6c75305d


--

___
Python tracker 

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



[issue31688] scope error

2017-10-04 Thread R. David Murray

R. David Murray  added the comment:

Yes, this conforms to Python's namespace/scoping rules: nested scopes are 
allowed to reference (but not assign to) variables from the global scope even 
without a 'global' declaration.

--
nosy: +r.david.murray
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



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-04 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +3860

___
Python tracker 

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



[issue31623] Allow to build MSI installer from the official tarball

2017-10-04 Thread Zachary Ware

Zachary Ware  added the comment:

If you're still on XP, security is obviously not a big concern and you're just 
as well off to stick with 3.4.4 :)

--

___
Python tracker 

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



[issue31623] Allow to build MSI installer from the official tarball

2017-10-04 Thread Ivan Pozdeev

Ivan Pozdeev  added the comment:

> Note, though, that you are likely to be the only person on Earth 
using this installer, since there will be no more binary releases of 3.4

Since this is the last release for XP, probably the ppl who are stuck on 
this OS as well. An installable package is a must for any 
maintainability to speak of. The lack of a binary release is actually 
going to be a boost for its use, here :-)

I also had trouble discovering this script in the first place since it's 
not mentioned in PCBuild/readme.txt .
If build instructions are updated as per issue31691 , this would help 
potential users as well.

Beside this patch, issue31170 and issue31645 are needed for the 3.4 
build to work.

--

___
Python tracker 

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



[issue31693] Document Py_GETENV

2017-10-04 Thread Barry A. Warsaw

New submission from Barry A. Warsaw :

I already added a section to the C API docs for some useful macros.  I didn't 
know about this one when I did that, but it seems like a useful macro to 
document, so I will do that.

--
assignee: barry
components: Documentation
messages: 303707
nosy: barry
priority: normal
severity: normal
status: open
title: Document Py_GETENV
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



[issue31671] IntFlag makes re.compile slower

2017-10-04 Thread Ethan Furman

Ethan Furman  added the comment:

IntFlag.__and__ does not create a new instance every time -- all new instances 
are cached in the IntFlag machinery (so RegexFlag(7) is only created once).

If all the RegexFlag combinations are created before the regex compile 
benchmark do we still see a speed-up?

--

___
Python tracker 

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



[issue31692] Test `test_huntrleaks` fails in debug build with COUNT_ALLOCS

2017-10-04 Thread Iryna Shcherbina

New submission from Iryna Shcherbina :

The newly added `test_huntrleaks` test is failing on Python 2.7.14 debug build 
with COUNT_ALLOCS.


==
FAIL: test_huntrleaks (test.test_regrtest.ArgsTestCase)
--
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-2.7.14/Lib/test/test_regrtest.py", line 
511, in test_huntrleaks
self.check_leak(code, 'references')
  File "/builddir/build/BUILD/Python-2.7.14/Lib/test/test_regrtest.py", line 
489, in check_leak
self.assertIn(line2, output)
AssertionError: 'test_regrtest_huntrleaks leaked [1, 1, 1] references, sum=3\n' 
not found in 'Run tests sequentially\n0:00:00 load avg: 0.63 [1/1] 
test_regrtest_huntrleaks\nbeginning 6 
repetitions\n123456\n..\ntest_regrtest_huntrleaks leaked [93, 93, 93] 
references, sum=279\n1 test failed:\ntest_regrtest_huntrleaks\n\nTotal 
duration: 32 ms\nTests result: FAILURE\n[53092 refs]\n'
--


On Python 2.7.14 debug build *without* COUNT_ALLOCS the test passes fine, 
therefore I am not sure if there is a leak detected, or is it just COUNT_ALLOCS 
messing with the test and it should be skipped.

--
components: Tests
messages: 303705
nosy: ishcherb
priority: normal
severity: normal
status: open
title: Test `test_huntrleaks` fails in debug build with COUNT_ALLOCS
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



[issue28805] Add documentation for METH_FASTCALL and _PyObject_FastCall*()

2017-10-04 Thread STINNER Victor

STINNER Victor  added the comment:

> It would also be nice if Cython could use it automatically.

Cython is using FASTCALL since Python 3.6.

--

___
Python tracker 

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



[issue28805] Add documentation for METH_FASTCALL and _PyObject_FastCall*()

2017-10-04 Thread STINNER Victor

STINNER Victor  added the comment:

I suggest to document the following 4 functions/macros:

PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(
PyObject *callable,
PyObject **args,
Py_ssize_t nargs,
PyObject *kwargs);

PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords(
PyObject *callable,
PyObject **args,
Py_ssize_t nargs,
PyObject *kwnames);

#define _PyObject_FastCall(func, args, nargs) \
_PyObject_FastCallDict((func), (args), (nargs), NULL)

#define _PyObject_CallNoArg(func) \
_PyObject_FastCallDict((func), NULL, 0, NULL)

And the METH_FASTCALL and METH_FASTCALL|METH_KEYWORDS calling convention.

--

___
Python tracker 

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



[issue28805] Add documentation for METH_FASTCALL and _PyObject_FastCall*()

2017-10-04 Thread STINNER Victor

STINNER Victor  added the comment:

> Can we please document these for Python 3.7 at least?

I chose to not document FASTCALL on purpose in Python 3.6, I wanted to keep 
everything private, until we get enough feedback and stabilize the API.

Recently, the FASTCALL API changed: METH_FASTCALL doesn't support keywords 
anymore. You have to pass METH_FASTCALL|METH_KEYWORDS.

It seems like the API became stable.

I don't know if we should make the API public or not. PyPy would complain as 
usual that we give them more work to do :-D

--

___
Python tracker 

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



[issue31691] Include missing info on required build steps and how to build installer

2017-10-04 Thread Ivan Pozdeev

Change by Ivan Pozdeev :


Added file: 
https://bugs.python.org/file47192/0001-Add-missing-build-steps-in-build-procedure.patch

___
Python tracker 

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



[issue28805] Add documentation for METH_FASTCALL

2017-10-04 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

This and the _PyObject_FastCall* APIs really do need to be documented, 
especially if they're going to be used in the interpreter itself.  The leading 
underscore signifies that it's not part of the public API (well, METH_FASTCALL 
doesn't have a leading underscore).

When these are not documented, then they aren't discoverable, so there are 
cases where it may be useful but will be overlooked.  It also means that folks 
will be inclined to cargo cult the few existing uses without perhaps 
understanding the full semantics.

Can we please document these for Python 3.7 at least?

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



[issue28805] Add documentation for METH_FASTCALL and _PyObject_FastCall*()

2017-10-04 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


--
title: Add documentation for METH_FASTCALL -> Add documentation for 
METH_FASTCALL and _PyObject_FastCall*()

___
Python tracker 

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



[issue31691] Include missing info on required build steps and how to build installer

2017-10-04 Thread Ivan Pozdeev

New submission from Ivan Pozdeev :

Current build instructions no not mention required preliminary steps before 
building the solution and don't say how to build the installer package - which 
is the ultimate goal of a build.

Being on XP at the moment, I cannot check the validity of build instructions 
for other branches. Maybe they can use this info as well.

--
components: Build
files: 0001-Add-missing-build-steps-in-build-procedure.patch
keywords: patch
messages: 303700
nosy: Ivan.Pozdeev
priority: normal
severity: normal
status: open
title: Include missing info on required build steps and how to build installer
versions: Python 2.7, Python 3.4
Added file: 
https://bugs.python.org/file47191/0001-Add-missing-build-steps-in-build-procedure.patch

___
Python tracker 

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



[issue17446] doctest test finder doesnt find line numbers of properties

2017-10-04 Thread Michael Cuthbert

Michael Cuthbert  added the comment:

A pull request has been in for about a month -- is it possible to review or 
merge or comment?  Thanks!

--

___
Python tracker 

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



[issue31689] random.choices does not work with negative weights

2017-10-04 Thread Allen Riddell

Allen Riddell  added the comment:

Upon some reflection, I think raising a ValueError is the right thing to do. 
Negative weights don't have an obvious interpretation.

--

___
Python tracker 

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



[issue31684] Scientific formatting of decimal 0 different from float 0

2017-10-04 Thread Eric V. Smith

Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-04 Thread INADA Naoki

Change by INADA Naoki :


--
keywords: +patch
pull_requests: +3858
stage: needs patch -> patch review

___
Python tracker 

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



[issue31672] string.Template should use re.ASCII flag

2017-10-04 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Oct 4, 2017, at 10:05, Serhiy Storchaka  wrote:
> 
> See issue31690. But this solution can be used only in 3.7.

That’s fine.  I don’t think this is important enough to backport.

--

___
Python tracker 

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



[issue31677] email.header uses re.IGNORECASE without re.ASCII

2017-10-04 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Oct 3, 2017, at 23:51, INADA Naoki  wrote:
>> It's better to keep the re.IGNORECASE since the RFC also says:
>> 
>>  Both 'encoding' and 'charset' names are case-independent.  Thus the
>>  charset name "ISO-8859-1" is equivalent to "iso-8859-1", and the
>>  encoding named "Q" may be spelled either "Q" or "q".
> 
> I'm sorry, I've committed before reading this.
> But I think it's not problem, because re.IGNORECASE doesn't affect to
> "(?P[^?]*?)" pattern.

I think you’re change is fine, no need to revert or modify it.

--

___
Python tracker 

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



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-04 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

Currently re supports local inline flags. 'a(?i:b)' matches 'a' 
cases-sensitively, but 'b' case-insensitively. But flags 'a' and 'L' can't be 
scoped to a subpattern. The 'u' flag currently just redundant, it doesn't make 
effect in string patterns, and is not allowed in bytes patterns. They can be 
applied only to the whole pattern. I think it would be nice to make them local.

The example of the problem that this can solve is issue31672. Currently '[a-z]' 
in Unicode case-insensitive mode matches not only Latin letters from ;a' to 'z' 
and from 'A' to 'Z', but also characters 'İ', 'ı', 'ſ' and 'K' which are 
equivalent to 'i', 's' and 'k' correspondingly. With local 'a' and 'u' flags 
you can use ASCII and Unicode ranges in the same pattern.

I'm working on the patch.

--
assignee: serhiy.storchaka
components: Library (Lib), Regular Expressions
messages: 303693
nosy: ezio.melotti, mrabarnett, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Make RE "a", "L" and "u" inline flags local
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



[issue31672] string.Template should use re.ASCII flag

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

See issue31690. But this solution can be used only in 3.7.

--

___
Python tracker 

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



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-04 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue31672] string.Template should use re.ASCII flag

2017-10-04 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Oct 4, 2017, at 02:29, INADA Naoki  wrote:
> 
> INADA Naoki  added the comment:
> 
>> Yet one way -- make re.ASCII a local flag. Than we could just change the 
>> idpattern attribute to r'(?a:[_a-z][_a-z0-9]*)', without touching the flags 
>> attribute.
> 
> https://docs.python.org/3.6/library/re.html#regular-expression-syntax says
> `(?imsx-imsx:...)`
> 
> Anyway, Template.idpattern is documented public API too.

Too bad, because I like that approach.  How hard would it be to add support for 
‘a’ as a local flag?  (I’m kind of surprised that it isn’t already supported - 
it seems like it would be useful.)

I would like this better than hacking Template.flags after the fact.  It seems 
like the right way to align the code with the documentation (i.e. fix a bug).

--

___
Python tracker 

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



[issue31671] IntFlag makes re.compile slower

2017-10-04 Thread STINNER Victor

STINNER Victor  added the comment:

I don't really care if Python 3.7 is still slower than 3.6 with PR 3862. The 
speedup is significant, the change is short and safe, so the PR LGTM :-) We can 
implement further optimizations later ;-)

By the way, speed.python.org can be used to track performances over time. 
Sadly, I didn't have much time to take care of the website: run manually to job 
to draw new plots :-)

--

___
Python tracker 

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



[issue31671] IntFlag makes re.compile slower

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

It makes sense to report the performance gain only in comparison with the 
previous released version. I expect that re compiling is slower in 3.7 due to 
new features and optimizations. Generating more optimal code takes a time.

--

___
Python tracker 

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



[issue31688] scope error

2017-10-04 Thread Mark Dickinson

Mark Dickinson  added the comment:

The code looks fine to me; I don't see any reason to expect an error.

What error were you expecting, and why?

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue31671] IntFlag makes re.compile slower

2017-10-04 Thread STINNER Victor

STINNER Victor  added the comment:

> Did you compare the benchmarking results against 3.7 or 3.6?

My lasted benchmark is on the master branch: original code ("ref") vs code 
patched with PR 3862 ("patch").

--

___
Python tracker 

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



[issue31671] IntFlag makes re.compile slower

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Did you compare the benchmarking results against 3.7 or 3.6?

--

___
Python tracker 

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



[issue31619] Strange error when convert hexadecimal with underscores to int

2017-10-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I missed the issue mentioned by Mark msg303331. I looked at the type of n, and 
okay, it is Py_ssize_t. But I forgot to check the type of digits and 
bits_per_char, and it is int. My fix doesn't guard from integer overflow.

The following PR fixes this. It also tries to guard against integer overflow in 
other place. Unfortunately there is yet one issue with that code. The guard 
works on 32-bit platform, where the precision of double is large than the size 
of Py_size_t. But on 64-bit platform it is possible that (Py_ssize_t)(digits * 
log_base_BASE[base]) takes the value not enough for writing the result of the 
parsing, because its lowest bits are lost.

I know that converting str to int with non-binary base has nonlinear complexity.

--

___
Python tracker 

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



[issue31689] random.choices does not work with negative weights

2017-10-04 Thread Mark Dickinson

Mark Dickinson  added the comment:

@ariddell: What behaviour did you want to see here?

It wouldn't have occurred to me to even try using `random.choices` with 
negative weights; forcing the weights to be nonnegative (with strictly positive 
sum) sounds like a natural restriction.

--
nosy: +mark.dickinson, rhettinger

___
Python tracker 

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



[issue31671] IntFlag makes re.compile slower

2017-10-04 Thread STINNER Victor

STINNER Victor  added the comment:

Naoki: "I've added news entry about it."

Nice. You might also mention the "optimization" in What's New in Python 3.7 
doc, in the Optimisations section. The issue here is that it's only faster than 
Python 3.6, but Python 3.6 was slower than 3.5 :-) The "optimization" just 
makes Python 3.7 as fast as Python 3.5 ... :-)

--

___
Python tracker 

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



[issue31619] Strange error when convert hexadecimal with underscores to int

2017-10-04 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +3857

___
Python tracker 

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



[issue31689] random.choices does not work with negative weights

2017-10-04 Thread Allen Riddell

New submission from Allen Riddell :

Code to reproduce problem:

population = list(range(10))
weights = list(-1 * w for w in range(10))
[random.choices(population, weights) for _ in range(1000)]

will raise IndexError:

358 bisect = _bisect.bisect
359 total = cum_weights[-1]
--> 360 return [population[bisect(cum_weights, random() * total)] for i 
in range(k)]
361 
362 ##  real-valued distributions  ---

IndexError: list index out of range

--
components: Library (Lib)
messages: 303683
nosy: ariddell
priority: normal
severity: normal
status: open
title: random.choices does not work with negative weights
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



[issue31688] scope error

2017-10-04 Thread abdullah patel

New submission from abdullah patel :

there should be an error when this code is run. as  I have not defined the 
arguments (I was told by my computer science teacher that it should not work in 
theory) and parameters but it clearly works.

--
assignee: terry.reedy
components: IDLE
files: pythonerror.jpg
messages: 303682
nosy: abdullah patel, terry.reedy
priority: normal
severity: normal
status: open
title: scope error
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47190/pythonerror.jpg

___
Python tracker 

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



[issue31671] IntFlag makes re.compile slower

2017-10-04 Thread INADA Naoki

INADA Naoki  added the comment:

Thank you for benchmarking.  I've added news entry about it.

--

___
Python tracker 

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



[issue30465] FormattedValue expressions have wrong lineno and col_offset information

2017-10-04 Thread Eric V. Smith

Eric V. Smith  added the comment:

I think it's fixed. Closing.

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

___
Python tracker 

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



[issue31671] IntFlag makes re.compile slower

2017-10-04 Thread STINNER Victor

STINNER Victor  added the comment:

Nice speedup!

I ran a benchmark on PR 3862:

 1002  ./python 
~/prog/python/performance/performance/benchmarks/bm_regex_compile.py 
--inherit=PYTHONPATH -v -o patch.json
 1003  git co master
 1004  make
 1005  ./python 
~/prog/python/performance/performance/benchmarks/bm_regex_compile.py 
--inherit=PYTHONPATH -v -o ref.json
 1007  ./python -m perf compare_to ref.json patch.json 

Mean +- std dev: [ref] 396 ms +- 16 ms -> [patch] 347 ms +- 8 ms: 1.14x faster 
(-12%)

It's the following benchmark on *uncached* regular expressions. So it really 
measures re.compile() performance, not the cache.
https://pyperformance.readthedocs.io/benchmarks.html#regex-compile

--

___
Python tracker 

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



[issue1759845] [2.7] subprocess.call fails with unicode strings in command line

2017-10-04 Thread STINNER Victor

Change by STINNER Victor :


--
title: subprocess.call fails with unicode strings in command line -> [2.7] 
subprocess.call fails with unicode strings in command line

___
Python tracker 

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



[issue31687] test_semaphore_tracker() of test_multiprocessing_spawn fails randomly (race condition?)

2017-10-04 Thread STINNER Victor

New submission from STINNER Victor :

Recent example of the slow and busy (load of 8.05 with 2 CPUs) x86 Gentoo 
Refleaks 3.6 buildbot:

http://buildbot.python.org/all/builders/x86%20Gentoo%20Refleaks%203.6/builds/111/steps/test/logs/stdio

== CPU count: 2
...
1:41:09 load avg: 8.05 [170/405/1] test_multiprocessing_spawn failed -- 
running: test_asyncio (1118 sec)
beginning 6 repetitions
123456
/buildbot/buildarea/3.6.ware-gentoo-x86.refleak/build/Lib/unittest/case.py:633: 
ResourceWarning: unclosed file <_io.BufferedReader name=22>
  outcome.errors.clear()
test test_multiprocessing_spawn failed -- Traceback (most recent call last):
  File 
"/buildbot/buildarea/3.6.ware-gentoo-x86.refleak/build/Lib/test/_test_multiprocessing.py",
 line 4091, in test_semaphore_tracker
_multiprocessing.sem_unlink(name2)
AssertionError: OSError not raised
1:41:12 load avg: 7.97 [171/405/1] test_posixpath passed -- running: 
test_asyncio (1122 sec)
beginning 6 repetitions
123456
..

--
components: Tests
messages: 303678
nosy: haypo
priority: normal
severity: normal
status: open
title: test_semaphore_tracker() of test_multiprocessing_spawn fails randomly 
(race condition?)
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue1759845] subprocess.call fails with unicode strings in command line

2017-10-04 Thread Safihre

Safihre  added the comment:

Although this issue is very old, in case anyone else like us need this 
functionality I created a package that implements the proposed C-fix.
https://pypi.python.org/pypi/subprocessww
Simply "import subprocessww" and POpen is patched. We tested it and it does the 
job pretty well, haven't run into special situations yet.

We really want to upgrade our app to Python 3, but currently lack the manpower 
to go over our app line by line. It's not a simple 2to3 conversion, 
unfortunately.

--
nosy: +Safihre

___
Python tracker 

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



[issue31557] tarfile: incorrectly treats regular file as directory

2017-10-04 Thread Nitish

Nitish  added the comment:

Try 'tar xvf test.tar'. On Linux machine at least, it is in fact producing a 
tree of directories. Not a single file. So - in a way what Python is reporting 
is correct.

--

___
Python tracker 

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



[issue31672] string.Template should use re.ASCII flag

2017-10-04 Thread INADA Naoki

INADA Naoki  added the comment:

Current pull request override `Template.flags = re.I` after class creation for 
backward compatibility, without any API change.

But I'm not sure it's right approach.
How many people who subclass string.Template expect non-ASCII match?
If this change is bugfix for 99% of subclasses, why should we keep pitfall?

--

___
Python tracker 

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



[issue31672] string.Template should use re.ASCII flag

2017-10-04 Thread INADA Naoki

INADA Naoki  added the comment:

> Yet one way -- make re.ASCII a local flag. Than we could just change the 
> idpattern attribute to r'(?a:[_a-z][_a-z0-9]*)', without touching the flags 
> attribute.

https://docs.python.org/3.6/library/re.html#regular-expression-syntax says
`(?imsx-imsx:...)`

Anyway, Template.idpattern is documented public API too.

--

___
Python tracker 

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



[issue31672] string.Template should use re.ASCII flag

2017-10-04 Thread INADA Naoki

INADA Naoki  added the comment:

> When optimizing, please don't make API changes.

This is not only optimization, but bugfix.

Document of string.Template says:

> By default, "identifier" is restricted to any case-insensitive ASCII  
> alphanumeric string (including underscores) that starts with an underscore or 
> ASCII letter.

So, missing re.ASCII flag is bug because non-ASCII alphabet can be matched.

--

___
Python tracker 

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



[issue31684] Scientific formatting of decimal 0 different from float 0

2017-10-04 Thread Mark Dickinson

Mark Dickinson  added the comment:

The aim here is to capture the original Decimal value where possible, including 
the exponent information. (Unlike floats, trailing zeros in a `Decimal` 
instance are significant.)

>>> from decimal import Decimal
>>> Decimal('+0.000e+19')
Decimal('0')
>>> Decimal('+0.000e+00')
Decimal('0E-19')

--

___
Python tracker 

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