Xiang Zhang added the comment:
Sorry, it's not 930343695.274 vs 930343695.275. I mean the register time is
time.time() + delay, so there is tiny difference between the two. You can
change the timefunc to lambda: int(time.time()), then you'll see keyword is
pri
Changes by Xiang Zhang :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue28297>
___
___
Xiang Zhang added the comment:
Here is the patch.
--
keywords: +patch
stage: -> patch review
Added file: http://bugs.python.org/file44870/PyUnicode_AsUCS4.patch
___
Python tracker
<http://bugs.python.org/issu
Xiang Zhang added the comment:
`return value` is allowed in a generator to support `yield from'. You can read
https://www.python.org/dev/peps/pep-0380 for the entire story.
--
nosy: +xiang.zhang
resolution: -> not a bug
stage: -> resolved
status: ope
Xiang Zhang added the comment:
v2 now adds more tests and change the problematic variable name.
--
Added file: http://bugs.python.org/file44889/PyUnicode_AsUCS4_v2.patch
___
Python tracker
<http://bugs.python.org/issue28
Xiang Zhang added the comment:
v3 resolves comments on v2.
--
Added file: http://bugs.python.org/file44928/PyUnicode_AsUCS4_v3.patch
___
Python tracker
<http://bugs.python.org/issue28
Xiang Zhang added the comment:
Yes. Changing the implementation or the doc is still in question so in the
title I just use conflicts. Scanning unicodeobject.c there seems no general
rules about which to use. But actually I'm in favour of ValueError. From the
description in
Xiang Zhang added the comment:
Serhiy, in 05788a9a0b88, test_invalid_sequences seems don't have to stay in
CAPITest.
--
___
Python tracker
<http://bugs.python.org/is
New submission from Xiang Zhang:
Currently PyUnicode_CopyCharacters doesn't check arguments thoroughly. This
could lead to undefined behaviour or crash in debug mode. For example,
from_start > len(from), how_many < 0. Another case is that when how_many >
len(from), it will c
Changes by Xiang Zhang :
Removed file: http://bugs.python.org/file44989/PyUnicode_CopyCharacters.patch
___
Python tracker
<http://bugs.python.org/issue28379>
___
___
Pytho
Changes by Xiang Zhang :
Added file: http://bugs.python.org/file44990/PyUnicode_CopyCharacters.patch
___
Python tracker
<http://bugs.python.org/issue28379>
___
___
Pytho
Xiang Zhang added the comment:
v2 applies Serhiy's suggestions.
--
Added file: http://bugs.python.org/file45001/PyUnicode_CopyCharacters_v2.patch
___
Python tracker
<http://bugs.python.org/is
Xiang Zhang added the comment:
Thanks Serhiy! But sorry I think I have made a mistake. In
unicode_copycharacters we don't need PyUnicode_READY since it has been done in
argument parse. Could you remove it?
--
stage: resolved -> patch review
status: closed -> open
Added
Xiang Zhang added the comment:
We don't need to remove it for 3.5 and 3.6?
--
___
Python tracker
<http://bugs.python.org/issue28379>
___
___
Python-bugs-l
New submission from Xiang Zhang:
Right now in _PyUnicode_FromASCII, it only optimises for size 1 not size 0. All
other places getting the same situation in unicodeobject.c do both.
--
files: _PyUnicode_FromASCII.patch
keywords: patch
messages: 278364
nosy: haypo, serhiy.storchaka
Xiang Zhang added the comment:
Fine. :-)
--
___
Python tracker
<http://bugs.python.org/issue28379>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Xiang Zhang:
In resize_copy we don't need to PyUnicode_READY(unicode) since when it's not
PyUnicode_WCHAR_KIND it should be ready.
In unicode_char, PyUnicode_1BYTE_KIND is handled by get_latin1_char.
--
components: Interpreter
Xiang Zhang added the comment:
The cost is really small (an integer compare vs memory malloc and copy). The
advantages are fast path for empty strings and retaining consistency with other
codes in unicodeobject.c. You can see other places use the same optimization,
e.g. PyUnicode_FromUnicode
Changes by Xiang Zhang :
--
nosy: +inada.naoki, yselivanov
___
Python tracker
<http://bugs.python.org/issue28405>
___
___
Python-bugs-list mailing list
Unsub
Xiang Zhang added the comment:
The code has already been changed in #27454.
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28406>
___
___
New submission from Xiang Zhang:
_PyUnicodeWriter_Finish gets 2 problems now:
1. It has two same branches handling empty strings which is redundant.
2. It may leak the inner buffer object when resize_compact fails. When
resize_compact fails, the buffer object is left untouched. Then the
Xiang Zhang added the comment:
This regression is introduced in 4df2d43e995d.
And actually to skip multiple tests, you should use python3 -m test.regrtest -x
test_venv test_gdb. Although Charalampos's example could work, it actually
treats -x as a test.
--
nosy: +xiang.
Xiang Zhang added the comment:
So should we still consider this a regression? Actually -x is used as a hint
flag and should not be used as -x arg pair. The right usage could still work
now.
--
___
Python tracker
<http://bugs.python.org/issue28
Xiang Zhang added the comment:
> ./python -m test.regrtest test_unary -v test_binop
> ./python -m test.regrtest test_unary -u all test_binop
These also fail in 3.6.0a4. You can only specify options after args now.
test_binop is not valid option. Isn't this the expecte
New submission from Xiang Zhang:
Although declared *exactly equivalent* to printf in the doc,
PyUnicode_FromFormat could generate different result from printf with the same
format.
For example:
from ctypes import pythonapi, py_object, c_int
f = getattr(pythonapi, 'PyUnicode_FromF
New submission from Xiang Zhang:
vargs2 could be va_end()ed twice in PyUnicode_FromFormatV when format contains
non-ascii characters. Once va_end()ed, vargs2 is undefined. So this could lead
to undefined behaviour.
--
components: Interpreter Core
files: PyUnicode_FromFormatV.patch
Changes by Xiang Zhang :
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue28420>
___
___
Python-bugs-list mailing list
Unsubscrib
New submission from Xiang Zhang:
PyUnicode_AsDecodedObject was added in f46d49e2e0f0 and became an API in
2284fa89ab08. It seems its intention is to return a Python object. But during
evolution, with commits 5f11621a6f51 and 123f2dc08b3e, it can only return
unicode now, becoming another
New submission from Xiang Zhang:
The doc of PyUnicode_EncodeLocale conflicts between signature and content. In
content, it should be *unicode* not *str*.
--
assignee: docs@python
components: Documentation
files: PyUnicode_EncodeLocale_doc.patch
keywords: patch
messages: 278583
nosy
Changes by Xiang Zhang :
--
nosy: +martin.panter
___
Python tracker
<http://bugs.python.org/issue28435>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
+1 for 2). Patch looks good.
--
___
Python tracker
<http://bugs.python.org/issue28426>
___
___
Python-bugs-list mailing list
Unsub
Xiang Zhang added the comment:
The doc says: "If the package cannot be located or loaded, or it uses a loader
which does not support get_data(), then None is returned". Namespace package
gets a ``None`` loader and then does not support get_data.
--
nosy: +brett.cannon,
New submission from Xiang Zhang:
The get_data link in pkgutil.get_data doc refers to itself which does not help
reading. I think it's better for it to refer to
importlib.abc.ResourceLoader.get_data.
--
assignee: docs@python
components: Documentation
files: pkgutil.get_data_doc.
Xiang Zhang added the comment:
Thanks Senthil.
--
___
Python tracker
<http://bugs.python.org/issue28438>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Xiang Zhang :
--
components: Interpreter Core
files: PyUnicode_EncodeLocale.patch
keywords: patch
nosy: haypo, serhiy.storchaka, xiang.zhang
priority: normal
severity: normal
stage: patch review
status: open
title: Remove redundant checks in PyUnicode_EncodeLocale
type
Xiang Zhang added the comment:
The "compressed stream" is not the underlying file object but _GzipReader. And
actually the "at most one single reader" is the characteristic of
io.BufferedReader.peek, you can see it in the doc. Maybe it needs multiple
reads on the file obj
Changes by Xiang Zhang :
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28442>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Xiang Zhang:
In unicodeobject.c, there are some spurious arguments to PyErr_Format as the
patch shows.
--
components: Interpreter Core
files: spurious_argument.patch
keywords: patch
messages: 278757
nosy: ncoghlan, xiang.zhang
priority: normal
severity: normal
stage
Changes by Xiang Zhang :
Removed file: http://bugs.python.org/file45089/PyUnicode_EncodeLocale.patch
___
Python tracker
<http://bugs.python.org/issue28439>
___
___
Pytho
Changes by Xiang Zhang :
--
title: Remove redundant checks in PyUnicode_EncodeLocale -> Remove redundant
checks in PyUnicode_EncodeLocale and PyUnicode_DecodeLocaleAndSize
Added file: http://bugs.python.org/file45118/issue28349.patch
___
Pyt
Xiang Zhang added the comment:
Ping.
--
___
Python tracker
<http://bugs.python.org/issue27931>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
Thanks for your review Serhiy.
I don't receive the notification. :-( Honestly speaking I miss some
notification emails from time to time, but not all. I'll consider choosing
another ISP. I have to manually check the Rietveld now to avoid missing any
New submission from Xiang Zhang:
The patch makes several cleanups to
unicode_decode_call_errorhandler_wchar/writer:
1. Use U instead O! for argument parser, it ought to be more efficient and
write less code.
2. In theory, if inputobj is not bytes, there needs to be a goto onError, or it
Xiang Zhang added the comment:
> Isn't this already implemented?
Get the same question. dict.__sizeof__ can identify shared dicts.
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org
Changes by Xiang Zhang :
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28509>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
LGTM.
Actually I just read the codecs error handles codes last day but didn't think
of this. :-(
--
___
Python tracker
<http://bugs.python.org/is
Changes by Xiang Zhang :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.or
Xiang Zhang added the comment:
Looks like commit 284676cf2ac8 in #10740 introduces this. Haven't read through
the thread yet.
--
___
Python tracker
<http://bugs.python.org/is
Xiang Zhang added the comment:
Marc-Andre, shouldn't the C API of unicode.encode() be
PyUnicode_AsEncodedString instead of PyUnicode_AsEncodedUnicode now?
BTW Serhiy, how about PyUnicode_AsEncodedObject? Not see it in your deprecate
Xiang Zhang added the comment:
Is disabling all logging messages a common need? Maybe other levels are common
but we can't know.
And at least the doc patch needs a versionchanged tag.
--
nosy: +xiang.zhang
___
Python tracker
Xiang Zhang added the comment:
> We could use sys.maxsize instead of logging.CRITICAL to disable any custom
> logging levels as well if this is a concern.
sys.maxsize is not the upper bound limit of integers in Python. There is no
such value in Python3.
> The use case I've f
Xiang Zhang added the comment:
LGTM. I can understand the wording.
--
___
Python tracker
<http://bugs.python.org/issue28426>
___
___
Python-bugs-list mailin
New submission from Xiang Zhang:
Currently utf7 encoder uses an aggressive memory allocation strategy: use the
worst case 8. We can tighten the worst case.
For 1 byte and 2 byte unicodes, the worst case could be 3*n + 2. For 4 byte
unicodes, the worst case could be 6*n + 2.
There are 2 cases
Changes by Xiang Zhang :
Removed file: http://bugs.python.org/file45219/utf7_encoder.patch
___
Python tracker
<http://bugs.python.org/issue28531>
___
___
Python-bug
Changes by Xiang Zhang :
Added file: http://bugs.python.org/file45220/utf7_encoder.patch
___
Python tracker
<http://bugs.python.org/issue28531>
___
___
Python-bugs-list m
New submission from Xiang Zhang:
The fast path codec aliases in codecs doc is complete especially after
99818330b4c0.
--
assignee: docs@python
components: Documentation
files: codecs_doc.patch
keywords: patch
messages: 279538
nosy: docs@python, haypo, xiang.zhang
priority: normal
Xiang Zhang added the comment:
v2 uses _PyBytesWriter so we can use on stack buffer for short string.
--
Added file: http://bugs.python.org/file45243/utf7_encoder_v2.patch
___
Python tracker
<http://bugs.python.org/issue28
Xiang Zhang added the comment:
Actually the patch is not going to speed up the encoder but just make the
memory allocation strategy better, make the memory upper bound tighter. The
speedup is just a good side effect.
> It is rather in the line of idna and punycode than UTF-8 and UTF
Xiang Zhang added the comment:
Serhiy, after your commits, test_os requires root privileges or it'll fail.
This is not the case before.
[cpython]$ ./python -m test test_os
Run tests sequentially
0:00:00 [1/1] test_os
test test_os crashed -- Traceback (most recent call last):
File &
Xiang Zhang added the comment:
Seems like the dir you add breaks other cases. I change addCleanUp to os.chmod
and get:
==
FAIL: test_file_like_path (test.test_os.BytesWalkTests
Xiang Zhang added the comment:
It works. Close. :-)
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue28353>
___
___
Python-bugs-lis
Xiang Zhang added the comment:
Hmm, what's the advantage?
--
___
Python tracker
<http://bugs.python.org/issue28199>
___
___
Python-bugs-list mailing list
Xiang Zhang added the comment:
I doubt how many memcpy could benefit. Two pass does not necessarily make
faster. I make a simple test:
With dictresize3, (I make insert_index inline):
[bin]$ ./python3 -m perf timeit -s 'd = {i:i for i in range(6)}' 'dict(d)'
..
Xiang Zhang added the comment:
Ping. ;-)
--
nosy: +pmoody
___
Python tracker
<http://bugs.python.org/issue27683>
___
___
Python-bugs-list mailing list
Unsub
Xiang Zhang added the comment:
If you inline insert_index, dictresize3 is not that bad.
./python3 -m perf timeit -s 'x = list(range(1000))' -- 'dict.fromkeys(x)'
dictresize3: Median +- std dev: 43.9 us +- 0.7 us
dictresize3(insert_index inlined): Median +- std dev: 41.6 us +
Xiang Zhang added the comment:
> So I would prefer to remove it in the next version of Python, and not bother
> fixing Xiang’s bug in existing versions.
+1. In rfc7230, "The expectation to support HTTP/0.9 requests has been removed".
--
__
Changes by Xiang Zhang :
--
stage: -> resolved
___
Python tracker
<http://bugs.python.org/issue28558>
___
___
Python-bugs-list mailing list
Unsubscrib
Xiang Zhang added the comment:
This is the expected behaviour. The doc explicitly says "Note that nargs=1
produces a list of one item. This is different from the default, in which the
item is produced by itself". Read
https://docs.python.org/3/library/argparse.html#nargs.
-
New submission from Xiang Zhang:
In utf8_encoder, when a codecs returns a string with non-ascii characters, it
raises encodeerror but the start and end position are not perfect. This seems
like an oversight during evolution. Before, utf8_encoder only recognize one
surrogate character a time
Changes by Xiang Zhang :
Added file: http://bugs.python.org/file45273/utf8_encoder_v2.patch
___
Python tracker
<http://bugs.python.org/issue28561>
___
___
Python-bug
Xiang Zhang added the comment:
LGTM.
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28513>
___
___
Python-bugs-list mailing list
Unsub
Changes by Xiang Zhang :
--
nosy: +belopolsky
___
Python tracker
<http://bugs.python.org/issue28565>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Xiang Zhang :
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28564>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Xiang Zhang :
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28563>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
dict_merge was altered after the patch. I make it ignore explicitly the error
now, to not affect former behaviour.
Serhiy, I apply your suggestion to use _PyLong_AsByteArray for Py_hash_t, but I
am not familiar with the API. It needs a review.
--
Added
Xiang Zhang added the comment:
The bug seems to lies in
https://hg.python.org/cpython/file/tip/Objects/dictobject.c#l1291. We should
use oldkeys->dk_nentries instead of numentries.
--
___
Python tracker
<http://bugs.python.org/issu
Changes by Xiang Zhang :
--
Removed message: http://bugs.python.org/msg279811
___
Python tracker
<http://bugs.python.org/issue28199>
___
___
Python-bugs-list m
Changes by Xiang Zhang :
Added file: http://bugs.python.org/file45299/issue28123_v5.patch
___
Python tracker
<http://bugs.python.org/issue28123>
___
___
Python-bugs-list m
Xiang Zhang added the comment:
hosts() won't return the network address itself and the network broadcast
address. So for 10.9.8.7/32, it should return [].
--
nosy: +xiang.zhang
resolution: -> not a bug
stage: -> resolved
status: ope
Xiang Zhang added the comment:
I am not sure. Actually there is a special case for mask 31, you can see
#27863. Its result includes both the network and broadcast address. Add Nick to
see his opinion.
FYI, ipaddress (ipaddr in Py2) always return empty for 32. But there is other
library
Xiang Zhang added the comment:
Sorry, it's #27683.
--
___
Python tracker
<http://bugs.python.org/issue28577>
___
___
Python-bugs-list mailing list
Unsubscr
Xiang Zhang added the comment:
I use gdb to run setuptools test suite and find the assumption, split tables
are always dense is broken for both dictresize3 and dictresize4.
#0 0x771171c7 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:55
#1 0x77118e2a
New submission from Xiang Zhang:
Since values of split table is always dense, we can optimise the current
implementation of _PyDict_Next. I think this could hardly bring much
performance enhancement. More importantly, this emphasizes the invariant and
make bugs easy to find and test
Changes by Xiang Zhang :
--
components: +Interpreter Core
title: Optimise _PyDict_Next for split table -> Optimize _PyDict_Next for split
table
versions: +Python 3.6, Python 3.7
___
Python tracker
<http://bugs.python.org/issu
New submission from Xiang Zhang:
PyDict_SetDefault doesn't combine split table when needed. This could lead to
loss of order or crash. This is a follow up of #28199.
--
components: Interpreter Core
messages: 279889
nosy: inada.naoki, serhiy.storchaka, xiang.zhang
priority: n
Xiang Zhang added the comment:
Open #28583 and #28580 to tackle this.
--
dependencies: +Optimize _PyDict_Next for split table, PyDict_SetDefault doesn't
combine split table when needed
___
Python tracker
<http://bugs.python.org/is
Xiang Zhang added the comment:
Here is a patch.
--
keywords: +patch
Added file: http://bugs.python.org/file45308/PyDict_SetDefault.patch
___
Python tracker
<http://bugs.python.org/issue28
Xiang Zhang added the comment:
> Xiang, would you update patch?
Working on it.
--
title: Optimize _PyDict_Next for split table -> Optimize iterating split table
values
___
Python tracker
<http://bugs.python.org/i
Xiang Zhang added the comment:
Here is the new patch to apply the optimization to more places.
--
Added file: http://bugs.python.org/file45312/iterate_splittable.patch
___
Python tracker
<http://bugs.python.org/issue28
Xiang Zhang added the comment:
Update the patch to use more obvious comparison way. This uses INADA's
suggestion and make the code more like other places.
I think the performance issue is better to be discussed in #28397. It doesn't
have a significant impact on this patch. Hope w
Xiang Zhang added the comment:
python -> unpatched, python3 -> patched
iterkeys:
(split)
./python3 -m perf timeit --compare-to /home/angwer/cpython/python -s 'from
argparse import Namespace; ns = Namespace(); [setattr(ns, str(i), str(i)) for i
in range(1)]' '
Xiang Zhang added the comment:
Yes, that's the point. I thought to expose an API in testcapimodule for test,
but actually I am not willing to do that since I don't believe this patch could
bring any visible performance change.
--
___
Pyth
Changes by Xiang Zhang :
Added file: http://bugs.python.org/file45330/iterate_splittable_v3.patch
___
Python tracker
<http://bugs.python.org/issue28580>
___
___
Python-bug
Xiang Zhang added the comment:
There is also #27121 reporting similar problem.
--
nosy: +xiang.zhang
versions: -Python 3.3, Python 3.4
___
Python tracker
<http://bugs.python.org/issue28
Xiang Zhang added the comment:
Hmm, the resolution could be simple. But how about
>>> d = dict.fromkeys(range(100))
>>> for k in range(98):
... del d[k]
...
>>> it = iter(d)
>>> next(it)
98
>>> d.clear()
>>> d[0] = 1
>>>
Xiang Zhang added the comment:
Currently dict iterator does not allow size changed during iteration. This is
more strict than list iterator but still allow modification during iteration.
Maybe we could deny all modification by checking dict->ma_version_tag. But
that's irrelevant to th
Xiang Zhang added the comment:
> I would suggest just remove assert() from your patch and address undefined
> behavior in other issue.
That's what v2 does. If there is another issue, let's also leave _PyDict_Next
to it.
--
__
Xiang Zhang added the comment:
In your last example, after x=y=[], you reassign a new list to y, so x and y
are different. In your my.py, you are altering the same list. Please read the
link Martin gives.
--
nosy: +xiang.zhang
status: open -> clo
Changes by Xiang Zhang :
Added file: http://bugs.python.org/file45332/iterate_splittable_v4.patch
___
Python tracker
<http://bugs.python.org/issue28580>
___
___
Python-bug
Xiang Zhang added the comment:
> If _PyDict_GetItem_KnownHash() returns an error, it is very likely that
> following insertdict() with same key will return an error.
Make sense.
--
assignee: haypo -> serhiy.storchaka
Added file: http://bugs.python.org/file45336/issue28123
1601 - 1700 of 1760 matches
Mail list logo