Changes by Akira Li <4kir4...@gmail.com>:
--
pull_requests: +572
___
Python tracker
<http://bugs.python.org/issue28876>
___
___
Python-bugs-list mailing list
Akira Li added the comment:
> Akira, could you open a pull request on GitHub?
Done. PR 699
--
___
Python tracker
<http://bugs.python.org/issue28876>
___
___
Py
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
<http://bugs.python.org/is
Changes by Akira Li <4kir4...@gmail.com>:
--
pull_requests: +576
___
Python tracker
<http://bugs.python.org/issue29352>
___
___
Python-bugs-list mailing list
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
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
<http://bugs.python.org/issue563
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
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
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 appl
Akira Li added the comment:
Related issue21859 "Add Python implementation of FileIO"
--
nosy: +akira
___
Python tracker
<http://bugs.python.o
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')
> +sel
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 &
Changes by Akira Li <4kir4...@gmail.com>:
--
title: test_ossaudiodev fails unnecessarily -> oss_audio_device.write(data)
produces short writes
___
Python tracker
<http://bugs.python.or
Akira Li added the comment:
>From Modules/ossaudiodev.c:
/* NB. writeall() is only useful in non-blocking mode: according to
Guenter Geiger on the linux-audio-dev list
(http://eca.cx/lad/2002/11/0380.html), OSS guarantees that
write() in blocking mode consumes
Changes by Akira Li <4kir4...@gmail.com>:
--
components: +Library (Lib) -Tests
___
Python tracker
<http://bugs.python.org/issue22094>
___
___
Python-bugs-
Akira Li added the comment:
Maybe is_something() is a better name than get_something()
if something is a boolean?
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue22
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 dir
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(
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 arbi
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', 'intersectio
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
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
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&
Changes by Akira Li <4kir4...@gmail.com>:
--
versions: +Python 3.5 -Python 3.4
___
Python tracker
<http://bugs.python.org/issue16353>
___
___
Python-bugs-
Changes by Akira Li <4kir4...@gmail.com>:
Removed file: http://bugs.python.org/file36195/os.get_shell_executable.patch
___
Python tracker
<http://bugs.python.org/i
Changes by Akira Li <4kir4...@gmail.com>:
Added file: http://bugs.python.org/file36196/os.get_shell_executable.patch
___
Python tracker
<http://bugs.python.org/i
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_diffe
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 no
Changes by Akira Li <4kir4...@gmail.com>:
Removed file: http://bugs.python.org/file36340/re-docs-repetitions.patch
___
Python tracker
<http://bugs.python.org/i
Changes by Akira Li <4kir4...@gmail.com>:
Added file: http://bugs.python.org/file36341/re-docs-repetitions.patch
___
Python tracker
<http://bugs.python.org/i
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.pytho
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 t
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 "
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 onl
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
Changes by Akira Li <4kir4...@gmail.com>:
Removed file: http://bugs.python.org/file36430/draft-strptime-%s.diff
___
Python tracker
<http://bugs.python.org/i
Changes by Akira Li <4kir4...@gmail.com>:
Added file: http://bugs.python.org/file36431/draft-strptime-%s.diff
___
Python tracker
<http://bugs.python.org/i
Akira Li added the comment:
issue22246 discusses the reverse: strptime('12345', '%s')
--
___
Python tracker
<http://bugs.python.org/issue12750>
___
__
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 strptim
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 r
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 be
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)
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
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
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
<http://bugs.python.org/issue22
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
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
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
<h
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
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
<http://bug
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
If
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
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
<http://bugs.python.org/is
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() pass
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
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
<http://bugs.python.org/issue22
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:
Changes by Akira Li <4kir4...@gmail.com>:
Added file:
http://bugs.python.org/file36679/subprocess-line-buffering-issue21332-ps5.patch
___
Python tracker
<http://bugs.python.org/i
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
Akira Li added the comment:
Victor, the message in my patch is copied almost verbatim from the
current subprocess' documentation [1]
[1]
https://hg.python.org/cpython/file/850a62354402/Doc/library/subprocess.rst#l57
People use `call(cmd, stdout=PIPE)` as a *broken* way to suppress
o
Akira Li added the comment:
Whether or not gcd(a, b) == gcd(|a|, |b|) depends on the definition if
we believe to Stepanov of C++ STL fame who mentions in his lecture [1]
[1] http://www.stepanovpapers.com/gcd.pdf
that the current implementation that uses two operation __bool__ and
__mod__
Changes by Akira Li <4kir4...@gmail.com>:
--
nosy: -akira
___
Python tracker
<http://bugs.python.org/issue22477>
___
___
Python-bugs-list mailing list
Akira Li added the comment:
OSError has *filename* attribute. Could it be passed to the UI instead?
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue22
Akira Li added the comment:
I meant, in general, repr() is better for an error message because
it should be unambigous unlike str() but in your particular case
you could use filename attribute to format the way you like it
for your UI.
--
___
Python
Changes by Akira Li <4kir4...@gmail.com>:
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue22524>
___
___
Python-bugs-list mailing list
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/r
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
<http://bugs.python.org/is
Changes by Akira Li <4kir4...@gmail.com>:
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue28180>
___
___
Python-bugs-list mailing list
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
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://
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 "
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 locale de
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 subpro
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
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
Akira Li added the comment:
Christopher,
About your script http://paste.ubuntu.com/8562027/
dateutil may break if the local timezone had different UTC offset in the past.
You could use tzlocal module to get pytz timezone that can handle such
timezones.
To get the correct time for
Akira Li added the comment:
It looks like the issue can be reduced to whether or not to show this
output:
>>> import os
>>> os.write(1, b'should we see this in idle?\n')
should we see this in idle?
28
assuming sys.__stdout__.fileno() == fileno(stdout) == 1
New submission from Akira Li:
The patch for Issue #21075: "fileinput.FileInput now reads bytes from standard
stream if binary mode is specified" broke code that used
sys.stdin = sys.stdin.detach() with FileInput(mode='rb') in Python 3.3
I've attached the patch that
Akira Li added the comment:
It is incorrect that sys.stdin is *always* a text stream. It often is,
but not always.
There are cases when it is not e.g.,
$ tar zcf - stuff | gpg -e | ssh user@server 'cat - > stuff.tar.gz.gpg'
tar's stdout is *not* a text stream.
gpg'
Akira Li added the comment:
> This is not related to Python. Terms "character", "string", "text", "file"
> can have different meaning in different domains. In Python we use Python
> terminology. There is no such thing as sys.stdin in Posix-co
New submission from Akira Li:
time.clock() documentation [1] says:
this is the function to use for benchmarking Python or timing algorithms.
and
Deprecated since version 3.3: The behaviour of this function depends on the
platform: use perf_counter() or process_time() instead, depending
New submission from Akira Li:
time.tzname is initialized from C tzname variable or tm_zone around Jan, Jul of
the current year.
If time.mktime() is called with a time tuple from the past/future then after
the call time.tzname might be out-of-sync with the corresponding C tzname and
tm_zone
Akira Li added the comment:
I've attached test-timezone-info-is-updated.diff file -- a patch for
Lib/test/test_time.py that demonstrates that time functions fail to update the
timezone info.
The test uses Europe/Moscow timezone but most timezones around the world
had/will have diff
Changes by Akira Li <4kir4...@gmail.com>:
Added file: http://bugs.python.org/file37134/test_mktime_changes_tzname.c
___
Python tracker
<http://bugs.python.org/i
New submission from Akira Li:
$ TZ=:Europe/Moscow ./python -mtest -v test_time
==
FAIL: test_localtime_timezone (test.test_time.TestPytime)
--
Traceback
Akira Li added the comment:
> Matt Frank added the comment:
>
> Unfortunately os.defpath seems to be hardcoded. And hardcoded to the
> wrong value on every system I have looked at, including Linux.
os.defpath is supposed to be ':'+CS_PATH, e.g., look at glibc (C library
Akira Li added the comment:
> Matt Frank added the comment:
>
> In msg230720 Akira Li (akira) wrote:
>> os.defpath is supposed to be ':'+CS_PATH, e.g., look at glibc (C library
>> used on Linux) sysdeps/posix/spawni.c I don't know whether it is
>> poss
Changes by Akira Li <4kir4...@gmail.com>:
Added file: http://bugs.python.org/file37140/os.get_shell_executable-3.patch
___
Python tracker
<http://bugs.python.org/i
Akira Li added the comment:
>>> from datetime import datetime, timezone
>>> datetime.fromtimestamp(0, timezone.utc)
datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)
already works and it is documented [1]
[1]
https://docs.python.org/3/lib
Akira Li added the comment:
I agree the documentation should nudge towards aware
datetime objects.
I've attached a documentation patch as an example.
--
keywords: +patch
Added file:
http://bugs.python.org/file37162/issue22791-utcfromtimestamp-aware
Akira Li added the comment:
I can confirm that without the patch the filename attribute is None
despite being mentioned in strerror.
Travis, you should use `orig_executable` instead of `args[0]` to cover:
subprocess.call("exit 0", shell=True, executable='/nonexistent bash
Akira Li added the comment:
If the_oserror.filename is not None then str(the_oserror) appends the
filename twice:
[Errno 2] No such file or directory: 'nonexistent': 'nonexistent'
You could remove `err_msg += ':' ...` statements to avoid the
repeatition. I
Akira Li added the comment:
It would be inconsitent to provide filename only if exec is called e.g.:
>>> import subprocess
subprocess.call("not used", cwd="nonexistent")
FileNotFoundError: [Errno 2] No such file or directory: 'nonexistent'
Th
Akira Li added the comment:
@Esa changing the buffer size helps with some "bad" files
but lzma module still fails on some files.
I've uploaded decompress-example-files.py script that demonstrates it.
--
nosy: +akira
Added file: http://bugs.python.org/file37239/dec
Changes by Akira Li <4kir4...@gmail.com>:
Added file: http://bugs.python.org/file37240/decompress-example-files.py
___
Python tracker
<http://bugs.python.org/i
Changes by Akira Li <4kir4...@gmail.com>:
Removed file: http://bugs.python.org/file37239/decompress-example-files.py
___
Python tracker
<http://bugs.python.org/i
Akira Li added the comment:
If lzma._BUFFER_SIZE is less than 2048 then all example files are
decompressed successfully (at least lzma module produces the same
results as xz utility)
--
Added file: http://bugs.python.org/file37241/decompress-example-files.py
Changes by Akira Li <4kir4...@gmail.com>:
Removed file: http://bugs.python.org/file37240/decompress-example-files.py
___
Python tracker
<http://bugs.python.org/i
Akira Li added the comment:
C standard delegates to implementations:
The local time zone and Daylight Saving Time are implementation-defined.
gcc (one of the implementations) says [1]:
[timezone] contains the difference between UTC and the latest local standard
time, in seconds west of
Akira Li added the comment:
One of the ways to fix this issue is to synchronize time.tzname
attribute with the corresponding C tzname variable.
I've uploaded sync-time-timezone-attr-with-c.diff patch that
synchronizes tzname, timezone, altzone, daylight attributes.
The patch also inc
1 - 100 of 144 matches
Mail list logo