[issue12294] multiprocessing.Pool: Need a way to find out if work are finished.

2016-08-19 Thread Caleb Hattingh

Changes by Caleb Hattingh :


--
nosy: +cjrh

___
Python tracker 

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



[issue12982] Document that importing .pyo files needs python -O

2016-08-19 Thread Caleb Hattingh

Caleb Hattingh added the comment:

Presumably PEP488 (and the 4 years of inactivity) means that this issue could 
be closed?

--
nosy: +cjrh

___
Python tracker 

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



[issue11602] python-config code should be in sysconfig

2016-08-19 Thread Caleb Hattingh

Changes by Caleb Hattingh :


--
nosy: +cjrh

___
Python tracker 

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



[issue27283] Add a "What's New" entry for PEP 519

2016-08-19 Thread Berker Peksag

Berker Peksag added the comment:

pep_519_whatsnew.diff looks pretty good to me, thanks! It would be nice to add 
a simple example to demonstrate the feature (like we did for PEP 498: 
https://docs.python.org/3.6/whatsnew/3.6.html#pep-498-formatted-string-literals)

>>> import pathlib
>>> with open(pathlib.Path('README')) as f:
...   readme = f.read()
...

--
nosy: +berker.peksag
stage: patch review -> commit review
type:  -> enhancement

___
Python tracker 

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



[issue23968] rename the platform directory from plat-$(MACHDEP) to plat-$(PLATFORM_TRIPLET)

2016-08-19 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

I've just tried doko's patch on Arch Linux. Before this patch there are three 
test failures in test_distutils and test_sysconfig, just like Gentoo. After the 
patch, all tests in test_distutils and test_sysconfig pass.

On my PC both `gcc -print-multiarch` and `gcc --print-multiarch` print an empty 
string.

By the way, could you attach this patch file to roundup, so that others can 
download it?

Reference: Arch Linux's build script of python-hg: 
https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-hg

--

___
Python tracker 

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



[issue27713] Spurious "platform dependent libraries" warnings when running make

2016-08-19 Thread Ned Deily

Ned Deily added the comment:

That was easy; thanks, Xiang Zhang!  Pushed for release in 3.5.3 and 3.6.0.

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

___
Python tracker 

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



[issue27713] Spurious "platform dependent libraries" warnings when running make

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 97b996d81c62 by Ned Deily in branch '3.5':
Issue #27713: Surpress spurious build warnings when updating importlib's
https://hg.python.org/cpython/rev/97b996d81c62

New changeset 751ca458d669 by Ned Deily in branch 'default':
Issue #27713: merge from 3.5
https://hg.python.org/cpython/rev/751ca458d669

--
nosy: +python-dev

___
Python tracker 

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



[issue23968] rename the platform directory from plat-$(MACHDEP) to plat-$(PLATFORM_TRIPLET)

2016-08-19 Thread Matthias Klose

Matthias Klose added the comment:

please could somebody test the attached patch (I'm also trying to setup a 
gentoo env)? The idea is to keep the multiarch and triplet macros in sync.

diff -r a7f3678f9509 configure.ac
--- a/configure.ac  Sat Aug 20 03:05:13 2016 +0200
+++ b/configure.ac  Sat Aug 20 03:54:39 2016 +0200
@@ -882,6 +882,8 @@
   if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
 AC_MSG_ERROR([internal configure error for the platform triplet, please 
file a bug report])
   fi
+elif test x$PLATFORM_TRIPLET != x && test x$MULTIARCH = x; then
+  MULTIARCH=$PLATFORM_TRIPLET
 fi
 if test x$PLATFORM_TRIPLET = x; then
   PLATDIR=plat-$MACHDEP

--

___
Python tracker 

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



[issue12713] argparse: allow abbreviation of sub commands by users

2016-08-19 Thread Ned Deily

Changes by Ned Deily :


--
priority: normal -> release blocker

___
Python tracker 

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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-08-19 Thread Ned Deily

Ned Deily added the comment:

https://mail.python.org/pipermail/distutils-sig/2016-August/029469.html

--

___
Python tracker 

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



[issue22021] shutil.make_archive() root_dir do not work

2016-08-19 Thread bananaapple

bananaapple added the comment:

I am sorry.

I understand now.

Thank you.

--

___
Python tracker 

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



[issue23968] rename the platform directory from plat-$(MACHDEP) to plat-$(PLATFORM_TRIPLET)

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

Any update on this issue?

test_srcdir() of test_sysconfig still fails on "x86 Gentoo Installed with X 
3.x" buildbot. I opened the issue #27798 which was closed a duplicate of this 
issue.

First failure of the buildbot:

http://buildbot.python.org/all/builders/x86%20Gentoo%20Installed%20with%20X%203.x/builds/747

This build contains many changes. I don't know which one introduced the issue?

* change a062c60c9f7d60db2b63af88e2d676e617398d01: Update 
distutils/sysconfig.py to look for the renamed _sysconfigdata module too
* change 78d2cb7f66b602ec496800fbbe71e590c0f56b00: Rename the platform 
directory from plat-$(MACHDEP) to plat-$(PLATFORM_TRIPLET)

Ned Deily: "This needs to be fixed before release."

I agree. I use the release blocker priority as a reminder. Well, if the issue 
cannot be fixed, I suggest to revert changes related to this issue.

"It's not just broken for cross-compiling.  As I noted earlier, it's broken 
when using other than gcc, such as is the case with current OS X systems."

test_sysconfig fails on "x86 Gentoo Installed with X 3.x" buildbot which uses 
GCC. Extract of the configure output:

   checking for gcc... gcc

--
nosy: +haypo
priority: critical -> release blocker

___
Python tracker 

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



[issue27800] Regular expressions with multiple repeat codes

2016-08-19 Thread Martin Panter

Martin Panter added the comment:

Okay so it sounds like my usage is valid if I add the brackets. I will try to 
come up with a documentation patch as some stage. The reason why it is not 
supported without brackets is to maintain a bit of consistency with the 
question mark (?), which modifies the preceding quantifier, and with the plus 
sign (+), which is also a modifier in other implementations.

For the record, Gnu grep does seem to accept my expression (although Posix says 
this is undefined, and neither support lazy or possessive quantifiers):

$ grep -E -o 'a{2}*' <<< "a"


However pcregrep, which supports lazy (?) and possessive (+) quantifiers, 
doesn’t like my expression:

$ pcregrep -o 'a{2}*' <<< "a"
pcregrep: Error in command-line regex at offset 4: nothing to repeat
[Exit 2]
$ pcregrep -o '(?:a{2})*' <<< "a"


--

___
Python tracker 

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



[issue26823] Shrink recursive tracebacks

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a7f3678f9509 by Victor Stinner in branch 'default':
Fix reference leak in tb_printinternal()
https://hg.python.org/cpython/rev/a7f3678f9509

--

___
Python tracker 

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



[issue25746] test_unittest failure in leaks searching mode

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

While checking that I didn't introduce a reference leak recently with my 
changes around _PyObject_FastCall(), I found the same issue: test_unittest 
doesn't work with regrtest -R.

I get the same error:

$ ./python -m test -R 0:1 -v test_unittest
==
ERROR: test_discover_with_init_module_that_raises_SkipTest_on_import 
(unittest.test.test_discovery.TestDiscovery)
--
Traceback (most recent call last):
  File "/home/haypo/prog/python/default/Lib/unittest/test/test_discovery.py", 
line 572, in test_discover_with_init_module_that_raises_SkipTest_on_import
pickle.loads(pickle.dumps(suite, proto))
_pickle.PicklingError: Can't pickle : 
attribute lookup ModuleSkipped on unittest.loader failed

==
ERROR: test_discover_with_module_that_raises_SkipTest_on_import 
(unittest.test.test_discovery.TestDiscovery)
--
Traceback (most recent call last):
  File "/home/haypo/prog/python/default/Lib/unittest/test/test_discovery.py", 
line 548, in test_discover_with_module_that_raises_SkipTest_on_import
pickle.loads(pickle.dumps(suite, proto))
_pickle.PicklingError: Can't pickle : 
attribute lookup ModuleSkipped on unittest.loader failed

--

--
nosy: +haypo

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

I created two new issues:

* issue #27809: _PyObject_FastCall(): add support for keyword arguments
* issue #27810: Add METH_FASTCALL: new calling convention for C functions

--

___
Python tracker 

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



[issue27366] PEP487: Simpler customization of class creation

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 545bfa4c20eb by Victor Stinner in branch 'default':
Issue #27366: Fix init_subclass()
https://hg.python.org/cpython/rev/545bfa4c20eb

--

___
Python tracker 

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



[issue27810] Add METH_FASTCALL: new calling convention for C functions

2016-08-19 Thread STINNER Victor

Changes by STINNER Victor :


--
dependencies: +_PyObject_FastCall(): add support for keyword arguments

___
Python tracker 

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



[issue27810] Add METH_FASTCALL: new calling convention for C functions

2016-08-19 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

> Users of Supervisor have been depending on that for a long time. 

Hum, the workaround is very simple no? Just open /dev/stdout with mode "w", no?

--

___
Python tracker 

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



[issue27810] Add METH_FASTCALL: new calling convention for C functions

2016-08-19 Thread STINNER Victor

New submission from STINNER Victor:

The issue #27128 added _PyObject_FastCall() to avoid the creation of temporary 
tuples when calling functions.

I propose to add a new METH_FASTCALL calling convention. The example using 
METH_VARARGS | METH_KEYWORDS:
   PyObject* func(DirEntry *self, PyObject *args, PyObject *kwargs)
becomes:
   PyObject* func(DirEntry *self, PyObject **args, int nargs, PyObject *kwargs)

Using METH_VARARGS, args is a Python tuple. Using METH_FASTCALL, args is a C 
array of PyObject*, and there is a second nargs parameter.

Later, Argument Clinic will be modified to *generate* code using the new 
METH_FASTCALL calling convention. Code written with Argument Clinic will only 
need to be updated by Argument Clinic to get the new faster calling convention 
(avoid the creation of a temporary tuple for positional arguments).

This issue depends on the issue #27809 "_PyObject_FastCall(): add support for 
keyword arguments". I will wait until this dependency is implemented, before 
working on the implementation of this part.

For a full implementation, see my first attempt in the issue #26814. I will 
extract the code from this branch to write a new patch.

--
messages: 273173
nosy: haypo
priority: normal
severity: normal
status: open
title: Add METH_FASTCALL: new calling convention for C functions
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

Syscalls made by open("/dev/stdout", "a") in Python 2:

  open("/dev/stdout", O_WRONLY|O_CREAT|O_APPEND, 0666) = 3
  lseek(3, 0, SEEK_END)   = -1 ESPIPE (Illegal seek)
  fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0

I used this comand:

  $ strace -o trace python2 -c 'import os; os.uname();os.uname();os.uname(); 
f=open("/dev/stdout", "a"); os.uname(); f.close()'

It looks like the C library simply ignores ESPIPE on lseek(fd, 0, SEEK_END) 
when opening a file in append mode:
https://sourceware.org/git/?p=glibc.git;a=blob;f=libio/fileops.c;h=13157354272ff9ab1832d4a619a81f05898fcd69;hb=HEAD#l242

  if ((read_write & _IO_IS_APPENDING) && (read_write & _IO_NO_READS))
if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
== _IO_pos_BAD && errno != ESPIPE)
  {
close_not_cancel (fdesc);
return NULL;
  }

