Xiang Zhang added the comment:
> The name _PyUnicode_CompareWithIdEqual looks too long to me. What about
> _PyUnicode_EqualToId?
+1. I think this name is more clear.
Serhiy's idea on the implementation sounds good. As for _PyUnicode_FROM_ID, I
think it's better f
Changes by Xiang Zhang :
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue24339>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Xiang Zhang :
--
stage: -> resolved
___
Python tracker
<http://bugs.python.org/issue28679>
___
___
Python-bugs-list mailing list
Unsubscrib
Xiang Zhang added the comment:
I think this is a bug in 2.7.5 and has already been fixed. I'd suggest you get
a more recent version of 2.7. :-)
--
___
Python tracker
<http://bugs.python.org/is
Xiang Zhang added the comment:
Sorry Yudai, I cannot reproduce this. Both '/index.py?value=data' and
'/index.py?/' outputs 'value = None' with your index.py.
--
nosy: +martin.panter, xiang.zhang
___
Python tracker
<
Xiang Zhang added the comment:
v3 updates the test cases.
--
Added file: http://bugs.python.org/file45444/slots_special_v3.patch
___
Python tracker
<http://bugs.python.org/issue24
Xiang Zhang added the comment:
is an empty tag. It closes it self, not '/>'.
With some content, you can see it has start and end tag.
>>> import xml.etree.cElementTree as ET
>>> events = ET.Element('Events')
>>> events.text = 'abc'
Xiang Zhang added the comment:
s/not/note
--
___
Python tracker
<http://bugs.python.org/issue28659>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
slots_special_v2 fixes a bug in the previous patch.
--
Added file: http://bugs.python.org/file45425/slots_special_v2.patch
___
Python tracker
<http://bugs.python.org/issue24
Xiang Zhang added the comment:
> What about other names set when creating a class? __module__, __class__,
> __classcell__?
__module__ remains in the class dict so I think it's a class variable.
Will __class__ be set? It's inserted into the function scope.
__classcell__ I th
Changes by Xiang Zhang :
Added file: http://bugs.python.org/file45421/slots_qualname_v2.patch
___
Python tracker
<http://bugs.python.org/issue24329>
___
___
Python-bug
Xiang Zhang added the comment:
I think of them but currently they don't pose a problem for practical codes
like __qualname__. Maybe leaving them until there comes a real need?
--
___
Python tracker
<http://bugs.python.org/is
Changes by Xiang Zhang :
--
keywords: +patch
stage: -> patch review
type: -> behavior
Added file: http://bugs.python.org/file45420/slots_qualname.patch
___
Python tracker
<http://bugs.python.org/i
Xiang Zhang added the comment:
Why should it work Yury?
__qualname__ and __doc__(if exists) are inserted into the dict when creating a
class.
>>> class Foo:
... """bar"""
... __slots__ = ('__doc__',)
...
Traceback (most recent call l
New submission from Xiang Zhang:
The assert statement `assert(Py_UNICODE_IS_SURROGATE(ch));` in
_Py_DecodeUTF8_surrogateescape is wrong. Code points > 0x could reach it
and fail.
--
files: false_assert.patch
keywords: patch
messages: 280406
nosy: serhiy.storchaka, xiang.zh
Xiang Zhang added the comment:
The bug is fixed in #23319. More recent Py2.7 and Py3.4+ should get rid of it.
--
nosy: +xiang.zhang
resolution: -> fixed
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bug
Xiang Zhang added the comment:
> What a comment you need Xiang? Isn't existing comment enough?
Serhiy, I mean the case a number starting with 0, e.g. 0123. The plural form is
a C expression and in C 0123 is an octal number. c2py now interprets it as a
decima
Xiang Zhang added the comment:
LGTM. And I expect there could be a comment about the special decimal number.
--
___
Python tracker
<http://bugs.python.org/issue28
Xiang Zhang added the comment:
> Yes. But first import time is also important for CLI applications.
That's why mercurial and Bazaar has lazy import system.
The lazy import system could benefit many libs so the result could be
impressive. But here only functools is enhanced, half a mil
Changes by Xiang Zhang :
--
nosy: +ncoghlan, rhettinger
___
Python tracker
<http://bugs.python.org/issue28638>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
I doubt this deserves a change. The slow import is the case only the first time
functools is imported. Later imports will just use the cache (sys.modules). And
if this is gonna change, maybe we don't have to copy the entire namedtuple
structure?
--
Xiang Zhang added the comment:
> Sorry Xiang, but your patch looks overcomplicated to me. Too much methods,
> decorators, classes, too much strange names.
It's fine. That's a Pratt parser. Yes, the names are strange. Your patch looks
more simpler. I left
Xiang Zhang added the comment:
> Perhaps it should give a DeprectationWarning and delegate to _Plural?
I hold a conservative opinion about this. c2py in my mind should be a inner
help method. It's not documented so if there are users using it, they are
risking changes. And as repor
Xiang Zhang added the comment:
IMHO, _PyUnicode_FromASCII is a private API and could be used in other places
in future. We should not rely on the caller to check and return the singleton
empty string.
--
___
Python tracker
<http://bugs.python.
Xiang Zhang added the comment:
gettext_c2py_v2.patch implements a simple C expression parser. More tests are
included.
Carl, hope you are willing to test it.
--
Added file: http://bugs.python.org/file45373/gettext_c2py_v2.patch
___
Python tracker
Xiang Zhang added the comment:
Christian, I think our patches are quite similar in function. They only allow
limited tokens.
> I consider it a superior solution and a fix for more generic attacks
Mine now still allows **. But it can be easily fixed.
But both our patches still translate
Xiang Zhang added the comment:
This seems a same problem as in #27780.
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28620>
___
___
Pytho
Xiang Zhang added the comment:
> '1?2:3?4:5' -> '(2 if 1 else 3)?4:5' -> '(4 if (2 if 1 else 3) else 5'
This is not right. It's right associative so it should be
1?2:(3?4:5) -> 1?2:(4 if 3 else 5) -> 2 if 1 else (4 if 3 else 5)
> It woul
Xiang Zhang added the comment:
> gettext.c2py("n()")(lambda: os.system("sh"))
> gettext.c2py("1()")(0)
Empty parentheses should be disallowed. Function calls are not allowed in
plural expression. And non-integer argument should be disallowed either, just
a
Xiang Zhang added the comment:
#28580 and #28583 are resolved now. I think dictresize4 can be recommited now.
--
stage: needs patch -> commit review
___
Python tracker
<http://bugs.python.org/issu
Xiang Zhang added the comment:
Thanks!
--
___
Python tracker
<http://bugs.python.org/issue28580>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
gettext_c2py.patch tries to avoid the problem. It still uses eval but manually
parse the expression using tokens extracted from gettext. Tests are passed.
But there is still a problem. Both patched and original c2py fail to handle
nested ternary operator. They
Changes by Xiang Zhang :
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28598>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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:
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
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:
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:
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:
There is also #27121 reporting similar problem.
--
nosy: +xiang.zhang
versions: -Python 3.3, Python 3.4
___
Python tracker
<http://bugs.python.org/issue28
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:
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
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:
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:
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:
> 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 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:
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
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
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:
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
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
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 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:
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
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
Changes by Xiang Zhang :
--
Removed message: http://bugs.python.org/msg279811
___
Python tracker
<http://bugs.python.org/issue28199>
___
___
Python-bugs-list m
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
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
Changes by Xiang Zhang :
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28563>
___
___
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: +belopolsky
___
Python tracker
<http://bugs.python.org/issue28565>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 :
Added file: http://bugs.python.org/file45273/utf8_encoder_v2.patch
___
Python tracker
<http://bugs.python.org/issue28561>
___
___
Python-bug
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
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.
-
Changes by Xiang Zhang :
--
stage: -> resolved
___
Python tracker
<http://bugs.python.org/issue28558>
___
___
Python-bugs-list mailing list
Unsubscrib
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".
--
__
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:
Ping. ;-)
--
nosy: +pmoody
___
Python tracker
<http://bugs.python.org/issue27683>
___
___
Python-bugs-list mailing list
Unsub
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:
Hmm, what's the advantage?
--
___
Python tracker
<http://bugs.python.org/issue28199>
___
___
Python-bugs-list mailing list
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:
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:
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:
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:
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
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
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
Changes by Xiang Zhang :
Removed file: http://bugs.python.org/file45219/utf7_encoder.patch
___
Python tracker
<http://bugs.python.org/issue28531>
___
___
Python-bug
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
Xiang Zhang added the comment:
LGTM. I can understand the wording.
--
___
Python tracker
<http://bugs.python.org/issue28426>
___
___
Python-bugs-list mailin
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:
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:
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:
Looks like commit 284676cf2ac8 in #10740 introduces this. Haven't read through
the thread yet.
--
___
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:
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 :
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28509>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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:
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
Xiang Zhang added the comment:
Ping.
--
___
Python tracker
<http://bugs.python.org/issue27931>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
Changes by Xiang Zhang :
Removed file: http://bugs.python.org/file45089/PyUnicode_EncodeLocale.patch
___
Python tracker
<http://bugs.python.org/issue28439>
___
___
Pytho
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 :
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28442>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 :
--
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:
Thanks Senthil.
--
___
Python tracker
<http://bugs.python.org/issue28438>
___
___
Python-bugs-list mailing list
Unsubscribe:
901 - 1000 of 1629 matches
Mail list logo