[issue27861] sqlite3 type confusion and multiple frees

2016-08-26 Thread Xiang Zhang
Xiang Zhang added the comment: I considered that but don't why decide to preserve it. But now that you mention it, I'll do that later. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/i

[issue27861] sqlite3 type confusion and multiple frees

2016-08-26 Thread Xiang Zhang
Xiang Zhang added the comment: issue27861_conn_isolation_level.patch now adds argument type and value check along with eliminating the potential sf. -- Added file: https://bugs.python.org/file44234/issue27861_conn_isolation_level.patch ___ Python

[issue27660] Replace size_t with Py_ssize_t as the type of local variable in list_resize

2016-08-22 Thread Xiang Zhang
Xiang Zhang added the comment: v3 applies haypo's suggestion. -- Added file: http://bugs.python.org/file44192/list_resize_v3.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue2466] os.path.ismount doesn't work for mounts the user doesn't have permission to see

2016-08-23 Thread Xiang Zhang
Xiang Zhang added the comment: Oh, sorry. Upload bot_failure_fix.patch to fix this. -- Added file: http://bugs.python.org/file44207/bot_failure_fix.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/

[issue27833] Process is locked when try to execute Queue.put() inside

2016-08-23 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- components: +Library (Lib) nosy: +davin type: -> behavior ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue26331] PEP 515: Tokenizer: allow underscores for grouping in numeric literals

2016-08-22 Thread Xiang Zhang
Xiang Zhang added the comment: Hi Georg, I left several comments on Rietveld. Hope it helps. -- nosy: +xiang.zhang ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27794] setattr a read-only property; the AttributeError should show the attribute that failed

2016-08-22 Thread Xiang Zhang
Xiang Zhang added the comment: One solution I can think of is alter the constructor of property() and add an optional name attribute to it. If users really care about the exception message, they can set the attribute to the property's name. If they don't care, everything remains the same

[issue27683] ipaddress subnet slicing iterator malfunction

2016-08-23 Thread Xiang Zhang
Xiang Zhang added the comment: issue27683.patch tries to fix this. It alters the doc and refactors the constructor, so there is no difference between different arguments As for IPv6Network, it has the same problem. -- nosy: +xiang.zhang Added file: http://bugs.python.org/file44193

[issue27860] Improvements to ipaddress module

2016-08-25 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- nosy: +xiang.zhang ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27860> ___ __

[issue27863] multiple issues in _elementtree module

2016-08-26 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- nosy: +xiang.zhang ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27863> ___ __

[issue27861] sqlite3 type confusion and multiple frees

2016-08-26 Thread Xiang Zhang
Xiang Zhang added the comment: For the first issue, the doc says: The cursor method accepts a single optional parameter cursorClass. If supplied, this must be a custom cursor class that extends sqlite3.Cursor. So I think we should check the type and then raise TypeError. For the second issue

[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-24 Thread Xiang Zhang
Xiang Zhang added the comment: Ping. :) -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27414> ___ ___ Python-bugs-list