from _IO_file_open() file operation.

--

___
Python tracker 

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



[issue27809] _PyObject_FastCall(): add support for keyword arguments

2016-08-19 Thread STINNER Victor

New submission from STINNER Victor:

_PyObject_FastCall() (added in the issue #27128) already supports keyword 
arguments for C functions, but not Python functions.

Attached patch adds support for keyword arguments in _PyFunction_FastCall(), to 
allow to use _PyObject_FastCall() in more cases.

Examples of functions that can be modified to _PyObject_FastCall() with this 
change:

* builtin_sorted()
* builtin___build_class__()
* init_subclass()
* PyEval_CallObjectWithKeywords(func, NULL, kwargs)
* methoddescr_call(), classmethoddescr_call(), wrapperdescr_call()
* PyFile_GetLine()

Moreover, supporting keywords is required for another more important step: add 
a new METH_CALL calling convention for C functions.

--
files: fastcall_kwargs.patch
keywords: patch
messages: 273170
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: _PyObject_FastCall(): add support for keyword arguments
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file44162/fastcall_kwargs.patch

___
Python tracker 

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



[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-19 Thread Martin Panter

Martin Panter added the comment:

The origin of this seems to be r68835 and Issue 5008. Victor mentioned 
imitating the Gnu C library. Maybe there is a better way that also supports 
non-seekable files better, perhaps handle ESPIPE without failing.

This also affects Python 2, if you consider io.open() or io.FileIO directly.

--
nosy: +haypo, martin.panter
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



[issue12713] argparse: allow abbreviation of sub commands by users

2016-08-19 Thread paul j3

paul j3 added the comment:

I haven't read the discussion in full, but it looks like this patch was added 
without any recent discussion or testing.

Previously if we had `choices=['a','abc']`, any exact match would be accepted, 
and partial matches rejected.  With this change the only choice that will work 
is the longest, 'abc'.  The other will be rejected as ambiguous.

In contrast with optionals flags, an exact match has priority over (possibly 
ambiguous) abbreviations.  See parser._parse_optional

I also noticed when testing this that for regular 'choices', the abbreviated 
string is put in the Namespace.  

 add_argument('--foo', choices = ['one','two'])

can produce `Namespace(foo='on')`.  I suspect most developers would want 
`Namespace(foo='one')`, regardless of whether it was an exact match or partial. 
 You don't list choices if you are ok with partial matches.

This isn't a problem with `subparsers`, since an abbreviation match still 
invokes the right subparser, and even puts the right name in 'subparsers' dest. 
 But for regular choices the behavior is highly debatable.

This needs to be reverted.  It may be fixable, but it needs more testing and 
discussion.  For now it's an enhancement that is causing backward compatibility 
problems.

ps

I missed this issue when I made an effort to find all argparse issues several 
years ago.  I contributed to https://bugs.python.org/issue14365, the other 
abbreviations issue mentioned in the recent github thread.

--
keywords: +needs review -patch

___
Python tracker 

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



[issue27808] os.waitpid does not return (0, 0) when child has not exited (FreeBSD)

2016-08-19 Thread Casey Lucas

New submission from Casey Lucas:

I'm not sure if this a Python issue or a FreeBSD issue but the return value 
from os.waitpid is not reliably (0,0) on FreeBSD when the WNOHANG is used and 
the child process has not yet exited.  Python docs say that the return value 
will be (0,0) but this is not the case.  I believe it is because the FreeBSD 
implementation of waitpid writes an uninitialized value to the status field 
when a child process is not available.  See also: 
http://stackoverflow.com/questions/38984449/is-status-value-from-os-waitpid-unreliable-when-os-wnohang-is-used-under-freebsd

Maybe this is just a documentation issue?  Or does the C code in the Python 
library need to handle this case?

--
components: FreeBSD, Library (Lib)
files: waitpid_test.py
messages: 273167
nosy: Casey Lucas, koobs
priority: normal
severity: normal
status: open
title: os.waitpid does not return (0,0) when child has not exited (FreeBSD)
versions: Python 2.7, Python 3.4
Added file: http://bugs.python.org/file44161/waitpid_test.py

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c2af917bde71 by Victor Stinner in branch 'default':
PyFile_WriteObject() now uses fast call
https://hg.python.org/cpython/rev/c2af917bde71

New changeset 0da1ce362d15 by Victor Stinner in branch 'default':
import_name() now uses fast call
https://hg.python.org/cpython/rev/0da1ce362d15

New changeset e5b24f595235 by Victor Stinner in branch 'default':
PyErr_PrintEx() now uses fast call
https://hg.python.org/cpython/rev/e5b24f595235

New changeset 154f78d387f9 by Victor Stinner in branch 'default':
call_trampoline() now uses fast call
https://hg.python.org/cpython/rev/154f78d387f9

New changeset 351b987d6d1c by Victor Stinner in branch 'default':
sys_pyfile_write_unicode() now uses fast call
https://hg.python.org/cpython/rev/351b987d6d1c

New changeset abb93035ebb7 by Victor Stinner in branch 'default':
_elementtree: deepcopy() now uses fast call
https://hg.python.org/cpython/rev/abb93035ebb7

New changeset 2954d2aa4c90 by Victor Stinner in branch 'default':
pattern_subx() now uses fast call
https://hg.python.org/cpython/rev/2954d2aa4c90

--

___
Python tracker 

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



[issue27807] Prevent site-packages .pth files from causing test_site failure

2016-08-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I think hitting adventurous users like Chris who locally compile and test with 
this failure is wrong.  There is no core dev 'site' expert, so I picked 
'testing'.

--
nosy: +ezio.melotti, michael.foord, terry.reedy

___
Python tracker 

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



[issue27598] Add Collection to collections.abc and typing

2016-08-19 Thread Neil Girdhar

Neil Girdhar added the comment:

(never mind about the comparison operators :)  Turns out that would break 
backwards compatibility.)

--

___
Python tracker 

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



[issue27283] Add a "What's New" entry for PEP 519

2016-08-19 Thread Brett Cannon

Brett Cannon added the comment:

While I wait on various patches related to PEP 519 to land, I have gone ahead 
and written the What's New entry.

--
keywords: +patch
Added file: http://bugs.python.org/file44160/pep_519_whatsnew.diff

___
Python tracker 

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



[issue27283] Add a "What's New" entry for PEP 519

2016-08-19 Thread Brett Cannon

Changes by Brett Cannon :


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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-08-19 Thread Ned Deily

Ned Deily added the comment:

"I posted a couple of messages on distutils-sig and got little attention."

OK, for future reference, the start of the discussion was here:

https://mail.python.org/pipermail/distutils-sig/2016-May/029010.html

It looks like the first item, the one relative to this issue, got lost in the 
discussion of the second item.  I'm attempting to (re-)start the discussion 
there (my post may be awaiting moderation).

--

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-19 Thread Brett Cannon

Changes by Brett Cannon :


--
stage: test needed -> commit review

___
Python tracker 

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



[issue27807] Prevent site-packages .pth files from causing test_site failure

2016-08-19 Thread Chris Angelico

New submission from Chris Angelico:

Having matplotlib installed globally causes test_site to fail, due to the .pth 
file importing types. The point of the test is to monitor startup dependencies 
(and thus time) for the core interpreter and standard library, not third-party 
libraries, so having a test failure due to a .pth is not overly useful.

Solution suggested by Steve Dower: hack out all .pth handling during this one 
test, leaving everything else unchanged.

--
components: Tests
messages: 273160
nosy: Rosuav
priority: normal
severity: normal
status: open
title: Prevent site-packages .pth files from causing test_site failure
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



[issue27807] Prevent site-packages .pth files from causing test_site failure

2016-08-19 Thread Chris Angelico

Changes by Chris Angelico :


--
keywords: +patch
Added file: http://bugs.python.org/file44158/no-site-packages-in-test.patch

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-19 Thread Brett Cannon

Brett Cannon added the comment:

Here is a patch that incorporates Serhiy's feedback.

--
Added file: http://bugs.python.org/file44159/path_converter.diff

___
Python tracker 

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



[issue12713] argparse: allow abbreviation of sub commands by users

2016-08-19 Thread paul j3

Changes by paul j3 :


--
nosy: +paul.j3

___
Python tracker 

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



[issue27806] 2.7 32-bit builds fail on future releases of OS X due to dependency on deleted header file

2016-08-19 Thread Ned Deily

New submission from Ned Deily:

Attempts to build Python 2.7 using OS X/macOS public beta versions of the 
latest command-line tools can fail due to the removal of the system header file 
for QuickTime/QuickTime.h, one of the long deprecated Carbon APIs.  Currently, 
Python only attempts to build modules dependent on this file when building for 
32-bit archs so this problem typically only affects builds with 
--with-universal-archs= configure options like "intel" or "intel-32".  It would 
be nice to preserve the ability to make use of QuickTime on older systems where 
the header file is still available.  Since the old Python mac modules don't 
exist in Python 3.x, this is only a 2.7 issue.

--
assignee: ned.deily
components: Build, Macintosh
messages: 273159
nosy: ned.deily, ronaldoussoren
priority: normal
severity: normal
stage: needs patch
status: open
title: 2.7 32-bit builds fail on future releases of OS X due to dependency on 
deleted header file
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



[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-19 Thread Shane Hathaway

New submission from Shane Hathaway:

With Python 2, the following call worked:

open('/dev/stdout', 'a')

Users of Supervisor have been depending on that for a long time. 

With Python 3.5, this is what happens:

>>> open('/dev/stdout', 'a')
Traceback (most recent call last):
  File "", line 1, in 
OSError: [Errno 29] Illegal seek

Presumably, this happens because Python 3 opens the file in 'w' mode and seeks 
to the end, while Python 2 passed the 'a' flag directly to the underlying C 
library; the underlying library is apparently smart enough to treat 'a' and 'w' 
identically when opening character device files and FIFOs.

It's a nasty little surprise for those upgrading from Python 2.

--
components: IO
messages: 273158
nosy: hathawsh
priority: normal
severity: normal
status: open
title: In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE
versions: Python 3.5

___
Python tracker 

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



[issue27804] IDLE 3.5.2 crashes when typing ^ on keyboard

2016-08-19 Thread Ned Deily

Ned Deily added the comment:

You are almost certainly seeing a crash due to a critical bug in the 
Apple-supplied version of Tk 8.5 on OS X systems up through at least OS X 
10.11.  See here for more information: 
https://www.python.org/download/mac/tcltk/#apple-8-5-9.

The solution is to use a Python that links with a more, up-to-date third-party 
version of Tcl and Tk, such as Pythons from python.org OS X installers and 
current versions of ActiveTcl from ActiveState:
https://www.python.org/download/mac/tcltk/

--
nosy: +ned.deily
resolution:  -> third party
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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-08-19 Thread Sylvain Corlay

Sylvain Corlay added the comment:

Thanks Ned. I posted a couple of messages on distutils-sig and got little 
attention.

I think that this feature is very important for detecting whether a compiler 
supports a certain flag like `-std=c++11` and provide a meaningful error when 
needed.

CMake has the same feature, implemented in a similar fashion 
(CHECK_CXX_COMPILER_FLAG).

--

___
Python tracker 

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



[issue27804] IDLE 3.5.2 crashes when typing ^ on keyboard

2016-08-19 Thread Grégoire Cutzach

New submission from Grégoire Cutzach:

When typing ^ (CIRCUMFLEX ACCENT Unicode: U+005E, UTF-8: 5E) on azerty 
Keyboard, IDLE quits/crashes.
Encountered on a mac running OS X 10.11.6

--
assignee: terry.reedy
components: IDLE
messages: 273155
nosy: Grégoire Cutzach, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE 3.5.2 crashes when typing ^ on keyboard
type: crash
versions: Python 3.5

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Vedran Čačić

Vedran Čačić added the comment:

# Just wait until I put the keys to the time machine in their usual place... :-)

Ok, while we're talking about whether declarative style is a good idea, Python 
has already got the initial seed of that style. With Guido's blessing! PEP 526 
enables us to mix declarative and imperative style in "ordinary" code, so we 
can write

@Enum
class Color:
green: member
yellow: member

without any additional syntax. I think it satisfies everyone: there are no 
parentheses, and there are no assignments. [_And_ there is no misleading 
analogy with existing syntax, because this is a new syntax.:] There are just 
declarations, and the decorator instantiates them.

Decorator is needed because formally we need to exclude the type checking 
semantics, and the only official way currently is through a decorator. But in 
fact we can use the forward references to _actually_ annotate the members with 
their real type:

class Color(Enum):
green: 'Color'
yellow: 'Color'

And once the forward references get a nicer syntax, and the unpacking issues 
are solved, we'll be able to write

class Color(Enum):
green, yellow: Color

And I think finally everyone will be happy. :-)

--

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

Ok, I updated the most simple forms of function calls.

I will open new issues for more complex calls and more sensible parts of
the code like ceval.c.

Buildbots seem to be happy.

--

___
Python tracker 

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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-08-19 Thread Ned Deily

Ned Deily added the comment:

Sylvain, have you brought this feature request up on the Distutils mailing 
list?  The PyPA there is responsible for packaging features.  One big issue 
with adding new features to Distutils is the backwards-compatibility tradeoff: 
many third-party package authors want to support their distributions on 
multiple Python versions which is one of the reasons why we are generally very 
cautious about changing or even adding APIs to Distutils at this point in its 
life.

https://mail.python.org/mailman/listinfo/distutils-sig

--
nosy: +ned.deily

___
Python tracker 

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



[issue12713] argparse: allow abbreviation of sub commands by users

2016-08-19 Thread Zachary Ware

Zachary Ware added the comment:

There's a bug in this patch, first reported at 
https://github.com/python/benchmarks/issues/1

Attached patch causes test_parse_args_abbreviation to show the failure:

test.test_argparse.ArgumentParserError: ('SystemExit', '', "usage: PROG [-h] 
[--foo] bar {1,2,3,lost,long,longer} ...\nPROG: error: ambiguous choice: 'long' 
could match long, longer\n")

--
assignee:  -> vinay.sajip
nosy: +zach.ware
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open
versions: +Python 3.6 -Python 3.4
Added file: http://bugs.python.org/file44157/abbr_bug_test.diff

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Guido van Rossum

Changes by Guido van Rossum :


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



[issue27766] Add ChaCha20 Poly1305 to SSL ciphers

2016-08-19 Thread Francis MB

Francis MB added the comment:

Documentation cosmetic:

 #   * Prefer ECDHE over DHE for better performance
 #   * Prefer any AES-GCM over any AES-CBC for better performance and security
+#   * Prefer any AES-GCM over any AES-CBC for better performance and security

The patch seems to be adding the same preference comment? or did you
mean other preference?

--
nosy: +francismb

___
Python tracker 

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



[issue27803] ctypes automatic byref failing on custom classes attributes

2016-08-19 Thread Erwan Le Pape

New submission from Erwan Le Pape:

When using a custom class to store a ctype value, passing that class as a 
function argument explicitly declared to be a pointer type fails to pass the 
_as_parameter_ class attribute as a pointer and instead raises a TypeError.

For example:
>>> from ctypes import *
>>> from ctypes.wintypes import *
>>>
>>> class CustomPHKEY(object):
... def __init__(self, value):
... self._as_parameter_ = HKEY(value)
...
>>>
>>> function = windll.function
>>> function.argtypes = [POINTER(HKEY)]
>>> function.restype = LONG
>>> result = CustomPHKEY(0)
>>> function(result)
Traceback (most recent call last):
  File "", line 1, in 
ctypes.ArgumentError: argument 1: : expected 
LP_c_void_p instance instead of c_void_p

Shouldn't ctypes apply the required byref() conversion automatically? Or is 
this behavior normal and automatic byref() only concerns native ctypes types?

I only flagged Python 3.5 and Python 2.7 since they are the only ones I 
explicitly tested this on but I suspect other versions are affected.

--
components: ctypes
messages: 273149
nosy: amaury.forgeotdarc, belopolsky, lepaperwan, meador.inge
priority: normal
severity: normal
status: open
title: ctypes automatic byref failing on custom classes attributes
type: behavior
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue27800] Regular expressions with multiple repeat codes

2016-08-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This appears to be a doc issue to clarify that * cannot directly follow a 
repetition code.  I believe there have been other (non)bug reports like this 
before.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue27800] Regular expressions with multiple repeat codes

