[issue28297] sched module example has wrong output

2016-09-28 Thread Xiang Zhang
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

[issue28297] sched module example has wrong output

2016-09-28 Thread Xiang Zhang
Changes by Xiang Zhang : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue28297> ___ ___

[issue28295] PyUnicode_AsUCS4 doc and impl conflict on exception

2016-09-28 Thread Xiang Zhang
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

[issue28310] Mixing yield and return with value is allowed

2016-09-29 Thread Xiang Zhang
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

[issue28295] PyUnicode_AsUCS4 doc and impl conflict on exception

2016-09-29 Thread Xiang Zhang
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

[issue28295] PyUnicode_AsUCS4 doc and impl conflict on exception

2016-10-02 Thread Xiang Zhang
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

[issue28295] PyUnicode_AsUCS4 doc and impl conflict on exception

2016-10-02 Thread Xiang Zhang
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

[issue28295] PyUnicode_AsUCS4 doc and impl conflict on exception

2016-10-02 Thread Xiang Zhang
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

[issue28379] PyUnicode_CopyCharacters could lead to undefined behaviour

2016-10-06 Thread Xiang Zhang
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

[issue28379] PyUnicode_CopyCharacters could lead to undefined behaviour

2016-10-06 Thread Xiang Zhang
Changes by Xiang Zhang : Removed file: http://bugs.python.org/file44989/PyUnicode_CopyCharacters.patch ___ Python tracker <http://bugs.python.org/issue28379> ___ ___ Pytho

[issue28379] PyUnicode_CopyCharacters could lead to undefined behaviour

2016-10-06 Thread Xiang Zhang
Changes by Xiang Zhang : Added file: http://bugs.python.org/file44990/PyUnicode_CopyCharacters.patch ___ Python tracker <http://bugs.python.org/issue28379> ___ ___ Pytho

[issue28379] PyUnicode_CopyCharacters could lead to undefined behaviour

2016-10-07 Thread Xiang Zhang
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

[issue28379] PyUnicode_CopyCharacters could lead to undefined behaviour

2016-10-08 Thread Xiang Zhang
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

[issue28379] PyUnicode_CopyCharacters could lead to undefined behaviour

2016-10-09 Thread Xiang Zhang
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

[issue28398] Return singleton empty string in _PyUnicode_FromASCII

2016-10-09 Thread Xiang Zhang
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

[issue28379] PyUnicode_CopyCharacters could lead to undefined behaviour

2016-10-09 Thread Xiang Zhang
Xiang Zhang added the comment: Fine. :-) -- ___ Python tracker <http://bugs.python.org/issue28379> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28400] Remove uncessary checks in unicode_char and resize_copy

2016-10-09 Thread Xiang Zhang
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

[issue28398] Return singleton empty string in _PyUnicode_FromASCII

2016-10-09 Thread Xiang Zhang
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

[issue28405] Compile error on Modules/_futuresmodule.c

2016-10-10 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +inada.naoki, yselivanov ___ Python tracker <http://bugs.python.org/issue28405> ___ ___ Python-bugs-list mailing list Unsub

[issue28406] Possible PyUnicode_InternInPlace() edge-case bug

2016-10-10 Thread Xiang Zhang
Xiang Zhang added the comment: The code has already been changed in #27454. -- nosy: +xiang.zhang ___ Python tracker <http://bugs.python.org/issue28406> ___ ___

[issue28408] Fix redundant code and memory leak in _PyUnicodeWriter_Finish

2016-10-10 Thread Xiang Zhang
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

[issue28409] test.regrtest does not support multiple -x flags

2016-10-10 Thread Xiang Zhang
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.

[issue28409] test.regrtest does not support multiple -x flags

2016-10-10 Thread Xiang Zhang
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

[issue28409] test.regrtest does not support multiple -x flags

2016-10-10 Thread Xiang Zhang
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

[issue28415] PyUnicode_FromFromat interger format handling different from printf about zeropad

