[issue42668] re.escape does not correctly escape newlines
Martin Altmayer added the comment: Thanks for the explanation, I did not know re.VERBOSE. I still think the behavior is a bit confusing, but it's probably not worth the effort to change this. -- type: behavior -> enhancement ___ Python tracker <https://bugs.python.org/issue42668> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42668] re.escape does not correctly escape newlines
New submission from Martin Altmayer : re.escape('\n') returns '\\\n', i.e. a string consisting of a backslash and a newline. I believe it should return '\\n', i.e. a backslash and an 'n'. If the escape-result still contains a verbatim newline, why escape this character at all? Note that Python's regular expressions engine allows newlines, so re.match(re.escape('\n'), '\n') gives a match. Thus, while this looks like an undesired behavior, it is not functionally broken. The same problem applies to some other characters: \t\r\v\f -- components: Regular Expressions files: test.py messages: 383237 nosy: MartinAltmayer, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: re.escape does not correctly escape newlines type: behavior versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 Added file: https://bugs.python.org/file49689/test.py ___ Python tracker <https://bugs.python.org/issue42668> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33649] asyncio docs overhaul
Change by Martin Altmayer : -- nosy: +MartinAltmayer ___ Python tracker <https://bugs.python.org/issue33649> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34263] asyncio: "relative *delay* or absolute *when* should not exceed one day"
Martin Altmayer added the comment: Added a small PR. Shall we update the doc? With this PR there is no reason anymore to disallow timeouts greater than one day in asyncio. Greetings from the sprints @ Edinburgh! -- nosy: +MartinAltmayer ___ Python tracker <https://bugs.python.org/issue34263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34263] asyncio: "relative *delay* or absolute *when* should not exceed one day"
Change by Martin Altmayer : -- keywords: +patch pull_requests: +8048 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26923] asyncio.gather drops cancellation
Martin Altmayer added the comment: I don't think this is a mere documentation problem: If a future cannot be cancelled because it is already done, cancel must return False. As Johannes' example demonstrates, a wrong return value from cancel might lead to a cancelled task being continued as if nothing happened: If Task.cancel receives a false positive from its _fut_waiter, it will not throw a CancelledError into the task (_must_cancel=True), but simply continue the task. -- nosy: +MartinAltmayer ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26923> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7429] PrettyPrinter cannot print dicts with unsortable keys
New submission from Martin Altmayer martin.altma...@web.de: In the following code I use a class for dictionary-keys that has a __hash__-function but cannot be ordered and try to print that dictionary with a PrettyPrinter. import pprint pp = pprint.PrettyPrinter() # A class that supports hashing and comparison for equality but cannot be ordered class KeyClass: def __init__(self,id): self.id = id def __eq__(self,other): return self.id == other.id def __ne__(self,other): return self.id != other.id def __hash__(self): return self.id dictionary = dict.fromkeys([KeyClass(i) for i in range(10)]) pp.pprint(dictionary) The script crashes with the following errors: Traceback (most recent call last): File /usr/local/lib/python3.1/pprint.py, line 272, in _safe_repr items = sorted(items) TypeError: unorderable types: KeyClass() KeyClass() During handling of the above exception, another exception occurred: Traceback (most recent call last): File bug.py, line 20, in module pp.pprint(dictionary) File /usr/local/lib/python3.1/pprint.py, line 106, in pprint self._format(object, self._stream, 0, 0, {}, 0) File /usr/local/lib/python3.1/pprint.py, line 129, in _format rep = self._repr(object, context, level - 1) File /usr/local/lib/python3.1/pprint.py, line 216, in _repr self._depth, level) File /usr/local/lib/python3.1/pprint.py, line 228, in format return _safe_repr(object, context, maxlevels, level) File /usr/local/lib/python3.1/pprint.py, line 277, in _safe_repr items = sorted(items, key=sortkey) TypeError: unorderable types: KeyClass() KeyClass() -- components: None messages: 95939 nosy: maranos severity: normal status: open title: PrettyPrinter cannot print dicts with unsortable keys versions: Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7429 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com