2016-08-19 Thread Matthew Barnett

Matthew Barnett added the comment:

"*" and the other quantifiers ("+", "?" and "{...}") operate on the preceding 
_item_, not the entire preceding expression. For example, "ab*" means "a" 
followed by zero or more repeats of "b".

You're not allowed to use multiple quantifiers together. The proper way is to 
use the non-capturing "(?:...)".

It's too late to change that because some of them already have a special 
meaning when used after another quantifier: "a*?" is a lazy quantifier, as are 
"a+?", "a??" and "a{1,4}?".

Many other regex implementations, including the "regex" module, use an 
additional "+" to signify a possessive quantifier: "a*+", "a++", "a?+" and 
"a{1,4}+".

That just leaves the additional "*", which is treated as an error in all the 
other regex implementations that I'm aware of.

--

___
Python tracker 

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



[issue27792] bool % int has inconsistent return type.

2016-08-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This can only happen because of a hole in the tests.  
test_bool.BoolTest.test_math appears to test every binary int op, including 
bitwise, *except* %.

After
self.assertIsNot(False/1, False)
add
self.assertEqual(False%1, 0)
self.assertIsNot(False%1, False)  # currently fails
self.assertEqual(True%1, 1)
self.assertIsNot(True%1, True)

test_int tests int() calls, not int math, so I don't know where the equivalent 
tests on int math with subclasses are or would go.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread David Hagen