2016-10-11 Thread Xiang Zhang
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

[issue28417] va_end twice in PyUnicode_FromFormatV

2016-10-11 Thread Xiang Zhang
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

[issue28420] is ok

2016-10-11 Thread Xiang Zhang
Changes by Xiang Zhang : -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue28420> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue28426] PyUnicode_AsDecodedObject can only return unicode now

2016-10-12 Thread Xiang Zhang
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

[issue28432] Fix doc of PyUnicode_EncodeLocale

2016-10-13 Thread Xiang Zhang
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

[issue28435] test_urllib2_localnet.ProxyAuthTests fails with no_proxy and NO_PROXY env

2016-10-13 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +martin.panter ___ Python tracker <http://bugs.python.org/issue28435> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28426] PyUnicode_AsDecodedObject can only return unicode now

2016-10-13 Thread Xiang Zhang
Xiang Zhang added the comment: +1 for 2). Patch looks good. -- ___ Python tracker <http://bugs.python.org/issue28426> ___ ___ Python-bugs-list mailing list Unsub

[issue28424] pkgutil.get_data() doesn't work with namespace packages

2016-10-13 Thread Xiang Zhang
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,

[issue28438] Wrong link in pkgutil.get_data doc

2016-10-13 Thread Xiang Zhang
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.

[issue28438] Wrong link in pkgutil.get_data doc

2016-10-13 Thread Xiang Zhang
Xiang Zhang added the comment: Thanks Senthil. -- ___ Python tracker <http://bugs.python.org/issue28438> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28439] Remove redundant checks in PyUnicode_EncodeLocale

2016-10-14 Thread Xiang Zhang
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

[issue28445] Wrong documentation for GzipFile.peek

2016-10-14 Thread Xiang Zhang
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

[issue28442] tuple(a list subclass) does not iterate through the list

2016-10-14 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +xiang.zhang ___ Python tracker <http://bugs.python.org/issue28442> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28454] Spurious arguments to PyErr_Format in unicodeobject.c

2016-10-16 Thread Xiang Zhang
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

[issue28439] Remove redundant checks in PyUnicode_EncodeLocale

2016-10-16 Thread Xiang Zhang
Changes by Xiang Zhang : Removed file: http://bugs.python.org/file45089/PyUnicode_EncodeLocale.patch ___ Python tracker <http://bugs.python.org/issue28439> ___ ___ Pytho

[issue28439] Remove redundant checks in PyUnicode_EncodeLocale and PyUnicode_DecodeLocaleAndSize

2016-10-16 Thread Xiang Zhang
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

[issue27931] Email parse IndexError <""@wiarcom.com>

2016-10-17 Thread Xiang Zhang
Xiang Zhang added the comment: Ping. -- ___ Python tracker <http://bugs.python.org/issue27931> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28439] Remove redundant checks in PyUnicode_EncodeLocale and PyUnicode_DecodeLocaleAndSize

2016-10-21 Thread Xiang Zhang
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

[issue28504] Cleanup unicode_decode_call_errorhandler_wchar/writer

2016-10-22 Thread Xiang Zhang
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

[issue28508] Need way to expose incremental size of key sharing dicts

2016-10-22 Thread Xiang Zhang
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

[issue28509] Key-sharing dictionaries can inrease the memory consumption

2016-10-22 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +xiang.zhang ___ Python tracker <http://bugs.python.org/issue28509> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28510] PyUnicodeDecodeError_GetObject always return bytes

2016-10-22 Thread Xiang Zhang
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

[issue28511] Use the "U" format for parsing Unicode object arg in PyArg_Parse*

2016-10-23 Thread Xiang Zhang
Changes by Xiang Zhang : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <http://bugs.python.or

[issue28518] execute("begin immediate") throwing OperationalError

2016-10-24 Thread Xiang Zhang
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

[issue28426] PyUnicode_AsDecodedObject can only return unicode now

2016-10-24 Thread Xiang Zhang
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

