[issue20998] fullmatch isn't matching correctly under re.IGNORECASE
New submission from Nathan West: I have the following regular expression: In [2]: regex = re.compile("ME IS \w+", re.I) For some reason, when using `fullmatch`, it doesn't match substrings longer than 1 for the '\w+': In [3]: regex.fullmatch("ME IS L") Out[3]: <_sre.SRE_Match object; span=(0, 7), match='ME IS L'> In [4]: regex.fullmatch("me is l") Out[4]: <_sre.SRE_Match object; span=(0, 7), match='me is l'> In [5]: regex.fullmatch("ME IS Lucretiel") In [6]: regex.fullmatch("me is lucretiel") I have no idea why this is happening. Using `match` works fine: In [7]: regex.match("ME IS L") Out[7]: <_sre.SRE_Match object; span=(0, 7), match='ME IS L'> In [8]: regex.match("ME IS Lucretiel") Out[8]: <_sre.SRE_Match object; span=(0, 15), match='ME IS Lucretiel'> In [9]: regex.match("me is lucretiel") Out[9]: <_sre.SRE_Match object; span=(0, 15), match='me is lucretiel'> Additionally, using `fullmatch` WITHOUT using the `re.I` flag causes it to work: In [10]: regex = re.compile("ME IS \w+") In [11]: regex.fullmatch("ME IS L") Out[11]: <_sre.SRE_Match object; span=(0, 7), match='ME IS L'> In [12]: regex.fullmatch("ME IS Lucretiel") Out[12]: <_sre.SRE_Match object; span=(0, 15), match='ME IS Lucretiel'> My platform is Ubuntu 12.04, using Python 3.4 installed from Felix Krull's deadsnakes PPA (https://launchpad.net/~fkrull/+archive/deadsnakes). -- components: Regular Expressions messages: 214257 nosy: Lucretiel, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: fullmatch isn't matching correctly under re.IGNORECASE versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue20998> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20998] fullmatch isn't matching correctly under re.IGNORECASE
Changes by Nathan West : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue20998> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23653] Make inspect._empty test to False
Nathan West added the comment: Doesn't the same issue exist for all other uses of the idiom, though? Python provides container "truthiness" even though `len(x) == 0` is more "correct." On Fri, Jun 5, 2015, 3:20 PM Yury Selivanov wrote: > > Yury Selivanov added the comment: > > Nathan, consider the following signature: > > def foo(a=0:''): pass > > now, sig.parameters['a'].annotation will be '' and .default will be 0, and > they will fail 'if param.annotation or param.default' check. That's why we > encourage checks like 'if param.annotation is not param.empty'. > > Closing this issue. > > -- > assignee: -> yselivanov > nosy: +yselivanov > resolution: -> rejected > status: open -> closed > > ___ > Python tracker > <http://bugs.python.org/issue23653> > ___ > -- ___ Python tracker <http://bugs.python.org/issue23653> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25671] Fix venv activate.fish to maintain $status
New submission from Nathan West: Many fish_prompts use display the $status (fish's equivalent to $?) somewhere in the prompt. Currently, venv's activate.fish overwrites and wraps the user's fish_prompt, the wrapping doesn't preserve this $status. This patch ensures that the $status is correctly restored before invoking the user's fish_prompt. This is based on my similar work in virtualenv, at https://github.com/pypa/virtualenv/pull/799 -- components: Library (Lib) files: patch.diff keywords: patch messages: 254906 nosy: Lucretiel priority: normal severity: normal status: open title: Fix venv activate.fish to maintain $status type: enhancement versions: Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file41079/patch.diff ___ Python tracker <http://bugs.python.org/issue25671> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25671] Fix venv activate.fish to maintain $status
Nathan West added the comment: Fixed an issue where fish_prompt was returning before calling _old_fish_prompt -- Added file: http://bugs.python.org/file41103/patch.diff ___ Python tracker <http://bugs.python.org/issue25671> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25671] Fix venv activate.fish to maintain $status
Nathan West added the comment: Not quite, no. The issue looks like this: user@host ~/test> python3 -mvenv env user@host ~/test> true user@host ~/test> false user@host ~/test [1]> source env/bin/activate.fish (env) user@host ~/test> true (env) user@host ~/test> false (env) user@host ~/test> deactivate user@host ~/test> true user@host ~/test> false user@host ~/test [1]> Notice that, after running the `false` command the first time, the command prompt includes a "[1]", indicating the exit status of the `false` command. However, after activating the virtual environment, the command prompt no longer shows the error code from the `false` command. After deactivating the virtualenv, the command prompt once again displays the error code from `false`. -- ___ Python tracker <http://bugs.python.org/issue25671> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23651] Typo in argparse allow_abrev
New submission from Nathan West: The documentation for the new argparse feature allow_abrev contains a typo: >>> parser.add_argument('--foobar', action='store_true') >>> parser.add_argument('--foonley', action='store_false') >>> parser.parse_args([--foon]) usage: PROG [-h] [--foobar] [--foonley] PROG: error: unrecognized arguments: --foon The --foon should be quoted: >>> parser.parse_args(['--foon']) -- assignee: docs@python components: Documentation messages: 237971 nosy: Lucretiel, docs@python priority: normal severity: normal status: open title: Typo in argparse allow_abrev versions: Python 3.5 ___ Python tracker <http://bugs.python.org/issue23651> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23653] Make inspect._empty test to False
New submission from Nathan West: A common Python idiom is to test objects by value in an if. This includes container emptiness and regular expression matches, or using 'or' to specify a default value: if my_list: # list isn't empty if regex.match(string): # string matched the regex my_list = arg or [1,2,3] It'd be nice if we could use this idiom with inspect.Signature._empty or inspect.Parameter.empty: sig = signature(func) for param in sig.parameters.values(): if param.annotation: ... or, to use a the example that motivated this idea: def arg_type(param): return param.annotation or str The only issue I can think of is that, if an annotation or default value is some False value, like None, than the test will fail even if the value isn't _empty. However, this issue already exists for other uses of this idiom, and I think this is a perfect extension of the form. -- components: Library (Lib) messages: 237987 nosy: Lucretiel priority: normal severity: normal status: open title: Make inspect._empty test to False type: enhancement versions: Python 3.5 ___ Python tracker <http://bugs.python.org/issue23653> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com