David Hagen added the comment:

One solution similar to one proposed by Vedran works with the current Enum:

class Color(Enum):
red = object()
green = object()
blue= object()

I tested this in PyCharm and it is perfectly happy with the autocomplete and 
everything. The main disadvantage is the boilerplate, of course. And perhaps 
"object()" does not show the clearest intent, but it depends on your 
perspective. The repr also looks kind of funny:

>>>  repr(Color.red)
>

One possibility would be to add an auto() function to enum as a wrapper around 
object(), providing a more explicit name and a cleaner repr:

from enum import Enum, auto

class Color(Enum):
red = auto()
blue = auto()
green = auto()

repr(Color.red)

# auto() means it has no (meaningful) value, so show nothing

--

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3ab32f7add6e by Victor Stinner in branch 'default':
Issue #27128: _pickle uses fast call
https://hg.python.org/cpython/rev/3ab32f7add6e

--

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 73b00fb1dc9d by Victor Stinner in branch 'default':
Cleanup call_method() and call_maybe()
https://hg.python.org/cpython/rev/73b00fb1dc9d

New changeset 8e085070ab28 by Victor Stinner in branch 'default':
call_method() and call_maybe() now use fast call
https://hg.python.org/cpython/rev/8e085070ab28

New changeset 2d2bc1906b5b by Victor Stinner in branch 'default':
Issue #27128: Cleanup slot_sq_item()
https://hg.python.org/cpython/rev/2d2bc1906b5b