[issue28524] Set default argument of logging.disable() to logging.CRITICAL

2016-10-24 Thread Xiang Zhang
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

[issue28524] Set default argument of logging.disable() to logging.CRITICAL

2016-10-24 Thread Xiang Zhang
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

[issue28426] PyUnicode_AsDecodedObject can only return unicode now

2016-10-25 Thread Xiang Zhang
Xiang Zhang added the comment: LGTM. I can understand the wording. -- ___ Python tracker <http://bugs.python.org/issue28426> ___ ___ Python-bugs-list mailin

[issue28531] Improve utf7 encoder memory usage

2016-10-25 Thread Xiang Zhang
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

[issue28531] Improve utf7 encoder memory usage

2016-10-25 Thread Xiang Zhang
Changes by Xiang Zhang : Removed file: http://bugs.python.org/file45219/utf7_encoder.patch ___ Python tracker <http://bugs.python.org/issue28531> ___ ___ Python-bug

[issue28531] Improve utf7 encoder memory usage

2016-10-25 Thread Xiang Zhang
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

[issue28543] Incomplete fast path codecs aliases in codecs doc

2016-10-27 Thread Xiang Zhang
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

[issue28531] Improve utf7 encoder memory usage

2016-10-27 Thread Xiang Zhang
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

[issue28531] Improve utf7 encoder memory usage

2016-10-27 Thread Xiang Zhang
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

[issue28353] os.fwalk() unhandled exception when error occurs accessing symbolic link target

2016-10-27 Thread Xiang Zhang
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 &

[issue28353] os.fwalk() unhandled exception when error occurs accessing symbolic link target

2016-10-27 Thread Xiang Zhang
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

[issue28353] os.fwalk() unhandled exception when error occurs accessing symbolic link target

2016-10-27 Thread Xiang Zhang
Xiang Zhang added the comment: It works. Close. :-) -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue28353> ___ ___ Python-bugs-lis

[issue28199] Compact dict resizing is doing too much work

2016-10-28 Thread Xiang Zhang
Xiang Zhang added the comment: Hmm, what's the advantage? -- ___ Python tracker <http://bugs.python.org/issue28199> ___ ___ Python-bugs-list mailing list

[issue28199] Compact dict resizing is doing too much work

2016-10-28 Thread Xiang Zhang
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)' ..

[issue27683] ipaddress subnet slicing iterator malfunction

2016-10-28 Thread Xiang Zhang
Xiang Zhang added the comment: Ping. ;-) -- nosy: +pmoody ___ Python tracker <http://bugs.python.org/issue27683> ___ ___ Python-bugs-list mailing list Unsub

[issue28199] Compact dict resizing is doing too much work

2016-10-28 Thread Xiang Zhang
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 +

[issue26578] Bad BaseHTTPRequestHandler response when using HTTP/0.9

2016-10-29 Thread Xiang Zhang
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". -- __

[issue28558] argparse Incorrect Handling of Store Actions

2016-10-29 Thread Xiang Zhang
Changes by Xiang Zhang : -- stage: -> resolved ___ Python tracker <http://bugs.python.org/issue28558> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue28558] argparse Incorrect Handling of Store Actions

2016-10-29 Thread Xiang Zhang
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. -

[issue28561] Report surrogate characters range in utf8_encoder

2016-10-30 Thread Xiang Zhang
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

[issue28561] Report surrogate characters range in utf8_encoder

2016-10-30 Thread Xiang Zhang
Changes by Xiang Zhang : Added file: http://bugs.python.org/file45273/utf8_encoder_v2.patch ___ Python tracker <http://bugs.python.org/issue28561> ___ ___ Python-bug

[issue28513] Document zipfile CLI

2016-10-30 Thread Xiang Zhang
Xiang Zhang added the comment: LGTM. -- nosy: +xiang.zhang ___ Python tracker <http://bugs.python.org/issue28513> ___ ___ Python-bugs-list mailing list Unsub

