[issue14902] test_logging failed

2012-07-01 Thread Juancarlo Añez
Juancarlo Añez apal...@gmail.com added the comment: My local timezone is (VET,VET) == time.tzname, and test_logging fails because time.timezone is off by 30 minutes. I couldn't find the cause for the problem with time.timezone, but logging is not to blame. I'm running the tests on Ubuntu

[issue14902] test_logging failed

2012-07-03 Thread Juancarlo Añez
Juancarlo Añez apal...@gmail.com added the comment: @Vinay The test *is* broken in theory, because it uses today's time.timezone to make calculations over a datetime in the past (1993), even when official time zones have changes in recent years for Caracas, Moscow, and others: http

[issue14902] test_logging failed

2012-07-03 Thread Juancarlo Añez
Juancarlo Añez apal...@gmail.com added the comment: And datetime.datetime.now().tzinfo is always None. I can reproduce that. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14902

[issue14902] test_logging failed

2012-07-03 Thread Juancarlo Añez
Juancarlo Añez apal...@gmail.com added the comment: I did extensive testing on time.timezone, and it is correct as far as the current date is concerned. The problem, as mentioned before, is that test_logging is using time.timezone for dates in the past for which the time zone may have been

[issue14902] test_logging failed

2012-07-03 Thread Juancarlo Añez
Juancarlo Añez apal...@gmail.com added the comment: @Vinay No reason. datetime.astimezone(None) is documented in 3.3. You may even use: r.created = time.mktime(dt.astimezone().timetuple()) -- ___ Python tracker rep...@bugs.python.org http

[issue14902] test_logging failed

2012-07-03 Thread Juancarlo Añez
Changes by Juancarlo Añez apal...@gmail.com: -- type: compile error - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14902 ___ ___ Python

[issue15247] io.open() is inconsistent re os.open()

2012-07-03 Thread Juancarlo Añez
New submission from Juancarlo Añez apal...@gmail.com: import io d = io.open('.') Traceback (most recent call last): File stdin, line 1, in module IsADirectoryError: [Errno 21] Is a directory: '.' import os d = io.open(os.open('.',0)) d _io.TextIOWrapper name=3 mode='r' encoding='UTF-8

[issue15247] io.open() is inconsistent re os.open()

2012-07-03 Thread Juancarlo Añez
Juancarlo Añez apal...@gmail.com added the comment: io.open() clearly doesn't care about opening directories as long as they are passed as os.open() file descriptors. Quite unexpected! -- ___ Python tracker rep...@bugs.python.org http

[issue15247] io.open() is inconsistent re os.open()

2012-07-04 Thread Juancarlo Añez
Juancarlo Añez apal...@gmail.com added the comment: Note that attempting subsequent operations on the returned object do raise IsADirectoryError. import io import os d = io.open(os.open('.',0)) d.read() Traceback (most recent call last): File stdin, line 1, in module IsADirectoryError

[issue15558] webbrowser output to console

2012-08-04 Thread Juancarlo Añez
New submission from Juancarlo Añez: Under Ubuntu Linux 11.10 and 12.04, webbroser.open() will output the following message to the console: Created new window in existing browser session. The behavior is both unexpected and troublesome. -- components: Library (Lib) messages: 167443

[issue15618] turtle.pencolor() chokes on unicode

2012-08-10 Thread Juancarlo Añez
New submission from Juancarlo Añez: t.pencolor(u'red') Traceback (most recent call last): File stdin, line 1, in module File string, line 1, in pencolor File /usr/lib/python2.7/lib-tk/turtle.py, line 2166, in pencolor color = self._colorstr(args) File /usr/lib/python2.7/lib-tk

[issue15618] turtle.pencolor() chokes on unicode

2012-08-10 Thread Juancarlo Añez
Juancarlo Añez added the comment: This patch solves the problem by making turtle check for string against basestring insted of str. -- keywords: +patch Added file: http://bugs.python.org/file26758/turtle_unicode.patch ___ Python tracker rep

[issue15618] turtle.pencolor() chokes on unicode

2012-08-10 Thread Juancarlo Añez
Juancarlo Añez added the comment: The bug showed up in a script that used: from __future__ import unicode_literals -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15618

[issue15620] readline.clear_history() missing in test_readline.py

2012-08-10 Thread Juancarlo Añez
New submission from Juancarlo Añez: $ lsb_release -a LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch Distributor ID: Ubuntu Description:Ubuntu 12.04.1 LTS Release

[issue15620] readline.clear_history() missing in test_readline.py

2012-08-10 Thread Juancarlo Añez
Juancarlo Añez added the comment: $ dpkg -l | grep readline ii libreadline-dev 6.2-8 GNU readline and history libraries, development files ii libreadline55.2-11

[issue15620] readline.clear_history() missing in test_readline.py

2012-08-10 Thread Juancarlo Añez
Juancarlo Añez added the comment: Check if clear_history() is available before calling it. -- keywords: +patch Added file: http://bugs.python.org/file26761/readline_clear_history_available.patch ___ Python tracker rep...@bugs.python.org http

[issue15620] readline.clear_history() missing in test_readline.py

2012-08-10 Thread Juancarlo Añez
Changes by Juancarlo Añez apal...@gmail.com: Removed file: http://bugs.python.org/file26761/readline_clear_history_available.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15620

[issue15620] readline.clear_history() missing in test_readline.py

2012-08-10 Thread Juancarlo Añez
Juancarlo Añez added the comment: Check if clear_history() is available before calling it. -- Added file: http://bugs.python.org/file26762/readline_clear_history_available.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2020-01-17 Thread Juancarlo Añez
Juancarlo Añez added the comment: The bottom problem, as I see it, is that, historically, `re.search()` returns `None` when there is no match, instead of returning a `Match` object that is consistent with "no match" (evaluates to `False`, etc.) The above seems too difficult to re

[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2020-01-17 Thread Juancarlo Añez
Juancarlo Añez added the comment: The analysis done by Terry bypasses the fact that `search(...)` returns `None` when there is no match, so indexing or calling methods in its result is not safe code. `findall()` returns an empty list when there is no match. `findalliter()` returns an empty

[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2020-01-04 Thread Juancarlo Añez
Juancarlo Añez added the comment: There's no way to assert that `findall(...)[0]` is efficient enough in most cases. It is easy to see that that it is risky in every case, as runtime may be exponential, and memory O(len(input)). A mistake in the regular expression may easily result in an out

[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2020-01-01 Thread Juancarlo Añez
Juancarlo Añez added the comment: The discussion on python-ideas favored the inclusion of `findfirst()`. At any rate, not having a generator version of `findall()` is an important omission. Another user's search of Github public repositories found that `findall(...)[0]` is prevalent. python

[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2019-12-30 Thread Juancarlo Añez
New submission from Juancarlo Añez : The problematic `findall(...)[0]` is a common anti-pattern in Python programs. The reason is lack of symmetry and completeness in the `re` module. The original proposal in `python-ideas` was to add `re.findfirst(pattern, string, flags=0, default=_mark

[issue17343] Add a version of str.split which returns an iterator

2021-02-26 Thread Juancarlo Añez
Juancarlo Añez added the comment: def isplit(text, sep=None, maxsplit=-1): """ A lowmemory-footprint version of: iter(text.split(sep, maxsplit)) Adapted from https://stackoverflow.com/a/9770397 """ if maxsplit == 0: yie