[issue23251] mention in time.sleep() docs that it does not block other Python threads

2015-01-18 Thread Akira Li
Akira Li added the comment: Only if the behaviour was unintuitive (i.e. if it *didn't* release the GIL) would it make sense to document it. There is no intuitive interface, not even the nipple. It's all learned. [1] Yes, on consideration I agree with Antoine. That last sentence should

[issue23251] mention in time.sleep() docs that it does not block other Python threads

2015-01-16 Thread Akira Li
New submission from Akira Li: There is the corresponding StackOverflow question with 60K view time.sleep — sleeps thread or process? [1] The documentation patch is attached. [1] http://stackoverflow.com/questions/92928/time-sleep-sleeps-thread-or-process -- assignee: docs@python

[issue23251] mention in time.sleep() docs that it does not block other Python threads

2015-01-16 Thread Akira Li
Akira Li added the comment: I do not understand. Have you tried to look at the patch in Rietveld? The new content is highlighted in a darker green. It is clearly visible. I've tested on Chromium, Firefox, Safari. If I won't reflow then the first line will be longer than the recommended 80

[issue23251] mention in time.sleep() docs that it does not block other Python threads

2015-01-17 Thread Akira Li
Akira Li added the comment: I think it's superfluous to mention the GIL here, since it has no impact on the function. If GIL is not released then all Python code in other threads is effectively blocked. It is worth mentioning explicitly that it is guaranteed to be released during the sleep

[issue23251] mention in time.sleep() docs that it does not block other Python threads

2015-01-25 Thread Akira Li
Akira Li added the comment: I've removed mentioning of GIL and uploaded a new patch. -- Added file: http://bugs.python.org/file37850/docs-time.sleep-other-threads-are-not-blocked-2.diff ___ Python tracker rep...@bugs.python.org http

[issue23315] tempfile.mkdtemp fails with non-ascii paths on Python 2

2015-01-25 Thread Akira Li
New submission from Akira Li: Python 2.7.9 (default, Jan 25 2015, 13:41:30) [GCC 4.9.2] on linux2 Type help, copyright, credits or license for more information. import os, sys, tempfile d = u'\u20ac'.encode(sys.getfilesystemencoding()) # non-ascii if not os.path.isdir(d

[issue22799] wrong time.timezone

2015-01-28 Thread Akira Li
Akira Li added the comment: Isn't this a duplicate of #13466? In what way is it a duplicate? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22799

[issue22799] wrong time.timezone

2015-01-28 Thread Akira Li
Akira Li added the comment: I agree that time.timezone, time.altzone is not enough in the general case. Because UTC offset may be different at different dates for reasons unrelated to DST transitions therefore any solution that doesn't take into account a given date/time into account will fail

[issue22932] email.utils.formatdate uses unreliable time.timezone constant

2015-01-11 Thread Akira Li
Akira Li added the comment: @mitya57: Please, combine the code changes, tests, docs into a single rietveld-compatible patch (hg diff); read devguide and http://bugs.python.org/issue13963 Make sure review link appears on the right near the patch. Example: http://bugs.python.org/issue22798

[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2015-02-13 Thread Akira Li
Akira Li added the comment: As I've mentioned in http://bugs.python.org/issue22524#msg231703 os.walk size 7925376343, scandir.walk size 5534939617 -- NOT EQUAL! os.walk and scandir.walk do a different work here. I don't see that it is acknowledged so I assume the benchmark is not fixed

[issue10482] subprocess and deadlock avoidance

2015-03-22 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: -- nosy: +akira ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10482 ___ ___ Python-bugs-list mailing list

[issue23574] datetime: support leap seconds

2015-03-12 Thread Akira Li
Akira Li added the comment: POSIX timestamp doesn't count (literally) past/future leap seconds. It allows to find out that the timestamp 2**31-1 corresponds to 2038-01-19T03:14:07Z (UTC) regardless of how many leap seconds will occur before 2038: from datetime import datetime, timedelta

[issue1191964] add non-blocking read and write methods to subprocess.Popen

2015-03-25 Thread Akira Li
Akira Li added the comment: I'm going to be honest; seeing None being returned from a pipe read feels *really* broken to me. When I get None returned from an IO read operation, my first instinct is there can't be anything else coming, why else would it return None? It is how it is done

[issue21619] Cleaning up a subprocess with a broken pipe

2015-03-02 Thread Akira Li
Akira Li added the comment: On Windows behavior http://stackoverflow.com/questions/23688492/oserror-errno-22-invalid-argument-in-subprocess -- nosy: +akira ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21619

[issue23494] adding timedelta to datetime object is not timezone aware

2015-03-02 Thread Akira Li
Akira Li added the comment: pytz explicitly documents this case (crossing DST boundary). There is tz.normalize() method. the tzinfo object is responsible for handling daylight savings time. This looks like a bug in pytz. Are any of tzinfo methods even called during `before + timedelta

[issue23320] devguide should mention rules about paragraph reflow in the documentation

2015-01-25 Thread Akira Li
New submission from Akira Li: It is suggested in https://bugs.python.org/issue23251 that only a core Python developer may reflow paragraphs while submitting patches for the Python documentation. It should be codified in devguide: I haven't found the word *reflow* in it. -- components

[issue24842] Mention SimpleNamespace in namedtuple docs

2015-08-16 Thread Akira Li
Akira Li added the comment: People do have problems that SimpleNamespace can solve: - Why Python does not support record type i.e. mutable namedtuple [1] - Does Python have anonymous classes? [2] - How to create inline objects with properties in Python? [3] - python create object and add

[issue24881] _pyio checks that `os.name == 'win32'` instead of 'nt'

2015-08-21 Thread Akira Li
Akira Li added the comment: To make _pyio correspond to the C version I've added sys.platform in {'win32', 'cygwin'} condition. See the attached pyio_setmode.diff It is not clear why the absence of _setmode(fd, os.O_BINARY) is not detected by tests. (a) a corresponding test should

[issue19007] precise time.time() under Windows 8: use GetSystemTimePreciseAsFileTime

2015-07-20 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: -- nosy: +akira ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19007 ___ ___ Python-bugs-list mailing list

[issue25536] use sys.platform instead of os.name in asyncio docs consistently

2015-11-02 Thread Akira Li
New submission from Akira Li: asyncio code uses "sys.platform == 'win32'" to detect OS. asyncio docs use both os.name and sys.platform. As far as I can tell there is no *practical* difference between "os.name == 'nt" and "sys.platform == 'win32'" for choosing asy

[issue22798] time.mktime doesn't update time.tzname

2015-08-31 Thread Akira Li
Akira Li added the comment: The C code produces correct values according to the tz database. If TZ=Europe/Moscow then tzname={"MSK", "MSD"} at 2010-07-01 and tzname={"MSK", "MSK"} at 2015-07-01. Notice the difference! The code calls C mktime() w

[issue22798] time.mktime doesn't update time.tzname

2015-08-31 Thread Akira Li
Akira Li added the comment: > C mktime itself should not change timezone globals, but it may indirectly if > it calls tzset() and TZ changed between calls. You should have run the attached test_mktime_changes_tzname.c which demonstrates that (at least on some systems) C mktime *does*

[issue22798] time.mktime doesn't update time.tzname

2015-09-29 Thread Akira Li
Akira Li added the comment: > Would issue22798.diff patch address your issue? No. The issue is that C mktime() may update C tzname on some platforms but time.mktime() does not update time.tzname on these platforms while the time module docs suggest that it might be expected e.g.: M

[issue24773] Implement PEP 495 (Local Time Disambiguation)

2015-09-29 Thread Akira Li
Changes by Akira Li <4kir4...@gmail.com>: -- nosy: +akira ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24773> ___ ___ Python

[issue22798] time.mktime doesn't update time.tzname

2015-09-29 Thread Akira Li
Akira Li added the comment: Marc-Andre Lemburg <rep...@bugs.python.org> writes: ... > tzname is set when the module is being loaded and not updated > afterwards (unless you call tzset()). I can't really see why you > would expect a module global in Python to follow the semantics

[issue25286] views are not sequences

2015-09-30 Thread Akira Li
New submission from Akira Li: The entry for *dict view* in the glossary may be clarified, to avoid confusion with collection.abc.Sequence i.e., from: They are lazy sequences that will see changes in the underlying dictionary. to something like: They provide a dynamic view

[issue25286] views are not sequences

2015-10-01 Thread Akira Li
Akira Li added the comment: Thank you for `view`, hint. I did look for :term:`view` that was obviously not enough. The new patch contains the renamed entry in the correct place. All `view`, ` occurrences dictionary view are updated now. -- Added file: http://bugs.python.org/file40654

[issue25288] readline.py file in current directory caused unexpected code execution.

2015-10-02 Thread Akira Li
Akira Li added the comment: python3 -I could be used as a workaround. -- nosy: +akira ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27050] Demote run() below the high level APIs in subprocess docs

2016-06-08 Thread Akira Li
Akira Li added the comment: > setting "universal_newlines=True" switches to UTF-8 encoded text pipes It uses locale.getpreferredencoding(False) encoding -- something like cp1252,cp1251,etc on Windows, and UTF-8 on *nix with proper locale settings. It is ASCII (C/POSIX l

[issue27273] subprocess.run(cmd, input='text') should pass universal_newlines=True to Popen

2016-06-08 Thread Akira Li
New submission from Akira Li: At the moment, subprocess.run(cmd, input='text') raises TypeError. It would be nice if universal_newlines=isinstance(input, str) if *input* is set. I've attached a corresponding patch with the necessary changes to the docs, tests and the subprocess.run() code

[issue23570] Change "with subprocess.Popen():" (context manager) to ignore broken pipe error

2016-02-17 Thread Akira Li
Akira Li added the comment: Should this issue be reopened in light of http://bugs.python.org/issue26372 (Popen.communicate not ignoring BrokenPipeError)? If .close() shouldn't raise BrokenPipeError in .communicate() (and it shouldn't) then it seems logical that .close() shouldn't raise

[issue23220] Documents input/output effects of how IDLE runs user code

2016-03-14 Thread Akira Li
Akira Li added the comment: IDLE can implement functionality similar to what colorama [1] module does on Windows: translate ANSI escape character sequences into corresponding GUI method calls. For example, \b might be implemented using a .delete() call, \r using .mark_set(), etc. [1] https

[issue22274] subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to stdout

2016-05-08 Thread Akira Li
Akira Li added the comment: Updated the patch to address vadmium's review comments. -- versions: -Python 3.4 Added file: http://bugs.python.org/file42777/subprocess-stderr_redirect_with_no_stdout_redirect-2.diff ___ Python tracker <

[issue27079] Bugs in curses.ascii predicates

2016-06-30 Thread Akira Li
Akira Li added the comment: There is an overlapping issue from 2010: "curses.ascii.isblank() function is broken. It confuses backspace (BS 0x08) with tab (0x09)" http://bugs.python.org/issue9770 Your patch fixes it too (it should be closed). Note: the patch does not pass tests fro

[issue27079] Bugs in curses.ascii predicates

2016-07-01 Thread Akira Li
Akira Li added the comment: I'm not sure anything should be done (e.g., it is "undefined behavior" to pass a negative value such as CHAR_MIN (if *char* type is signed) to a character classification function in C. Though EOF value (-1 traditionally) should be handled). If you want

[issue29352] provide the authorative source for s[i:j] negative slice indices (<-len(s)) behavior for standard sequences

2017-01-23 Thread Akira Li
New submission from Akira Li: I've failed to find where the behavior for negative indices in s[i:j] expression (i, j < -len(s)) for standard sequences (str, list, etc) is formally defined. The observed behavior implemented in PySlice_GetIndicesEx(): If "len(s) + i" or "len(s

[issue28876] bool of large range raises OverflowError

2017-01-23 Thread Akira Li
Akira Li added the comment: I've updated the patch to use 4-space indent (pep-7). I've added space around "=" (pep-7); unlike the usual "dict(designator=value)" -- no space around "=" for keyword argument (pep-8). -- Added file: http://bugs.pytho

[issue28876] bool of large range raises OverflowError

2017-01-22 Thread Akira Li
Akira Li added the comment: Following the python-dev discussion [1] I've added a variant of the patch that uses c99 designated initializers [2] [1] https://mail.python.org/pipermail/python-dev/2017-January/147175.html [2] https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html

[issue28876] bool of large range raises OverflowError

2016-12-05 Thread Akira Li
Akira Li added the comment: I've removed the documentation changes from the patch. -- Added file: http://bugs.python.org/file45773/range_bool-no_docs.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28876] bool of large range raises OverflowError

2016-12-05 Thread Akira Li
Akira Li added the comment: Here's a patch with range_bool() implementation, tests and the docs update. I'm not sure how it should be documented. I've specified it as versionchanged:: 3.6 -- keywords: +patch nosy: +akira Added file: http://bugs.python.org/file45765/range_bool.patch

[issue28180] sys.getfilesystemencoding() should default to utf-8

2016-12-21 Thread Akira Li
Changes by Akira Li <4kir4...@gmail.com>: -- nosy: +akira ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28180> ___ ___ Python

[issue29352] provide the authorative source for s[i:j] negative slice indices (<-len(s)) behavior for standard sequences

2017-03-17 Thread Akira Li
Changes by Akira Li <4kir4...@gmail.com>: -- pull_requests: +576 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29352> ___ __

[issue28876] bool of large range raises OverflowError

2017-03-17 Thread Akira Li
Changes by Akira Li <4kir4...@gmail.com>: -- pull_requests: +572 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28876> ___ __

[issue29352] provide the authorative source for s[i:j] negative slice indices (<-len(s)) behavior for standard sequences

2017-03-17 Thread Akira Li
Akira Li added the comment: I prefer the wording in the current patch. Though I don't have strong feelings one way or the other as long as the behavior is specified explicitly. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue28876] bool of large range raises OverflowError

2017-03-17 Thread Akira Li
Akira Li added the comment: > Akira, could you open a pull request on GitHub? Done. PR 699 -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.or

[issue22069] TextIOWrapper(newline=\n, line_buffering=True) mistakenly treat \r as a newline

2014-07-25 Thread Akira Li
New submission from Akira Li: TextIOWrapper(b, newline=\n, line_buffering=True) object calls flush() while writing \r. See test_line_buffering() method in Lib/test/test_io.py:2114 The documentation says [1]: If line_buffering is True, flush() is implied when a call to write contains

[issue563491] Add separator argument to readline()

2014-07-25 Thread Akira Li
Akira Li added the comment: Reincarnation: issue #1152248: Add support for reading records with arbitrary separators to the standard IO stack -- nosy: +akira ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue563491

[issue17083] can't specify newline string for readline for binary files

2014-07-25 Thread Akira Li
Akira Li added the comment: Related issue #1152248: Add support for reading records with arbitrary separators to the standard IO stack It suggests to extend the newline support for both text and binary files. -- nosy: +akira ___ Python tracker rep

[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2014-07-25 Thread Akira Li
Akira Li added the comment: To make the discussion more specific, here's a patch that adds support for alternative newlines in _pyio.TextIOWrapper. It aslo updates the documentation and adds more io tests. It does not provide C implementation or the extended newline support for binary files

[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2014-07-26 Thread Akira Li
Akira Li added the comment: As a side-effect it also fixes the bug in line_buffering=True behavior, see issue22069O. It should be issue22069 TextIOWrapper(newline=\n, line_buffering=True) mistakenly treat \r as a newline Reuploaded the patch so that it applies cleanly on the current tip

[issue19829] _pyio.BufferedReader and _pyio.TextIOWrapper destructor don't emit ResourceWarning if the file is not closed

2014-07-27 Thread Akira Li
Akira Li added the comment: Related issue21859 Add Python implementation of FileIO -- nosy: +akira ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19829

[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2014-07-28 Thread Akira Li
Akira Li added the comment: Akira, your patch does this: -self._writetranslate = newline != '' -self._writenl = newline or os.linesep +self._writetranslate = newline in (None, '\r', '\r\n') +self._writenl = newline if newline is not None else os.linesep

[issue22094] test_ossaudiodev fails unnecessarily

2014-07-28 Thread Akira Li
New submission from Akira Li: $ ./python -mtest -uaudio test_ossaudiodev [1/1] test_ossaudiodev test test_ossaudiodev failed -- Traceback (most recent call last): File ./Lib/test/test_ossaudiodev.py, line 148, in test_playback self.play_sound_file(*sound_info) File ./Lib/test

[issue22094] oss_audio_device.write(data) produces short writes

2014-07-28 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: -- title: test_ossaudiodev fails unnecessarily - oss_audio_device.write(data) produces short writes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22094

[issue22094] oss_audio_device.write(data) produces short writes

2014-07-28 Thread Akira Li
Akira Li added the comment: From Modules/ossaudiodev.c: /* NB. writeall() is only useful in non-blocking mode: according to Guenter Geiger gei...@xdv.org on the linux-audio-dev list (http://eca.cx/lad/2002/11/0380.html), OSS guarantees that write() in blocking mode

[issue22094] oss_audio_device.write(data) produces short writes

2014-07-28 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: -- components: +Library (Lib) -Tests ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22094 ___ ___ Python

[issue22054] Add os.get_blocking() and os.set_blocking() functions

2014-07-28 Thread Akira Li
Akira Li added the comment: Maybe is_something() is a better name than get_something() if something is a boolean? -- nosy: +akira ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22054

[issue12970] os.walk() consider some symlinks as dirs instead of non-dirs

2014-07-28 Thread Akira Li
Akira Li added the comment: I've updated os.walk() documentation to mention that *dirnames* list includes symlinks to directories. To imitate the other two cases: - treat the symlinks as files: for dirpath, dirnames, files in os.walk(top): dirs = [] for name in dirnames

[issue22054] Add os.get_blocking() and os.set_blocking() functions

2014-07-28 Thread Akira Li
Akira Li added the comment: os and socket modules already use getxxx() / setxxx() names: - os.get_inheritable() / os.set_inheritable() - os.getuid() / os.setuid() - os.getgroups() / os.setgroups() - os.getxattr() os.setxattr() - socket.gettimeout() / socket.settimeout

[issue22089] collections.MutableSet does not provide update method

2014-07-29 Thread Akira Li
Akira Li added the comment: Set has no __ior__ method but MutableSet has: class MySet(MutableSet): update = MutableSet.__ior__ Unlike set.__ior__; MutableSet.__ior__ accepts an arbitrary iterable and therefore MutableSet.update is redundant. set.__ior__ doesn't accept an arbitrary

[issue22089] collections.MutableSet does not provide update method

2014-07-29 Thread Akira Li
Akira Li added the comment: On the other hand update() method may accept multiple iterables at once: def update(self, *iterables): for it in iterables: self |= it and therefore it is not equivalent to __ior__ method. In this case: 'difference', 'intersection', 'union' set

[issue22101] collections.abc.Set doesn't provide copy() method

2014-07-29 Thread Akira Li
New submission from Akira Li: The documentation for standard types says [1]: clear() and copy() are included for consistency with the interfaces of mutable containers that don’t support slicing operations (such as dict and set) New in version 3.3: clear() and copy() methods. [1] https

[issue22101] collections.abc.Set doesn't provide copy() method

2014-07-31 Thread Akira Li
Akira Li added the comment: I don't think this is needed nor do I think that it is a good idea to have a copy() method in the ABCs because they know so little about their concrete underlying class (perhaps the backing store in the filesystem or a database). Besides, a user already has

[issue16353] add function to os module for getting path to default shell

2014-08-01 Thread Akira Li
Akira Li added the comment: Should it be function? Why not use just a variable initialized at import time? The path to the default shell shouldn't change during the time of program execution. if sys.platform == 'win32': default_shell = 'cmd.exe' else: default_shell = '/bin/sh

[issue16353] add function to os module for getting path to default shell

2014-08-01 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: -- versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16353 ___ ___ Python

[issue16353] add function to os module for getting path to default shell

2014-08-01 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: Removed file: http://bugs.python.org/file36195/os.get_shell_executable.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16353

[issue16353] add function to os module for getting path to default shell

2014-08-01 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: Added file: http://bugs.python.org/file36196/os.get_shell_executable.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16353

[issue14534] Add method to mark unittest.TestCases as do not run.

2014-08-04 Thread Akira Li
Akira Li added the comment: About the name: abstract_tests could be used e.g.: @abstract_tests class AbcSetTests(TestCase): # test abc.Set Set = abstract_property() def setUp(self): self.set = self.Set('abc') def test_difference(self

[issue19055] Clarify docs for re module: why * does not match as many repetitions as possible.

2014-08-11 Thread Akira Li
Akira Li added the comment: tl;dr: added patch that clarifies Python re behavior. Please, review. --- The documented behavior is not clear: why (a|ab)* is not equivalent to (a|ab)(a|ab) for aba if the docs say as many repetitions as are possible? And it is not obvious (it is not the only

[issue19055] Clarify docs for re module: why * does not match as many repetitions as possible.

2014-08-11 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: Removed file: http://bugs.python.org/file36340/re-docs-repetitions.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19055

[issue19055] Clarify docs for re module: why * does not match as many repetitions as possible.

2014-08-11 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: Added file: http://bugs.python.org/file36341/re-docs-repetitions.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19055

[issue5411] Add xz support to shutil

2014-08-11 Thread Akira Li
Akira Li added the comment: sphinx generates warning for the current docs introduced by this issue: WARNING: Explicit markup ends without a blank line; unexpected unindent. I've uploaded a documentation patch that fixes it. -- nosy: +akira Added file: http://bugs.python.org

[issue21041] pathlib.PurePath.parents rejects negative indexes

2014-08-18 Thread Akira Li
Akira Li added the comment: #7951 has an interesting debate on negative indexes that is possibly applicable here. Mark could you point to a message that explains why p.parents[-2] is worse than p.parents[len(p.parents)-2]? -- ___ Python tracker

[issue22241] strftime/strptime round trip fails even for UTC datetime object

2014-08-21 Thread Akira Li
New submission from Akira Li: from datetime import datetime, timezone dt = datetime.now(timezone.utc) fmt = '%Y-%m-%d %H:%M:%S.%f %Z%z' datetime.strptime(dt.strftime(fmt), fmt) Traceback (most recent call last): File stdin, line 1, in module File /cpython/Lib/_strptime.py

[issue22241] strftime/strptime round trip fails even for UTC datetime object

2014-08-21 Thread Akira Li
Akira Li added the comment: I don't see, how it is a duplicate. Everything works if pytz.utc (.tzname() == 'UTC') is used instead of timezone.utc (.tzname() == 'UTC+00:00'). Everything works if UTC class from the example [1] in the tzinfo docs is used. It only breaks due to the weird

[issue22246] add strptime(s, '%s')

2014-08-21 Thread Akira Li
New submission from Akira Li: issue12750 makes strftime('%s') portable. For symmetry, datetime.strptime(s, '%s') could be enabled to return local time as an aware (to avoid loosing info) datetime object for a given integer (seconds since the Epoch) timestamp string. I've uploaded a prototype

[issue22246] add strptime(s, '%s')

2014-08-21 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: Removed file: http://bugs.python.org/file36430/draft-strptime-%s.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22246

[issue22246] add strptime(s, '%s')

2014-08-21 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: Added file: http://bugs.python.org/file36431/draft-strptime-%s.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22246

[issue12750] datetime.strftime('%s') should respect tzinfo

2014-08-21 Thread Akira Li
Akira Li added the comment: issue22246 discusses the reverse: strptime('12345', '%s') -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12750

[issue22241] strftime/strptime round trip fails even for UTC datetime object

2014-08-21 Thread Akira Li
Akira Li added the comment: I see that you participated in the original discussion (msg107608). We settled on str(timezone.utc) == 'UTC+00:00' and this was clearly a deliberate choice. I don't think we can revisit this now, but we can probably make strptime smart enough to parse UTC±hh:mm

[issue22274] subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to stdout

2014-08-25 Thread Akira Li
New submission from Akira Li: The following command should not produce any output but it does: $ ./python /dev/null -c 'import subprocess as S, sys; S.call([sys.executable, -c, import sys; print(42, file=sys.stderr)], stderr=S.STDOUT)' Its stdout is redirected to /dev/null. It starts

[issue22274] subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to stdout

2014-08-28 Thread Akira Li
Akira Li added the comment: Josh, on Windows, if at least one standard stream is replaced; all three hStdInput, hStdOutput, hStdError handles are provided (all-or-nothing). On POSIX, standard streams stdin (0), stdout (1), stderr (2) are always inherited from the parent. Each stream can

[issue22277] webbrowser.py add parameters to suppress output on stdout and stderr

2014-08-28 Thread Akira Li
Akira Li added the comment: open(url, stdout=DEVNULL) won't work on Windows (os.startfile()) and OS X (AppleScript) by default. UnixBrowser already suppresses the output when it is safe, if self.redirect_stdout=True and self.background=True are set. Also, open(url, stdout=DEVNULL) would

[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-09-01 Thread Akira Li
Akira Li added the comment: time.time() returns the current time in seconds since Epoch it is neither local nor UTC time. It can be converted to both. You can get local time using datetime.fromtimestamp(ts). You can get UTC time using datetime.utcfromtimestamp(ts) or to get an aware datetime

[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-09-01 Thread Akira Li
Akira Li added the comment: timestamp() method works correctly for an aware datetime objects as in my example (notice: timezone.utc in the code). The issue is not that it is a manual computation, the issue is that it is incorrect: #XXX WRONG, DO NOT DO IT time.mktime

[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-09-01 Thread Akira Li
Akira Li added the comment: The last example assumes that time.gmtime(0) is 1970-01-01 00:00:00Z (otherwise time.time() may return different timestamp) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22296

[issue22356] mention explicitly that stdlib assumes gmtime(0) epoch is 1970

2014-09-07 Thread Akira Li
New submission from Akira Li: See discussion on Python-ideas https://mail.python.org/pipermail/python-ideas/2014-September/029228.html -- assignee: docs@python components: Documentation files: docs-time-epoch_is_1970.diff keywords: patch messages: 226539 nosy: akira, docs@python

[issue22377] %Z in strptime doesn't match EST and others

2014-09-13 Thread Akira Li
Akira Li added the comment: if PEP 431 is implemented (or anything that gives access to zoneinfo) then strptime could extend the list of timezones it accepts (utc + local timezone names) to include names from the tz database: import pytz # $ pip install pytz {tzname for tz in map

[issue22377] %Z in strptime doesn't match EST and others

2014-09-13 Thread Akira Li
Akira Li added the comment: Without %z (utc offset) strptime returns a naive datetime object that is interpreted as utc or local time usually. It might explain why %Z tries to match only utc and the local timezone names. -- ___ Python tracker rep

[issue22426] strptime accepts the wrong '2010-06-01 MSK' string but rejects the right '2010-06-01 MSD'

2014-09-16 Thread Akira Li
New submission from Akira Li: import os import time os.environ['TZ'] = 'Europe/Moscow' time.tzset() time.strptime('2010-06-01 MSK', '%Y-%m-%d %Z') time.struct_time(tm_year=2010, tm_mon=6, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=1, tm_yday=152, tm_isdst=0

[issue22426] strptime accepts the wrong '2010-06-01 MSK' string but rejects the right '2010-06-01 MSD'

2014-09-16 Thread Akira Li
Akira Li added the comment: Correction: The correct offset is +0400: dt = datetime(2010, 5, 31, 20, tzinfo=timezone.utc).astimezone() And _timezones dict is defined in Lib/email/_parseaddr.py -- ___ Python tracker rep...@bugs.python.org http

[issue22377] %Z in strptime doesn't match EST and others

2014-09-16 Thread Akira Li
Akira Li added the comment: If the current implementation is considered correct (%Z not recognizing EST) then indeed extending the list of recognized timezones is another issue. And the docs should be changed to match the implementation. The current behavior is broken, see also issue22426

[issue22426] strptime accepts the wrong '2010-06-01 MSK' string but rejects the right '2010-06-01 MSD'

2014-09-16 Thread Akira Li
Akira Li added the comment: My patch for issue22377 also fixes this bug. With the patch applied. Both MSK and MSD are accepted if the new timezones parameter is false (default for Python 3.5, will be changed to True in Python 3.6 If timezones is True then MSD return a correct aware datetime

[issue22426] strptime accepts the wrong '2010-06-01 MSK' string but rejects the right '2010-06-01 MSD'

2014-09-16 Thread Akira Li
Akira Li added the comment: MSD variant works on my machine because C library uses the historical timezone database there. I'm not sure whether it works on old Windows versions. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue22442] subprocess.check_call hangs on large PIPEd data.

2014-09-19 Thread Akira Li
Akira Li added the comment: This is a documented failure on the python subprocess page, but why not just fix it up directly in python itself? If you want to discard the output; you could use: check_call(args, stdin=DEVNULL, stdout=DEVNULL, stderr=STDOUT) check_call() passes its parameters

[issue22377] %Z in strptime doesn't match EST and others

2014-09-19 Thread Akira Li
Akira Li added the comment: I don't think we are going to support a timezone list like that without PEP 431. PEP 431 won't fix this issue. See below. You should attach your patch to a new issue. When I said this should the doc issue, that is because only a doc fix is acceptable for 3.4

[issue22443] read(1) blocks on unflushed output

2014-09-19 Thread Akira Li
Akira Li added the comment: Related: http://stackoverflow.com/questions/25923901/last-unbuffered-line-cant-be-read Make sure you follow the links in the comments. -- nosy: +akira ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue22442] subprocess.check_call hangs on large PIPEd data.

2014-09-21 Thread Akira Li
Akira Li added the comment: What do you think? I would prefer to deprecate PIPE argument for subprocess.call(): issue DeprecationWarning in 3.5 and raise ValueError in 3.6+ I've uploaded a patch that issues the warning. -- keywords: +patch type: - enhancement versions: +Python 3.5

[issue21332] subprocess bufsize=1 docs are misleading

2014-09-21 Thread Akira Li
Changes by Akira Li 4kir4...@gmail.com: Added file: http://bugs.python.org/file36679/subprocess-line-buffering-issue21332-ps5.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21332

[issue22442] subprocess.check_call hangs on large PIPEd data.

2014-09-21 Thread Akira Li
Akira Li added the comment: @juj: DeprecationWarning is generated if PIPE is passed to call() as any positional or keyword argument in particular stdin, stdout, stderr. It also applies to check_call() that uses call() internally. -- ___ Python

  1   2   >