[issue28565] datetime.strptime %Z doesn't get included in the result

2016-10-30 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +belopolsky ___ Python tracker <http://bugs.python.org/issue28565> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28564] shutil.rmtree is inefficient due to listdir() instead of scandir()

2016-10-31 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +xiang.zhang ___ Python tracker <http://bugs.python.org/issue28564> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28563] Arbitrary code execution in gettext.c2py

2016-10-31 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +xiang.zhang ___ Python tracker <http://bugs.python.org/issue28563> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-10-31 Thread Xiang Zhang
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

[issue28199] Compact dict resizing is doing too much work

2016-10-31 Thread Xiang Zhang
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

[issue28199] Compact dict resizing is doing too much work

2016-10-31 Thread Xiang Zhang
Changes by Xiang Zhang : -- Removed message: http://bugs.python.org/msg279811 ___ Python tracker <http://bugs.python.org/issue28199> ___ ___ Python-bugs-list m

[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-10-31 Thread Xiang Zhang
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

[issue28577] ipaddress.ip_network(...).hosts() returns nothing for an IPv4 /32

2016-11-01 Thread Xiang Zhang
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

[issue28577] ipaddress.ip_network(...).hosts() returns nothing for an IPv4 /32

2016-11-01 Thread Xiang Zhang
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

[issue28577] ipaddress.ip_network(...).hosts() returns nothing for an IPv4 /32

2016-11-01 Thread Xiang Zhang
Xiang Zhang added the comment: Sorry, it's #27683. -- ___ Python tracker <http://bugs.python.org/issue28577> ___ ___ Python-bugs-list mailing list Unsubscr

[issue28199] Compact dict resizing is doing too much work

2016-11-01 Thread Xiang Zhang
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

[issue28580] Optimise _PyDict_Next for split table

2016-11-01 Thread Xiang Zhang
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

[issue28580] Optimize _PyDict_Next for split table

2016-11-01 Thread Xiang Zhang
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

[issue28583] PyDict_SetDefault doesn't combine split table when needed

2016-11-01 Thread Xiang Zhang
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

[issue28199] Compact dict resizing is doing too much work

2016-11-01 Thread Xiang Zhang
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

[issue28583] PyDict_SetDefault doesn't combine split table when needed

2016-11-02 Thread Xiang Zhang
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

[issue28580] Optimize iterating split table values

2016-11-02 Thread Xiang Zhang
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

[issue28580] Optimize iterating split table values

2016-11-02 Thread Xiang Zhang
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

[issue28580] Optimize iterating split table values

2016-11-02 Thread Xiang Zhang
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

[issue28580] Optimize iterating split table values

2016-11-02 Thread Xiang Zhang
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)]' '

[issue28580] Optimize iterating split table values

2016-11-02 Thread Xiang Zhang
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

[issue28580] Optimize iterating split table values

2016-11-02 Thread Xiang Zhang
Changes by Xiang Zhang : Added file: http://bugs.python.org/file45330/iterate_splittable_v3.patch ___ Python tracker <http://bugs.python.org/issue28580> ___ ___ Python-bug

[issue28591] imghdr doesn't recognize some jpeg formats

2016-11-02 Thread Xiang Zhang
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

[issue28580] Optimize iterating split table values

2016-11-03 Thread Xiang Zhang
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 >>>

[issue28580] Optimize iterating split table values

2016-11-03 Thread Xiang Zhang
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

[issue28580] Optimize iterating split table values

2016-11-03 Thread Xiang Zhang
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. -- __

[issue28594] List define and Change result

2016-11-03 Thread Xiang Zhang
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

[issue28580] Optimize iterating split table values

2016-11-03 Thread Xiang Zhang
Changes by Xiang Zhang : Added file: http://bugs.python.org/file45332/iterate_splittable_v4.patch ___ Python tracker <http://bugs.python.org/issue28580> ___ ___ Python-bug

[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-11-03 Thread Xiang Zhang
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

<    12   13   14   15   16   17   18   >