[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-24 Thread Xiang Zhang
Xiang Zhang added the comment: Thanks for the reply berker. It's nice to know this helper. :) But I'd like to keep it as now since I don't see any real advantage to use it and swap_attr will set the attribute even when it's absent, this is not wanted

[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: open -&g

[issue28293] Don't completely dump the regex cache when full

2016-09-28 Thread Xiang Zhang
Xiang Zhang added the comment: Why not OrderedDict.popitem(last=False)? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28293> ___ __

[issue28293] Don't completely dump the regex cache when full

2016-09-27 Thread Xiang Zhang
Xiang Zhang added the comment: But with the compact dict implementation, popitem is not going to evict an arbitrary entry but always the last one. Will this cause two interchangeably used regexes always need to recompile? -- nosy: +xiang.zhang

[issue28297] sched module example has wrong output

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

[issue28297] sched module example has wrong output

2016-09-28 Thread Xiang Zhang
Xiang Zhang added the comment: Though the delay arguments of keyword and positional are both 5, but their register time has tiny difference: 930343695.274 vs 930343695.275, so positional is printed first. -- nosy: +xiang.zhang ___ Python tracker

[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 printed first

[issue28295] PyUnicode_AsUCS4 doc and impl conflict on exception

2016-09-28 Thread Xiang Zhang
New submission from Xiang Zhang: PyUnicode_AsUCS4 declares to raise ValueError if buffer length is smaller than string length. But now the implementation raises SystemError. -- components: Interpreter Core messages: 277595 nosy: haypo, serhiy.storchaka, xiang.zhang priority: normal

[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 https

[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 <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28253] calendar.prcal(9999) output has a problem

2016-09-26 Thread Xiang Zhang
Xiang Zhang added the comment: Patch LGTM. > I would rather not mess up with itermonthdates(), particularly in a bugfix > release. We can postpone the discussion of a better way to handle date > over/underflow in itermonthdates() until 3.7. Before finally find a better way, can we

[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 <rep...@bugs.python.org> <http://bugs.python.org/i

[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 <rep...@bugs.python.org> <http://bugs.python.or

[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

[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

[issue27683] ipaddress subnet slicing iterator malfunction

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

[issue28558] argparse Incorrect Handling of Store Actions

2016-10-29 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- stage: -> resolved ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28558> ___ ___

[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 <angwe...@126.com>: Added file: http://bugs.python.org/file45273/utf8_encoder_v2.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue20629] Python ctypes BigEndianStructure bitfield assignment misbehavior in Linux

2016-11-08 Thread Xiang Zhang
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 <rep...@bugs.pytho

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-05 Thread Xiang Zhang
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 would be nice to make c2py() working wi

[issue28620] Build Memory Leak

2016-11-05 Thread Xiang Zhang
Xiang Zhang added the comment: This seems a same problem as in #27780. -- nosy: +xiang.zhang ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28563] Arbitrary code execution in gettext.c2py

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

[issue28398] Return singleton empty string in _PyUnicode_FromASCII

2016-11-06 Thread Xiang Zhang
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 <rep...@bugs.python.

[issue28648] False assert in _Py_DecodeUTF8_surrogateescape

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

[issue24329] __qualname__ and __slots__

2016-11-09 Thread Xiang Zhang
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 last): Fi

[issue24329] __qualname__ and __slots__

2016-11-09 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- keywords: +patch stage: -> patch review type: -> behavior Added file: http://bugs.python.org/file45420/slots_qualname.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.

[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

2016-11-07 Thread Xiang Zhang
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? -- nosy

[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

2016-11-07 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- nosy: +ncoghlan, rhettinger ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28638> ___

[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

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

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-07 Thread Xiang Zhang
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 several co

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-08 Thread Xiang Zhang
Xiang Zhang added the comment: LGTM. And I expect there could be a comment about the special decimal number. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-08 Thread Xiang Zhang
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 decimal num

[issue24329] __qualname__ and __slots__

2016-11-11 Thread Xiang Zhang
Xiang Zhang added the comment: v3 updates the test cases. -- Added file: http://bugs.python.org/file45444/slots_special_v3.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue24329] __qualname__ and __slots__

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

[issue24329] __qualname__ and __slots__

2016-11-10 Thread Xiang Zhang
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 <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28659] xml.etree.cElementTree.write misses opening tag

2016-11-10 Thread Xiang Zhang
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' >>> tree = ET.Element

[issue28659] xml.etree.cElementTree.write misses opening tag

2016-11-10 Thread Xiang Zhang
Xiang Zhang added the comment: s/not/note -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28659> ___ ___ Python-bugs-list

[issue24329] __qualname__ and __slots__

2016-11-10 Thread Xiang Zhang
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 <rep...@bugs.python.org> <http://bugs.p

[issue24329] __qualname__ and __slots__

2016-11-10 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: Added file: http://bugs.python.org/file45421/slots_qualname_v2.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue28563] Arbitrary code execution in gettext.c2py

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

[issue28563] Arbitrary code execution in gettext.c2py

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

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-07 Thread Xiang Zhang
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 reported h

[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 <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28439] Remove redundant checks in PyUnicode_EncodeLocale

2016-10-14 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- 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

[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

[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 <rep...@bugs.python.org> <http://bugs.python.or

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

2016-10-22 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- nosy: +xiang.zhang ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28509> ___ __

[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 <rep...@bugs.python.org> <http://bugs.python.org/i

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

2016-10-23 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bu

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

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

[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 list

[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 <rep...@bugs.python.

[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 found

[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 <rep...@bugs.python.org> <http://bugs.python.org/issue28426> ___ ___

[issue28531] Improve utf7 encoder memory usage

2016-10-25 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: Added file: http://bugs.python.org/file45220/utf7_encoder.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[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 <angwe...@126.com>: Removed file: http://bugs.python.org/file45219/utf7_encoder.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[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 comments

[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 <rep...@bugs.python.org> <http://bugs.python.org/i

[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2016-11-14 Thread Xiang Zhang
Xiang Zhang added the comment: _PyUnicode_FromId could fail due to memoryerror or bad encoded data. They should be treated differently like PyUnicode_READY. Could we treat it like PyDict_GetItem? If memoryerror happens it's highly possible other parts will fail too

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-14 Thread Xiang Zhang
Xiang Zhang added the comment: Maybe you have forgotten to remove the debug print in the patch? -- nosy: +xiang.zhang ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-14 Thread Xiang Zhang
Xiang Zhang added the comment: GNU gettext only allows the plural value(n) to be an integer(unsigned long int). Django deliberately converts the value to long in filesizeformat. Any reason not to use int? -- ___ Python tracker <

[issue28688] Warning -- warnings.filters was modified by test_warnings

2016-11-14 Thread Xiang Zhang
Xiang Zhang added the comment: test___all__ gets the same behaviour. ./python -Werror -m test test___all__ Run tests sequentially 0:00:00 [1/1] test___all__ Warning -- warnings.filters was modified by test___all__ test___all__ failed (env changed) 1 test altered the execution environment

[issue28728] test_host_resolution in test_socket fails

2016-11-23 Thread Xiang Zhang
Xiang Zhang added the comment: Hi SilentGhost. I'm also using Ubuntu 16.10 but the test case doesn't fail. cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.10 DISTRIB_CODENAME=yakkety DISTRIB_DESCRIPTION="Ubuntu 16.10" ./python -Wa -m test -v test_socket | grep test_host_

[issue28806] Improve the netrc library

2016-11-26 Thread Xiang Zhang
New submission from Xiang Zhang: netrc library now gets some problems: 1. All tokens are mandatory. (#28780) 2. Token values are limited to a limited set of characters. (#557704) 3. Does not complain about macro definition without a null line. 4. If the login name is anonymous, security check

[issue28780] netrc throws NetrcParseError for record without 'password'

2016-11-26 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- dependencies: +Improve the netrc library ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue28774] Better start and end position for unicodeerror in unicode_encode_ucs1

2016-11-23 Thread Xiang Zhang
Xiang Zhang added the comment: Thanks Serhiy and Victor. Finished my first commit. :-) Now assign back to Serhiy and pos2 LGTM. -- assignee: xiang.zhang -> serhiy.storchaka ___ Python tracker <rep...@bugs.python.org> <http://bug

[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-11-22 Thread Xiang Zhang
Xiang Zhang added the comment: v2 applies the suggestions. -- priority: low -> normal versions: +Python 3.7 Added file: http://bugs.python.org/file45597/issue27414_v2.patch ___ Python tracker <rep...@bugs.python.org> <http://bug

[issue28766] Remove the semicolon in source code

2016-11-22 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- stage: -> resolved ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28766> ___ ___

[issue28774] Better start and end position for unicodeerror in unicode_encode_ucs1

2016-11-22 Thread Xiang Zhang
New submission from Xiang Zhang: unicode_encode_ucs1 now recognizes as many characters as it can one time instead of one character a time. But the unicodeerror positions still only count 1(the second time). A similar problem reported in #28561. -- components: Interpreter Core files

[issue28728] test_host_resolution in test_socket fails

2016-11-24 Thread Xiang Zhang
Xiang Zhang added the comment: > hosts: files mdns4_minimal [NOTFOUND=return] resolve > [!UNAVAIL=return] dns I think this is the default config. Same as mine. Does test_host_resolution still stably fails? -- ___ Python tracke

[issue28749] Fixed the documentation of the mapping codec APIs

2016-11-24 Thread Xiang Zhang
Xiang Zhang added the comment: v2 LGTM. -- nosy: +xiang.zhang ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28749> ___ ___ Pyth

[issue28728] test_host_resolution in test_socket fails

2016-11-27 Thread Xiang Zhang
Xiang Zhang added the comment: The three ipv6 addresses are all invalid addresses if we conform to spec. "::1q" non hex characteres "::1::2"two "::" but at most one is allowed "1:1:1:1:1:1:1:1:1" 144 bits > 128 bits > Perha

[issue28822] Fix indices handling in PyUnicode_FindChar

2016-11-28 Thread Xiang Zhang
New submission from Xiang Zhang: PyUnicode_FindChar declares in the doc it treats its *start* and *end* parameters as str[start:end], same as other APIs like PyUnicode_Find, PyUnicode_Count. But it doesn't allow negative indices like others so violates the doc. -- components

[issue28822] Fix indices handling in PyUnicode_FindChar

2016-11-28 Thread Xiang Zhang
Xiang Zhang added the comment: Other APIs like PyUnicode_Find and PyUnicode_Count support it. Their docs are almost the same so I think PyUnicode_FindChar does not need to be the special one. After change, its behaviour and implementation are more consistent with other APIs

[issue28699] Imap from ThreadPool behaves unexpectedly

2016-11-28 Thread Xiang Zhang
Xiang Zhang added the comment: > 4. Guard against misbehaving generators/iterables *before* they are put into > the taskqueue. This approach is good. 2 points about the patch: 1. How about _map_async(map)? Does it need the same strategy? For an iterator with __len__ defined it seems

[issue14844] netrc does not handle accentuated characters

2016-11-27 Thread Xiang Zhang
Xiang Zhang added the comment: I opened #28806 to improve netrc library. This could be solved if it's merged. -- dependencies: +Improve the netrc library nosy: +xiang.zhang ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue28808] Make PyUnicode_CompareWithASCIIString() never failing

2016-11-27 Thread Xiang Zhang
Xiang Zhang added the comment: LGTM. Although at first I am not in favour of this change but searching Github it seems all usages of this API doesn't check the possible error. -- nosy: +xiang.zhang ___ Python tracker <rep...@bugs.python.org>

[issue28334] netrc does not work if $HOME is not set

2016-11-27 Thread Xiang Zhang
Changes by Xiang Zhang <angwe...@126.com>: -- nosy: +xiang.zhang ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28334> ___ __

[issue28696] imap from ThreadPool hangs by an exception in a generator function

2016-11-17 Thread Xiang Zhang
Xiang Zhang added the comment: In Py3.6, it raises error: >>> next((pool.imap(str, gen( Traceback (most recent call last): File "/opt/lib/python3.7/multiprocessing/pool.py", line 684, in next item = self._items.popleft() IndexError: pop from an empty deq

[issue28699] Imap from ThreadPool behaves unexpectedly

2016-11-17 Thread Xiang Zhang
Xiang Zhang added the comment: Hi Davin, could it be fixed like this? diff -r 05a728e1da15 Lib/multiprocessing/pool.py --- a/Lib/multiprocessing/pool.py Wed Nov 16 16:35:53 2016 -0800 +++ b/Lib/multiprocessing/pool.py Thu Nov 17 16:35:38 2016 +0800 @@ -398,7 +398,7

[issue28699] Imap from ThreadPool behaves unexpectedly

2016-11-17 Thread Xiang Zhang
Xiang Zhang added the comment: What's more, this case seems non-reentrant. Since there is no task in this case, the job id is always 0 which is not true. This means after the first time, we can not set even the exception. -- ___ Python tracker <

[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2016-11-15 Thread Xiang Zhang
Xiang Zhang added the comment: Since currently _PyUnicode_CompareWithId is used to compare a unicode with ascii identifiers for all cases, how about introduce a more specific function like _PyUnicode_EqualToASCIIId for this case? We can preserve _PyUnicode_CompareWithId for more general

[issue28707] add 'directory' option to the http.server module

2016-11-15 Thread Xiang Zhang
Xiang Zhang added the comment: +1 for this idea. I use this command everyday in work and every time must cd to the directory is an annoyance. -- nosy: +xiang.zhang ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28701] Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString

2016-11-15 Thread Xiang Zhang
Xiang Zhang added the comment: LGTM. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28701> ___ ___ Python-bugs-list mailing list

[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2016-11-16 Thread Xiang Zhang
Xiang Zhang added the comment: > _PyUnicode_CompareWithId is a private function. We can remove it if it has > issues. It doesn't. But once there is _PyUnicode_EqualToASCIIId, it's can be rarely used. The new patch implements a version of _PyUnicode_EqualToASCIIId. -- Adde

<    3   4   5   6   7   8   9   10   11   12   >