New changeset 6eb586b85fa1 by Victor Stinner in branch 'default':
Issue #27128: slot_sq_item() uses fast call
https://hg.python.org/cpython/rev/6eb586b85fa1

New changeset 605a42a50496 by Victor Stinner in branch 'default':
Issue #27128: Cleanup slot_nb_bool()
https://hg.python.org/cpython/rev/605a42a50496

New changeset 6a21b6599692 by Victor Stinner in branch 'default':
slot_nb_bool() now uses fast call
https://hg.python.org/cpython/rev/6a21b6599692

New changeset 45d2b5c12b19 by Victor Stinner in branch 'default':
slot_tp_iter() now uses fast call
https://hg.python.org/cpython/rev/45d2b5c12b19

New changeset 124d5d0ef81f by Victor Stinner in branch 'default':
calliter_iternext() now uses fast call
https://hg.python.org/cpython/rev/124d5d0ef81f

New changeset 71c22e592a9b by Victor Stinner in branch 'default':
keyobject_richcompare() now uses fast call
https://hg.python.org/cpython/rev/71c22e592a9b

--

___
Python tracker 

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



[issue27126] Apple-supplied libsqlite3 on OS X is not fork safe; can cause crashes

2016-08-19 Thread Chris Jerdonek

Chris Jerdonek added the comment:

FWIW, I just came across an issue in Django's test suite that I believe is 
caused by the issue reported here. Some of Django's unit tests were hanging for 
me when run in "parallel" mode (which uses multiprocessing). Here is the ticket 
I filed there:
https://code.djangoproject.com/ticket/27086

--

___
Python tracker 

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



[issue27126] Apple-supplied libsqlite3 on OS X is not fork safe; can cause crashes

2016-08-19 Thread Chris Jerdonek

Changes by Chris Jerdonek :


--
nosy: +chris.jerdonek

___
Python tracker 

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



[issue27713] Spurious "platform dependent libraries" warnings when running make

2016-08-19 Thread Xiang Zhang

Xiang Zhang added the comment:

This is the design of getpath.c, when no exec/exec_prefix can be found it will 
emit warning and use the default one. Fortunately it gives use the ability to 
suppress the warnings. :) Simply set Py_FrozenFlag in _freeze_importlib.c can 
solve this problem. Upload a trivial patch to set the flag.

--
keywords: +patch
Added file: http://bugs.python.org/file44156/issue27713.patch

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2da6dc1c30d8 by Victor Stinner in branch 'default':
contains and rich compare slots use fast call
https://hg.python.org/cpython/rev/2da6dc1c30d8

New changeset 2d4d40da2aba by Victor Stinner in branch '3.5':
Fix a refleak in call_method()
https://hg.python.org/cpython/rev/2d4d40da2aba

New changeset 5b1ed48aedef by Victor Stinner in branch '2.7':
Fix a refleak in call_method()
https://hg.python.org/cpython/rev/5b1ed48aedef

New changeset df4efc23ab18 by Victor Stinner in branch '3.5':
Fix a refleak in call_maybe()
https://hg.python.org/cpython/rev/df4efc23ab18

