[issue41605] t = re.sub(".*", "*", src) has different ouput

2020-08-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
resolution:  -> not a bug
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



[issue41605] t = re.sub(".*", "*", src) has different ouput

2020-08-21 Thread Thomas Grainger


Thomas Grainger  added the comment:

seems like a dupe? https://bugs.python.org/issue32308

--
keywords: +patch
message_count: 3.0 -> 4.0
nosy: +graingert
nosy_count: 5.0 -> 6.0
pull_requests: +21050
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/4846

___
Python tracker 

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



[issue41605] t = re.sub(".*", "*", src) has different ouput

2020-08-21 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

in 3.6 t == '*', in 3.7 and later it is '**'.

To be honest I don't like the 3.7 behaviour, it is very surprising even if it 
is technically correct (the first '*' is from a match from the entire string, 
the second one is from an empty match at the end of the string). 

A workaround is to explicitly anchor the regular expression (for example by 
adding '^' to the start).

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue41605] t = re.sub(".*", "*", src) has different ouput

2020-08-21 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm suspicious that this differs per-OS. Please provide exact Python version 
information for each OS you list in your initial report.

I suspect what you're seeing is related to this change:

Changed in version 3.7: Empty matches for the pattern are replaced when 
adjacent to a previous non-empty match.

--
components: +Regular Expressions -2to3 (2.x to 3.x conversion tool)
nosy: +eric.smith, ezio.melotti, mrabarnett

___
Python tracker 

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



[issue41605] t = re.sub(".*", "*", src) has different ouput

2020-08-20 Thread soyoo


New submission from soyoo :

import re

src = "123"  # can be anything
t = re.sub(".*", "*", src)

"""
The output of 't' is different in python2 and python3;
When python version is python3, it's depend on OS version.

When python version is python2, it seem always output single '*'.
When python version is python3, and OS is Linux, it output single '*';
When python version is python3, and OS is Mac or windows, it output double '**'.
"""

--
components: 2to3 (2.x to 3.x conversion tool)
files: python3 on windows.png
messages: 375741
nosy: soyoo
priority: normal
severity: normal
status: open
title: t = re.sub(".*", "*", src) has different ouput
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file49418/python3 on windows.png

___
Python tracker 

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