[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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-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

[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

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

2014-07-24 Thread akira
akira added the comment: STINNER Victor rep...@bugs.python.org writes: I have implemented and would continue to lean towards continuing to hide BrokenPipeError on the additional API endpoints. FYI asyncio.Process.communicate() ignores BrokenPipeError and ConnectionResetError, whereas

[issue9770] curses.ascii.isblank() function is broken. It confuses backspace (BS 0x08) with tab (0x09)

2014-07-24 Thread akira
akira added the comment: I've made the title more explicit: curses.isblank function doesn't match ctype.h - curses.ascii.isblank() function is broken. It confuses backspace (BS 0x08) with tab (0x09) If a core developer could review the open questions from the previous message msg221008 then I

[issue21041] pathlib.PurePath.parents rejects negative indexes

2014-07-14 Thread akira
akira added the comment: Aren't negative indexes well defined in Python? yes. I've provided the link to Python docs [1] in msg214642 that explicitly defines the behavior: If i or j is negative, the index is relative to the end of the string: len(s) + i or len(s) + j is substituted

[issue8631] subprocess.Popen.communicate(...) hangs on Windows

2014-07-02 Thread akira
akira added the comment: ID s.check_output(pyflakes c:\programs\python34\lib\turtle.py) hangs indefinitely, no output It might be unrelated to the issue but \t is a tab; a raw-string literal should be used instead: from subprocess import check_output check_output(rpyflakes c:\programs

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

2014-07-01 Thread akira
akira added the comment: ``%s`` format code behaviour was undefined and incidental. strftime('%s') is not portable but it *is* supported on some platforms i.e., it is *not* undefined and it is *not* incidental on these platforms. datetime.strftime *delegates* to the platform strftime(3

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

2014-06-29 Thread akira
akira added the comment: Can you explain why math.floor rather than builtin round is the correct function to use? To avoid breaking existing scripts that use `.strftime('%s')` on Linux, OSX, see msg221385: from datetime import datetime, timezone dt = datetime(1969, 1, 1, 0,0,0, 60

[issue21873] Tuple comparisons with NaNs are broken

2014-06-28 Thread akira
akira added the comment: (a, b) (c, d) is more like: if a != c: return a c ... except CPython behaves (undocumented?) as: b d if a is c or a == c else a c the difference is in the presence of `is` operator (identity comparison instead of `__eq__`). `nan is nan` therefore `b d

[issue21873] Tuple comparisons with NaNs are broken

2014-06-27 Thread akira
akira added the comment: It is about equality. `float('nan') != float('nan')` unlike `0 == 0`. From msg221603: If not equal, the sequences are ordered the same as their first differing elements. The result of the expression: `(a, whatever) (b, whatever)` is defined by `a b` if a and b

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

2014-06-26 Thread akira
akira added the comment: I suspect that in the absence of %z, the most useful option would be to return naive datetime in the local timezone, but that can be added later. Naive datetime in the local timezone may lose information that is contained in the input timestamp: import os

[issue21873] Tuple comparisons with NaNs are broken

2014-06-26 Thread akira
akira added the comment: Is the issue that: (1, float('nan')) == (1, float('nan')) False but nan = float('nan') (1, nan) == (1, nan) True ? `nan != nan` therefore it might be expected that `(a, nan) != (a, nan)` [1]: The values float('NaN') and Decimal('NaN') are special

[issue21873] Tuple comparisons with NaNs are broken

2014-06-26 Thread akira
akira added the comment: btw, pypy3 (986752d005bb) is broken: (1, float('nan')) == (1, float('nan')) True -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21873

[issue21873] Tuple comparisons with NaNs are broken

2014-06-26 Thread akira
akira added the comment: Python containers are allowed to let identity-imply-equality (the reflesive property of equality). Is it documented somewhere? Dicts, lists, tuples, deques, sets, and frozensets all work this way. Is it CPython specific behaviour

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

2014-06-23 Thread akira
akira added the comment: *If* the support for %s strftime format code is added then it should keep backward compatibility on Linux, OSX: it should produce an integer string with the correct rounding. Currently, datetime.strftime delegates to a platform strftime(3) for format specifiers

[issue9770] curses.isblank function doesn't match ctype.h

2014-06-19 Thread akira
akira added the comment: I've fixed isblank to accept tab instead of backspace and added tests for character classification functions from curses.ascii module that have corresponding analogs in ctype.h. They've uncovered issues in isblank, iscntrl, and ispunct functions. Open questions

[issue1191964] asynchronous Subprocess

2014-06-02 Thread akira
akira added the comment: First, with the use of Overlapped IO on Windows, BlockingIOError should never come up, and we don't even handle that exception. Is it correct that the way to distinguish between would block and EOF is Popen.poll()? Is it possible to detect it in _nonblocking

[issue21618] POpen does not close fds when fds have been inherited from a process with a higher resource limit

2014-05-31 Thread akira
akira added the comment: getrlimit and setrlimit are not exposed in the os module; you must use ctypes or an extension module to call them from Python: There is `resource` module: import resource resource.getrlimit(resource.RLIMIT_NOFILE) (1024, 4096) -- nosy: +akira

[issue1191964] asynchronous Subprocess

2014-05-30 Thread akira
akira added the comment: Does anyone have questions, comments, or concerns about the patch? It seems the current API doesn't distinguish between BlockingIOError (temporary error), BrokenPipeError (permanent error) and EOF (permanent non-error condition) -- everything is treated as EOF

[issue21332] subprocess bufsize=1 docs are misleading

2014-05-24 Thread akira
akira added the comment: The short answer is: no, you don't have to make you thread thread safe, as long as it can reliably run even in the presence of background threads (like the tkinter threads Victor mentions). https://mail.python.org/pipermail/python-dev/2014-May/134541.html It seems

[issue21542] pprint doesn't work well for counters, sometimes shows them like a dict

2014-05-21 Thread akira
akira added the comment: If it fits on a line then it seems Counter's repr is used: pprint(Counter({i:i*i for i in range(10)})) Counter({9: 81, 8: 64, 7: 49, 6: 36, 5: 25, 4: 16, 3: 9, 2: 4, 1: 1, 0: 0}) Otherwise It is shown as a dict (Counter is a dict subclass) if it is too large

[issue7434] general pprint rewrite

2014-05-21 Thread akira
akira added the comment: Related issue #21542: pprint support for multiline collections.Counter -- nosy: +akira ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7434

[issue21543] json library fails to serialize objects such as datetime

2014-05-20 Thread akira
akira added the comment: json module already allows you to customize the serialization: see *default* parameter for json.dumps [1] [1] https://docs.python.org/3/library/json.html#json.dump -- nosy: +akira ___ Python tracker rep...@bugs.python.org

[issue6445] Add check parameter to subprocess.Popen.communicate

2014-05-16 Thread akira
akira added the comment: subprocess.check_output() could be used in communicate() + check process exit status one-liners. It returns child process output (stdout) and raises an exception if the returncode is not zero. It is available since Python 2.7 (3.1) If you don't want to raise an error

[issue17909] Autodetecting JSON encoding

2014-05-15 Thread akira
akira added the comment: Both json standard (ECMA-404) [1] and the new json rfc 7159 [2] do not mention the encoding detection. [1] http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf [2] https://tools.ietf.org/html/rfc7159#section-8.1 From the rfc: JSON text SHALL

[issue21485] remove unnecesary .flush() calls in the asyncio subprocess code example

2014-05-12 Thread akira
New submission from akira: The current code example contains [1]: print(Python failed with exit code %s: % exitcode) sys.stdout.flush() sys.stdout.buffer.flush() sys.stdout.buffer.write(stdout) sys.stdout.buffer.flush() that looks bizarre. Either a comment should be added

[issue21471] subprocess line-buffering only works in universal newlines mode

2014-05-11 Thread akira
akira added the comment: Until the current patch for issue #21332 is committed; bufsize=1 is equivalent to bufsize=-1 in both binary and text mode. You are correct the patch in #21332 fixes only the text mode (universal_newlines=True) -- it also updates the documentation to mention

[issue21464] fnmatch module uses regular expression with undefined result to perform matching

2014-05-10 Thread akira
akira added the comment: I don't see (?x) flag and it is not introduced by `res` regular expression that is constructed within translate() function in Lib/fnmatch.py import fnmatch fnmatch.translate('a b') 'a\\ b\\Z(?ms)' -- nosy: +akira

[issue21332] subprocess bufsize=1 docs are misleading

2014-05-10 Thread akira
akira added the comment: I've asked about thread-safety of tests on python-dev mailing list: https://mail.python.org/pipermail/python-dev/2014-May/134523.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21332

[issue21332] subprocess bufsize=1 docs are misleading

2014-05-08 Thread akira
akira added the comment: I've updated the patch to remove changes to test_universal_newlines test that was fixed in revision 37d0c41ed8ad that closes #21396 issue -- Added file: http://bugs.python.org/file35189/subprocess-line-buffering-issue21332-ps4.patch

[issue21444] __len__ can't return big numbers

2014-05-06 Thread akira
akira added the comment: If `len()` signature can't be changed to return Python int objects (unlimited) then the OverflowError may contain the actual `.length` property instead (based on msg66459 by Antoine Pitrou) operator.length(): def length(sized): Return the true (possibly

[issue20866] segfailt with os.popen and SIGPIPE

2014-05-05 Thread akira
akira added the comment: Victor, where can you reproduce it (OS, python version, what C lib)? I don't receive segfault, only sigpipe (see msg217818 ). Here's gdb backtrace after the signal: Program received signal SIGPIPE, Broken pipe. 0x771e1040 in __write_nocancel () at ../sysdeps

[issue21437] document that asyncio.ProactorEventLoop doesn't support SSL

2014-05-05 Thread akira
New submission from akira: In Lib/asyncio/proactor_events.py:419 [1]: def _start_serving(self, protocol_factory, sock, ssl=None, server=None): if ssl: raise ValueError('IocpEventLoop is incompatible with SSL.') [1]: http://hg.python.org/cpython/file/4f26430b03fd/Lib/asyncio

[issue20866] segfailt with os.popen and SIGPIPE

2014-05-03 Thread akira
akira added the comment: I can't reproduce it on Ubuntu 12.04 with Python 2.7.3, 2.7.6, 3.2, tip -- no segfault. It prints the expected output on both Python 2 and 3: (standard input) io-error (standard input) is printed by grep due to --files-with-match option io-error (Broken pipe

[issue21332] subprocess bufsize=1 docs are misleading

2014-05-02 Thread akira
akira added the comment: to be clear: the test itself doesn't use threads, `python -mtest -j0` runs tests using multiple *processes*, not threads. There is no issue. If the test were to run in the presence of multiple threads then the issue would be the *explicit* p.stdin.close() in the test

[issue21347] Don't use a list argument together with shell=True in subprocess' docs

2014-05-02 Thread akira
akira added the comment: I've checked the same documentation patch applies to both default (3.5) and 2.7 branches. There are no more instances of the misleading usage left (after applying the patch). -- ___ Python tracker rep...@bugs.python.org

[issue21332] subprocess bufsize=1 docs are misleading

2014-05-01 Thread akira
akira added the comment: I've changed test_newlines to work also with Python io implementation. I've updated the patch. Note: tests use 10 seconds timeouts: I don't know how long it should take to read back a line from a subprocess so that the timeout would indicate a deadlock

[issue21396] Python io implementation doesn't flush with write_through=True unlike C implementation

2014-05-01 Thread akira
akira added the comment: I've uploaded the patch that makes C implementation behave according to the docs like Python implementation with the corresponding tests. Issue #21332 is a dependency for this issue: subprocess' test_universal_newlines needs to be updated to work with Python version

[issue21332] subprocess bufsize=1 docs are misleading

2014-05-01 Thread akira
akira added the comment: yes, line_buffering=(bufsize == 1) is necessary to support the current Python io implementation or if C implementation is fixed to avoid buffer.flush() on every write with write_through=True -- otherwise bufsize is not respected in text mode (it would always mean

[issue21332] subprocess bufsize=1 docs are misleading

2014-04-30 Thread akira
akira added the comment: It looks like a bug in the subprocess module e.g., if child process does: sys.stdout.write(sys.stdin.readline()) sys.stdout.flush() and the parent: p.stdin.write(line) #NOTE: no flush line = p.stdout.readline() then a deadlock may happen with bufsize=1

[issue21396] Python io implementation doesn't flush with write_through=True unlike C implementation

2014-04-30 Thread akira
New submission from akira: related: msg217596 (bufsize=1 is broken if subprocess module uses Python io) TextIOWrapper.write behavior: _pyio.py [1]: if self._line_buffering and (haslf or \r in s): self.flush() textio.c [2]: if (self-write_through) needflush

[issue21332] subprocess bufsize=1 docs are misleading

2014-04-30 Thread akira
akira added the comment: Related issue #21396 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21332 ___ ___ Python-bugs-list mailing list

[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2014-04-28 Thread akira
akira added the comment: I've updated the patch: - fixed the code example in the documentation to use int instead of float result - removed assertion on the int returned type (float won't lose precision for the practical dates but guaranteeing an integer would be nice) - reworded the scary

[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2014-04-28 Thread akira
akira added the comment: Antoine, thank you for reviewing. I appreciate the patience. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19940

[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2014-04-27 Thread akira
akira added the comment: Here's a new patch with a simplified ssl.cert_time_to_seconds() implementation that brings strptime() back. The behaviour is changed: - accept both %e and %d strftime formats for days as strptime-based implementation did before - return an integer instead of a float

[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2014-04-27 Thread akira
akira added the comment: Replace IndexError with ValueError in the patch because tuple.index raises ValueError. -- Added file: http://bugs.python.org/file35051/ssl_cert_time_to_seconds-ps5.patch ___ Python tracker rep...@bugs.python.org http

[issue17552] socket.sendfile()

2014-04-25 Thread akira
akira added the comment: I'm confused. Why is blocksize necessary at all? My guess, it may be used to implement socket.send()-based fallback. Its meaning could be the same as *length* parameter in shutil.copyfileobj The fallback is useful if os.sendfile doesn't exists or it doesn't accept

[issue21353] document Popen.args attribute

2014-04-25 Thread akira
New submission from akira: It is convenient to have Popen.args available. Especially when dealing with multiple processes e.g., to log failures mentioning the command that was used to spawn the child process. subprocess module itself uses it while raising CalledProcessError or TimeoutExpired

[issue17552] socket.sendfile()

2014-04-24 Thread akira
akira added the comment: use_fallback parameter is mostly a debugging tool. If it helps to avoid the indecision; I would side with neologix' remarks and also suggest to drop the use_fallback parameter. It seems the patch assumes *offset == nbytes_sent* that is false in general e.g., if offset

[issue21347] Don't use a list argument together with shell=True in subprocess' docs

2014-04-24 Thread akira
New submission from akira: *Popen([something], shell=True)* works but it is similar to *Popen([something, arg], shell=True)* that passes arg to /bin/sh on POSIX systems instead of something. It is best to always use a string if `shell=True` is necessary. It is a common confusion #20344

<    1   2   3   4   5   >