New submission from akira <4kir4...@gmail.com>:
It seems that some assertions in
Lib/test/test_unicode.py:UnicodeTest.test_format_map do not implement their
intent e.g.,
self.assertRaises(TypeError, '{'.format_map)
self.assertRaises(TypeError
Changes by akira <4kir4...@gmail.com>:
--
title: fix ''.format_map test -> add assertions to implement the intent in
''.format_map test
___
Python tracker
<h
Changes by akira <4kir4...@gmail.com>:
Removed file:
http://bugs.python.org/file23747/correct-assertions-in-test_format_map.patch
___
Python tracker
<http://bugs.python.org/i
Changes by akira <4kir4...@gmail.com>:
Added file:
http://bugs.python.org/file23748/correct-assertions-in-test_format_map.patch
___
Python tracker
<http://bugs.python.org/i
akira <4kir4...@gmail.com> added the comment:
TypeError tests can check that an implementation raises a correct exception
type i.e., it doesn't raise ValueError prematurely on invalid format_string
without checking that there is mapping argument.
METH_O does it for CPython. I
akira <4kir4...@gmail.com> added the comment:
Related bug in Java:
http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html
Do not consider any change as trivial:
http://www.solipsys.co.uk/new/BinarySearchReconsidered.html (the author ran
"binary sea
Changes by akira <4kir4...@gmail.com>:
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue13643>
___
___
Python-bugs-list mailing list
Unsubs
New submission from akira <4kir4...@gmail.com>:
$ python3.1 -c'import math; f = math.log(4,2); print(int(f),
f.as_integer_ratio())'
2 (2, 1)
$ python3.2 -c'import math; f = math.log(4,2); print(int(f),
f.as_integer_ratio())'
1 (9007199254740991, 4503599627370496)
akira <4kir4...@gmail.com> added the comment:
> No, it's not really a bug: math.log(x, 2) isn't an atomic operation:
It is not a bug, but values of math.log(4) differs between 3.1 and 3.2
i.e., math.log(4.0) in 3.2 returns value that is consistent with
math.log(4) in 3.1 but
Changes by akira <4kir4...@gmail.com>:
Added file: http://bugs.python.org/file19031/test_log_power_two.py
___
Python tracker
<http://bugs.python.org/issue9959>
___
__
Changes by akira <4kir4...@gmail.com>:
--
type: behavior -> feature request
___
Python tracker
<http://bugs.python.org/issue9959>
___
___
Python-bugs-li
New submission from akira <4kir4...@gmail.com>:
Since Python 3.2 logging package doesn't support formatting flags for the
`asctime` keyword, but the documentation uses them. For example in
Doc/library/logging.rst:
FORMAT = '%(asctime)-15s %(clientip)s %(user)-8s %(messa
New submission from akira <4kir4...@gmail.com>:
The line with `LoggerAdapter` is not used in
http://docs.python.org/dev/howto/logging-cookbook.html#using-filters-to-impart-contextual-information
Here's a patch for Doc/howto/logging-cookbook.rst:
doc-logging-cookbook-unused-line-r
akira <4kir4...@gmail.com> added the comment:
The test produces a traceback while shrinking a window (increasing the window
size works ok):
Traceback (most recent call last):
File "screen-resize-bug-curses.py", line 22, in
curses.wrapper(main)
File "/.../python
New submission from akira <4kir4...@gmail.com>:
s/method/module/:
Functionality within this package requires that the ``__main__`` method be
importable by the children.
--
assignee: docs@python
components: Documentation
messages: 134724
nosy: akira, docs@python
priority:
akira <4kir4...@gmail.com> added the comment:
Simplified the patch and added test for a non-existent file in issue9509.patch
The test `py3k/python -m test.regrtest test_argparse` fails without the patch
and succeeds with it.
The docs in Doc/library/argparse.rst and Lib/argparse.py don&
akira <4kir4...@gmail.com> added the comment:
I've added tests for readonly files. SilentGhost's patch doesn't handle this
case.
--
Added file: http://bugs.python.org/file19806/test_argparse.diff
___
Python tracker
<http://b
akira <4kir4...@gmail.com> added the comment:
Attached patch for argparse.py (argparse.diff -- without tests, see tests in
test_argparse.diff) where ValueError is raises in FileType.__call__ and
additional details printed on ArgumentError
--
Added file: http://bugs.pyth
akira <4kir4...@gmail.com> added the comment:
updated patch on http://codereview.appspot.com/3251041/
--
___
Python tracker
<http://bugs.python.org/
akira <4kir4...@gmail.com> added the comment:
"no such file or directory '%s'" is misleading if you are trying to open a
readonly file for writing.
The message might be replace by: "can't open '%s'"
--
New submission from akira <4kir4...@gmail.com>:
`messges` should be replaced by `messages` on
http://docs.python.org/dev/library/argparse.html#upgrading-optparse-code page.
--
assignee: d...@python
components: Documentation
messages: 104144
nosy: akira, d...@python
severity:
New submission from akira <4kir4...@gmail.com>:
Currently it is not obvious that os.devnull works on Windows.
--
assignee: d...@python
components: Documentation
files: doc-os-devnull-windows-r81160.diff
keywords: patch
messages: 105688
nosy: akira, d...@python
priority: normal
se
Changes by akira <4kir4...@gmail.com>:
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue10278>
___
___
Python-bugs-list mailing list
Unsubs
Changes by akira <4kir4...@gmail.com>:
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue1602>
___
___
Python-bugs-list mailing list
Unsubs
New submission from akira:
>>> import sys
>>> from pickle import dumps, loads
>>> r = xrange(sys.maxsize)
>>> len(r) == sys.maxsize
True
>>> pr = loads(dumps(r))
>>> len(pr) == len(r)
False
>>> pr
xrange(0)
>&g
akira added the comment:
I've checked the source code for 3.4; `subprocess` uses `_winapi.CreateProcess`
on Windows [1] that in turn uses `CreateProcessW` [2]. CreateProcessA is not
used.
`Popen` should already support Unicode on Windows though I don't see explicit
tests for
akira added the comment:
Antoine, I haven't received the e-mail notification.
I've replied to the comments on Rietveld.
Here's the updated patch with the corresponding changes.
--
Added file: http://bugs.python.org/file34594/ssl_cert_time_to_se
New submission from akira:
`pathlib.PurePath.parents` is a sequence [1] but it rejects negative indexes:
>>> from pathlib import PurePath
>>> PurePath('a/b/c').parents[-2]
Traceback (most recent call last):
...
IndexError: -2
Sequences in Python interpret
Changes by akira <4kir4...@gmail.com>:
--
type: -> behavior
___
Python tracker
<http://bugs.python.org/issue21041>
___
___
Python-bugs-list mailing l
akira added the comment:
> Also, Richard Oudkerk's claims above about not needing to use fcntl to swap
> flags is not correct. It's necessary to not block on reading, even if select
> is used. Select just guarantees that there is at least 1 byte or a closed
> handle, n
akira added the comment:
Could `read_nonblocking()`, `write_nonblocking()` raise OSError(EAGAIN) (it
could be named `ResourceTemporarilyUnavailableError`) if read/write would block?
It would allow to distinguish EOF (permanent condition) from "read/write would
block" (temporarily
akira added the comment:
>From https://docs.python.org/3/glossary.html#term-sequence
> An iterable which supports efficient element access using integer indices via
> the __getitem__() special method and defines a __len__() method that returns
> the length of the sequence.
.pa
akira added the comment:
You need to escape backslashes inside a Python string literal or use raw-string
literals:
>>> import json
>>> json.loads(r'["[\"Residential | Furniture | Cabinets\",\"119.99\"]"]')
[u'["Res
akira added the comment:
json.dumps works correctly in this case.
Both json/application rfc [1] and ecma json standard [2] say:
> All characters may be placed within the quotation marks, except for the
> characters that must be escaped: quotation mark (U+0022), reverse solidus
>
akira added the comment:
"byte must be in range [0, 256)"
- it hints at the builtin `range()` -- the intuition works for those who knows
what `range()` does
- it uses the standard math notation for half-open intervals [1] -- no Python
knowledge required (among other things)
- i
New submission from akira:
>>> from email.utils import mktime_tz, parsedate_tz
>>> mktime_tz(parsedate_tz('Thu, 1 Jan 1970 00:00:00 GMT'))
3600.0
It must returns `0` instead of `3600.0` assuming POSIX timestamp.
UTC offsets in 1970 and today are different from
Changes by akira <4kir4...@gmail.com>:
--
resolution: -> fixed
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue21267>
___
__
akira added the comment:
I've added the documentation patch with the outdated remark removed from
mktime_tz docs.
--
keywords: +patch
nosy: +akira
type: -> behavior
versions: +Python 3.2, Python 3.5
Added file: http://bugs.python.org/file34929/mktime_tz-d
Changes by akira <4kir4...@gmail.com>:
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue21302>
___
___
Python-bugs-list mailing list
Unsubsc
akira added the comment:
Should socket.sendfile() always return number of bytes sent because file.tell()
may be changed by something else that uses the same file descriptor?
What happens if the file grows?
Instead of returning `(was_os_sendfile_used, os_sendfile_error)`, you could
specify
akira added the comment:
> I really don't like the use_fallback argument ..
I initially also thought so. But I've suggested the parameter to replace
`(was_os_sendfile_used, os_sendfile_error)` returned value as a *trade off*
between a slight complexity in the interface vs. allow
Changes by akira <4kir4...@gmail.com>:
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue21332>
___
___
Python-bugs-list mailing list
Unsubsc
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 o
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 `s
akira added the comment:
count and blocksize are completely different.
*count* specifies how many bytes at most socket.sendfile should sent overall.
It may change the result i.e., it may not be necessary that the file is read
until EOF.
It has the same meaning as *nbytes* parameter for
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 exis
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
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
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
<http://bugs.python.org/issue19
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
akira added the comment:
Antoine, thank you for reviewing. I appreciate the patience.
--
___
Python tracker
<http://bugs.python.org/issue19940>
___
___
Python-bug
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
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)
akira added the comment:
Related issue #21396
--
___
Python tracker
<http://bugs.python.org/issue21332>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 indic
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 Pyth
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
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
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
<http://bugs.py
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-err
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
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/L
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):
""&
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.
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
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
<http://bugs.python.org/is
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 that
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
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 SH
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
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
<http://bugs.python.
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
akira added the comment:
Related issue #21542: pprint support for multiline collections.Counter
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue7
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/1
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 EO
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
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 dete
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 questi
akira added the comment:
Summary: It is a new behavior. There is no need to change either code or
docs. Though docs could be clarified to be more explicit.
The behavior has been introduced only in 3.3 in revision 53715804dc71
[1] from issue 10050 [2]
It knownly breaks backward
akira added the comment:
Related issue 16409
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue10050>
___
___
Python-bugs-list mailing list
Unsub
akira added the comment:
Related issue 16409
--
nosy: +akira
___
Python tracker
<http://bugs.python.org/issue1490929>
___
___
Python-bugs-list mailing list
Unsub
akira added the comment:
The summary assumes that issue 10050 is valid i.e., urlretrieve is
reimplemented using new urlopen and 2.x FancyURLopener is deprecated.
It might not be so [1]. In this case the summary is incorrect.
Old implementation is available as:
opener = FancyURLopener
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 that are
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:
>>
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
akira added the comment:
btw, pypy3 (986752d005bb) is broken:
>>>> (1, float('nan')) == (1, float('nan'))
True
--
___
Python tracker
&l
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
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, whatev
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` t
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
>>&g
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
st
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 subproc
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)
akira added the comment:
STINNER Victor 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
> Connecti
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 fro
New submission from akira:
cert_time_to_seconds() uses `time.mktime()` [1] to convert utc time tuple to
seconds since epoch. `mktime()` works with local time. It should use
`calendar.timegm()` analog instead.
Example from the docs [2] is seven hours off (it shows utc offset of the local
akira added the comment:
gudge,
There is also an issue with the current strptime format [1] (`"%b %d %H:%M:%S
%Y GMT"`). It is locale-dependent and it may fail if a non-English locale is in
effect. I don't know whether I should open a new issue on this or are you going
New submission from akira:
`SubprocessProtocol` is documented to be accessible as
`asyncio.SubprocessProtocol` [1] but it is not included in
`asyncio.protocols.__all__` [2] that leads to `AttributeError`:
python3.4 -c "import asyncio; asyncio.SubprocessProtocol"
Trace
akira added the comment:
gudge, have you seen http://bugs.python.org/msg205860 (the locale issue)?
If you can't fix it; say so, I'll open another issue after this issue is fixed.
--
___
Python tracker
<http://bugs.python.o
akira added the comment:
The point of the locale issue is that "notBefore", "notAfter" strings do not
change if your locale changes. You don't need a new regex for each locale.
I've attached ssl_cert_time_seconds.py file that contains example
cert_time_to_sec
1 - 100 of 443 matches
Mail list logo