New changeset 7669fb39a9ce by Victor Stinner in branch '2.7':
Fix a refleak in call_maybe()
https://hg.python.org/cpython/rev/7669fb39a9ce

--

___
Python tracker 

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



[issue27798] test_sysconfig: test_srcdir() fails on "x86 Gentoo Installed with X 3.x" buildbot

2016-08-19 Thread Zachary Ware

Zachary Ware added the comment:

This appears to be a duplicate of #23968.

--
nosy: +zach.ware
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> rename the platform directory from plat-$(MACHDEP) to 
plat-$(PLATFORM_TRIPLET)
type:  -> behavior

___
Python tracker 

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



[issue27740] Fix doc of Py_CompileStringExFlags

2016-08-19 Thread Xiang Zhang

Xiang Zhang added the comment:

> filename is going to be decoded inside of Py_CompileStringExFlags

Actually all I want to express is this, *filename* will be decoded inside. But 
now the wording looks to me is that *filename* is already a decoded string when 
passed. I don't want to document anything about PyUnicode_EncodeFSDefault. I 
should remove (:func:`os.fsdecode`). How do you think? I'm Okay if you think 
the current wording is correct.

--

___
Python tracker 

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



[issue27740] Fix doc of Py_CompileStringExFlags

2016-08-19 Thread Berker Peksag

Berker Peksag added the comment:

I don't understand the second part of the patch.

*filename* is a filesystem encoding (:func:`os.fsdecode`) encoded string 
[...]

Do you want to document that filename should be encoded by using 
PyUnicode_EncodeFSDefault *before* passing it to Py_CompileStringExFlags (you 
will probably need to wrap it with something like PyBytes_AsString too)? If so, 
I think the os.fsdecode() part needs to be changed to os.fsencode().

I think the current wording is saying that filename is going to be decoded 
inside of Py_CompileStringExFlags (which is also correct.)

--
nosy: +berker.peksag, haypo
stage:  -> patch review
versions: +Python 3.5

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a1a29d20f52d by Victor Stinner in branch 'default':
Add _PyObject_FastCall()
https://hg.python.org/cpython/rev/a1a29d20f52d

New changeset 89e4ad001f3d by Victor Stinner in branch 'default':
PyEval_CallObjectWithKeywords() uses fast call
https://hg.python.org/cpython/rev/89e4ad001f3d

New changeset 7cd479573de9 by Victor Stinner in branch 'default':
call_function_tail() uses fast call
https://hg.python.org/cpython/rev/7cd479573de9

New changeset 34af2edface9 by Victor Stinner in branch 'default':
Cleanup call_function_tail()
https://hg.python.org/cpython/rev/34af2edface9

New changeset adceb14cab96 by Victor Stinner in branch 'default':
Cleanup callmethod()
https://hg.python.org/cpython/rev/adceb14cab96

New changeset 10f1a4910adb by Victor Stinner in branch 'default':
PEP 7: add {...} around null_error() in abstract.c
https://hg.python.org/cpython/rev/10f1a4910adb

New changeset 5cf9524f2923 by Victor Stinner in branch 'default':
Avoid call_function_tail() for empty format str
https://hg.python.org/cpython/rev/5cf9524f2923

New changeset f1ad6f64a11e by Victor Stinner in branch 'default':
Fix PyObject_Call() parameter names
https://hg.python.org/cpython/rev/f1ad6f64a11e

--

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread R. David Murray

R. David Murray added the comment:

I was wondering the same thing recently, thanks for opening this issue.  

Here is my use case: I'm implementing a PersistentList, and I want it to be 
equal to a 'real' list, but not equal to a tuple.  Frankly, I hadn't thought 
about the latter problem before this issue, so my __eq__ code in my concrete 
class is currently broken.  I'll need to explicitly check for list subclasses 
and PersistentList subclasses.  I'm not sure there's any way to "generalize" 
that.  I presume that's why Sequence doesn't have the methods.  

The answer would seem to be to have explicit 'List' and 'Tuple' abcs.

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Kenneth Reitz

Kenneth Reitz added the comment:

There's a difference between boiler-plate and "code".

> On Aug 19, 2016, at 10:53 AM, Ethan Furman  wrote:
> 
> 
> Ethan Furman added the comment:
> 
> No magic, but a whole heap of extra boiler-plate.  :(
> 
> --
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue27801] test_update_lines_cols from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Berker Peksag

Changes by Berker Peksag :


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

___
Python tracker 

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



[issue27800] Regular expressions with multiple repeat codes

2016-08-19 Thread R. David Murray

R. David Murray added the comment:

It seems perfectly logical and consistent to me.  {4} is a repeat count, as is 
*.  You get the same error if you do 'a?*', and the same bypass if you do 
'(a?)*' (though I haven't tested if that does anything useful :).  You don't 
need the ?:, as far as I can tell, you just need to have the * modifying a 
group, making the group the "preceding regular expression".

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



[issue27801] test_update_lines_cols from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 51368991e858 by Berker Peksag in branch '3.5':
Issue #27801: Skip test_update_lines_cols when update_lines_cols() is not 
available
https://hg.python.org/cpython/rev/51368991e858

New changeset bd9183850965 by Berker Peksag in branch 'default':
Issue #27801: Merge from 3.5
https://hg.python.org/cpython/rev/bd9183850965

--
nosy: +python-dev

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Ethan Furman

Ethan Furman added the comment:

No magic, but a whole heap of extra boiler-plate.  :(

--

___
Python tracker 

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



[issue27740] Fix doc of Py_CompileStringExFlags

2016-08-19 Thread Xiang Zhang

Xiang Zhang added the comment:

Ping.

--

___
Python tracker 

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



[issue27801] test_update_lines_cols from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Xiang Zhang

Xiang Zhang added the comment:

Yes. update_lines_cols is not always available. We can just treat it like other 
methods like resize_term.

Upload a trivial patch to fix this.

--
keywords: +patch
nosy: +xiang.zhang
Added file: http://bugs.python.org/file44155/issue27801.patch

___
Python tracker 

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



[issue22021] shutil.make_archive() root_dir do not work

2016-08-19 Thread R. David Murray

R. David Murray added the comment:

"base_name is the name of the file to create, including the path".  So you 
should be able to specify the path to where you want it created.  If that 
doesn't work, that's a bug.

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Hey, I just realized that you can get pretty darn close with just a little bit
of extra typing, and existing stdlib:

from enum import Enum
from itertools import count

auto = count()

class Color(Enum):
red = next(auto)
green = next(auto)
blue = next(auto)

Look ma, no magic!

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Ethan Furman

Ethan Furman added the comment:

Vedran, you have some very interesting points.  However, if you really want to 
champion this you'll need to take it to Python Ideas.

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Vedran Čačić

Vedran Čačić added the comment:

> For me, it's legit to use a singleton in an enum.

But you cannot explain _why_, right? Like Raymond says, it's not working like 
anything else in Python works.

To me, this looks almost the same as the gripes of those lazy people who want 
"myfile.close" expression to close myfile, or worse, "quit" to exit the Python 
interpreter. An irrational phobia of parentheses. Why not call your object, if 
you expect some code to be executed? [At least a dotted name like myfile.close 
_could_ be made to work using descriptors, but still I think everyone agrees 
it's not a good idea.]

To me, we either want to stay with default type metaclass 
(`style='imperative'`:), and write something like

class Color(Enum):
green = member()
yellow = member()

or we acknowledge that `style='declarative'` has its place under the sun (not 
only for Enums, of course... database models, namedtuples, even ABCs could 
profit from it), and embrace its full power, realizing it's not Python we 
usually see, but it's still Python.

Magic is not something to be afraid of, if you understand it. We are talking 
Py3.6 here... aren't formatted strings a totally insane magic? Yet they ended 
up in the language, because they are immensely better than the alternatives. 
Here the gain is much smaller, but the threshold is much lower too: we don't 
need new syntax at all.

--

___
Python tracker 

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



[issue27801] test_update_lines_cols from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report! update_lines_cols() was added in 132b5376bf34. I guess 
we should just skip the test if update_lines_cols() is not available.

--
nosy: +berker.peksag
stage:  -> needs patch
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



[issue27080] Implement the formatting part of PEP 515, '_' in numeric literals.

2016-08-19 Thread Chris Angelico

Chris Angelico added the comment:

Hmm, strange. Comma formatting never seems to have had tests added. So I've 
added a couple of simple tests of comma formatting at the same time as adding 
underscore formatting tests. Also, test_long.py currently has a comment "# 
octal" preceding a bunch of tests of *binary* formatting, and no tests of 
octal. So I've added those too.

In any case, here's a patch with full functionality and tests.

--
Added file: http://bugs.python.org/file44154/underscores_with_tests.patch

___
Python tracker 

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



[issue27792] bool % int has inconsistent return type.

2016-08-19 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Neil Girdhar

Neil Girdhar added the comment:

(there's already an open thread.)

--

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Neil Girdhar

Neil Girdhar added the comment:

That's a really good point.  Perhaps bring it up on ideas so that it can be 
discussed by more people?  I don't know what the answer is.

--

___
Python tracker 

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



[issue27080] Implement the formatting part of PEP 515, '_' in numeric literals.

2016-08-19 Thread Chris Angelico

Chris Angelico added the comment:

Hmm, adding bin/oct/hex support didn't turn out that hard. Although it feels 
like this code is getting hackish. Definitely needs code review!

--
Added file: http://bugs.python.org/file44153/underscores_all_bases.patch

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Martin Panter

Martin Panter added the comment:

Your implementation looks like it will make a Sequence equal to a list and a 
tuple, even though lists and tuples are never equal to each other.

--
nosy: +martin.panter
type:  -> enhancement

___
Python tracker 

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



[issue27598] Add Collection to collections.abc and typing

2016-08-19 Thread Neil Girdhar

Changes by Neil Girdhar :


--
title: Add SizedIterable to collections.abc and typing -> Add Collection to 
collections.abc and typing

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

2016-08-19 14:19 GMT+02:00 Vedran Čačić :
> In fact, what _is_ explicit, is this:
>
> class Color(metaclass=Enum):
> green = object()
> yellow = object()
>
> I could live with it. :-)

For me, it's legit to use a singleton in an enum. I mean that I expect
that green != yellow. Some remark for an empty tuple.

So I woud really prefer a contant from enum like AUTO_ENUM.

--

___
Python tracker 

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



[issue27080] Implement the formatting part of PEP 515, '_' in numeric literals.

2016-08-19 Thread Chris Angelico

Changes by Chris Angelico :


--
nosy: +Rosuav

___
Python tracker 

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



[issue27080] Implement the formatting part of PEP 515, '_' in numeric literals.

2016-08-19 Thread Chris Angelico

Chris Angelico added the comment:

Here's a first-cut patch. No docs, no tests, and applies only to decimal 
formatting. It involves redefining the thousands_separators flag from being a 
boolean to being a three-state flag (none, comma, or underscore), and (ab)uses 
LT_*_LOCALE to carry that same information around.

--
keywords: +patch
Added file: http://bugs.python.org/file44152/underscores_decimal_only.patch

___
Python tracker 

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



[issue27598] Add SizedIterable to collections.abc and typing

2016-08-19 Thread Neil Girdhar

Neil Girdhar added the comment:

Given issue http://bugs.python.org/issue27802, it might be worth considering 
that all Collections implement __eq__ and __ne__, so maybe these should be 
abstract methods on Collection?

--

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Neil Girdhar

Changes by Neil Girdhar :


--
keywords: +patch
Added file: http://bugs.python.org/file44151/abc_eq.diff

___
Python tracker 

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



[issue25144] 3.5 Win install fails with "TARGETDIR"

2016-08-19 Thread Jagannath Basu

Jagannath Basu added the comment:

I ran the python-3.5.2.exe file as administrator (right click > Run as Admin) 
and then followed the custom installation to set up target directory. It got 
installed without further complaints.

--
nosy: +basuj81

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Neil Girdhar

Changes by Neil Girdhar :


--
components: +Library (Lib)
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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Neil Girdhar

New submission from Neil Girdhar:

Both Mapping and Set provide __eq__ and __ne__.  Why not have Sequence do the 
same?

--
messages: 273114
nosy: neil.g
priority: normal
severity: normal
status: open
title: Add __eq__ and __ne__ to collections.abc.Sequence.

___
Python tracker 

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



[issue27801] test_update_lines_cols from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Dwayne Crooks

Changes by Dwayne Crooks :


--
title: test_update_lines_cols fails from test.test_curses.MiscTests fails on 
Ubuntu 14.04 LTS -> test_update_lines_cols from test.test_curses.MiscTests 
fails on Ubuntu 14.04 LTS

___
Python tracker 

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



[issue27801] test_update_lines_cols fails from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Dwayne Crooks

New submission from Dwayne Crooks:

I was installing Python 3.5.2 from source on a Ubuntu 14.04 LTS virtual machine 
(it uses 
https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/20160816.0.0).

This is part of the result of running: ./python -m test -u curses -v test_curses

==
ERROR: test_update_lines_cols (test.test_curses.MiscTests)
--
Traceback (most recent call last):
  File "/tmp/Python-3.5.2/Lib/test/test_curses.py", line 397, in 
test_update_lines_cols
curses.update_lines_cols()
AttributeError: module 'curses' has no attribute 'update_lines_cols'

--
Ran 20 tests in 0.237s

FAILED (errors=1, skipped=4)

--
components: Tests
messages: 273113
nosy: dwaynecrooks
priority: normal
severity: normal
status: open
title: test_update_lines_cols fails from test.test_curses.MiscTests fails on 
Ubuntu 14.04 LTS
versions: Python 3.5

___
Python tracker 

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



[issue27776] PEP 524: Make os.urandom() blocking on Linux

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

> _PyOS_URandomNonblock() *can* fail is /dev/urandom is missing or not readable

Oh. It looks like Python initialization currently fails with a fatal error in 
this case, see _PyRandom_Init().

Maybe we should also fall back on clocks/pid in _PyRandom_Init()?

--

___
Python tracker 

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



[issue27797] ASCII file with UNIX line conventions and enough lines throws SyntaxError when ASCII-compatible codec is declared

2016-08-19 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue27776] PEP 524: Make os.urandom() blocking on Linux

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

Enhanced patch to address Nick's comments and fix mistakes. The new patch now 
also updates the documentation.

I restored the code in _random.Random.seed() to fallback on the system clock: 
_PyOS_URandomNonblock() *can* fail is /dev/urandom is missing or not readable. 
I enhanced this part to not only read the system clock, but also use the 
current process identifier and get also the monotonic clock. Moreover, 64 bits 
are now used instead of 32 bits from the system clock (use a resolution of 1 
nanoscond, not only 1 second).

I didn't test yet the fall back on clocks/pid. It should be tested manually by 
modifying _PyOS_URandomNonblock() to always fail.

--
Added file: http://bugs.python.org/file44150/urandom_nonblock-2.patch

___
Python tracker 

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



[issue27797] ASCII file with UNIX line conventions and enough lines throws SyntaxError when ASCII-compatible codec is declared

2016-08-19 Thread Eryk Sun

Eryk Sun added the comment:

In issue 20844 I suggested opening the file in binary mode, i.e. change the 
call to _Py_wfopen(filename, L"rb") in Modules/main.c. That would also entail 
documenting that PyRun_SimpleFileExFlags requires a FILE pointer that's opened 
in binary mode. After making this change, there's no problem parsing 
"encoding-problem-cp1252.py":

>python --version
Python 3.6.0a4+

>python encoding-problem-cp1252.py
ok

When fp_setreadl is called while parsing "encoding-problem-cp1252.py", 47 bytes 
in the FILE buffer have been read -- up to the end of the coding spec. Let's 
verify this in the debugger:

0:000> bp python35_d!fp_setreadl
0:000> g
Breakpoint 0 hit
python35_d!fp_setreadl:
`662bee00 4889542410  mov qword ptr [rsp+10h],rdx
ss:00d7`6cfeead8=00d76cfeeaf8
0:000> ;as /x fp @@(((python35_d!tok_state *)@rcx)->fp)
0:000> ;as /x ptr @@(((ucrtbased!__crt_stdio_stream_data *)${fp})->_ptr)
0:000> ;as /x base @@(((ucrtbased!__crt_stdio_stream_data *)${fp})->_base)
0:000> ?? ${ptr} - ${base}
int64 0n47

ftell() should return 47, but instead it returns -1. You can see this by 
opening the file in Python 2 on Windows, which uses FILE streams:

>>> f = open('encoding-problem-cp1252.py')
>>> f.read(47)
'#!/usr/bin/env python\n# -*- coding: cp1252 -*-\n'
>>> f.tell()
Traceback (most recent call last):
  File "", line 1, in 
IOError: [Errno 0] Error

ftell starts by getting the file position from the OS and then subtracts the 
unread bytes in the buffer. The buffer has already undergone CRLF => LF 
translation, so ftell makes an assumption that the file uses CRLF line endings 
and thus subtracts 2 bytes for each unread LF. In this case the buffer happens 
to have 48 unread LFs, so ftell returns -1, with the only actual error being a 
fundamentally flawed design in the CRT's text mode.

--
nosy: +eryksun

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Vedran Čačić

Vedran Čačić added the comment:

Absolutely. How the hell is `green = None` explicit?!

On the other hand, `class Color(Enum, style='declarative'):` is explicit. 
People must learn something. Why then don't they learn the right thing instead 
of "hey, assigning None inside enums magically does the right thing" - except 
when it doesn't.

Just a hint of a nightmare scenario: you write a method decorator, but you 
forget to return a value from it (happened to me more times than I care to 
admit). Ooops, your method is now next member of your enum. Good luck debugging 
that. :-O

In fact, what _is_ explicit, is this:

class Color(metaclass=Enum):
green = object()
yellow = object()

I could live with it. :-)

--

___
Python tracker 

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



[issue20132] Many incremental codecs don’t handle fragmented data

2016-08-19 Thread Martin Panter

Martin Panter added the comment:

Split off Issue 27799 for the base-64 incremental decoder

--
dependencies: +Fix base64-codec and bz2-codec incremental decoders

___
Python tracker 

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



[issue27800] Regular expressions with multiple repeat codes

2016-08-19 Thread Martin Panter

New submission from Martin Panter:

In the documentation for the “re” module, it says repetition codes like {4} and 
“*” operate on the preceding regular expression. But even though “a{4}” is a 
valid expression, the obvious way to apply a “*” repetition to it fails:

>>> re.compile("a{4}*")
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/proj/python/cpython/Lib/re.py", line 223, in compile
return _compile(pattern, flags)
  File "/home/proj/python/cpython/Lib/re.py", line 292, in _compile
p = sre_compile.compile(pattern, flags)
  File "/home/proj/python/cpython/Lib/sre_compile.py", line 555, in compile
p = sre_parse.parse(p, flags)
  File "/home/proj/python/cpython/Lib/sre_parse.py", line 792, in parse
p = _parse_sub(source, pattern, 0)
  File "/home/proj/python/cpython/Lib/sre_parse.py", line 406, in _parse_sub
itemsappend(_parse(source, state))
  File "/home/proj/python/cpython/Lib/sre_parse.py", line 610, in _parse
source.tell() - here + len(this))
sre_constants.error: multiple repeat at position 4

As a workaround, I found I can wrap the inner repetition in (?:. . .):

>>> re.compile("(?:a{4})*")
re.compile('(?:a{4})*')

The problems with the workaround are (a) it is far from obvious, and (b) it 
adds more complicated syntax. Either this limitation should be documented, or 
if there is no good reason for it, it should be lifted. It is not clear if my 
workaround is entirely valid, or if I just found a way to bypass some sanity 
check.

My original use case was scanning a base-64 encoding for Issue 27799:

# Without the second level of brackets, this raises a "multiple repeat" error
chunk_re = br'(?: (?: [^A-Za-z0-9+/=]* [A-Za-z0-9+/=] ){4} )*'

--
components: Regular Expressions
messages: 273107
nosy: ezio.melotti, martin.panter, mrabarnett
priority: normal
severity: normal
status: open
title: Regular expressions with multiple repeat codes
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



  1   2   >