This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author slomo
Recipients ezio.melotti, mrabarnett, slomo
Date 2020-02-19.11:40:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582112424.4.0.996005066696.issue39687@roundup.psfhosted.org>
In-reply-to
Content
On different platforms and versions the following expression has different results:

  python -c 'import re; print(re.compile("(.*)", 0).sub("a\\1", "bc"))'

As far is I observed:

  Linux/Python 3.6.9   => abc
  MacOS/Python 3.7.1   => abca
  Repl.it/Python 3.8.1 => abca
  MacOS/Python 2.7.17  => abc
  Linux/Python 2.7.17  => abc

According the the documentation I would guess that "abc" is the correct return value.

The issues also occurs without compiling or capture group:

 re.sub(".*", "a", "cb")  a vs aa
History
Date User Action Args
2020-02-19 11:40:24slomosetrecipients: + slomo, ezio.melotti, mrabarnett
2020-02-19 11:40:24slomosetmessageid: <1582112424.4.0.996005066696.issue39687@roundup.psfhosted.org>
2020-02-19 11:40:24slomolinkissue39687 messages
2020-02-19 11:40:24slomocreate