[issue26915] Test identity first in membership operation of ItemsView, ValuesView and Sequence in collections.abc

2016-06-04 Thread Xiang Zhang
Xiang Zhang added the comment: Oh, sorry. Make the __len__ signature wrong. Change it. -- Added file: http://bugs.python.org/file43190/issue26915_v4.patch ___ Python tracker <http://bugs.python.org/issue26

[issue27215] Docstrings of Sequence and MutableSequence seems not right

2016-06-04 Thread Xiang Zhang
New submission from Xiang Zhang: Docstrings of Sequence and MutableSequence in collections.abc says "Concrete subclasses must provide __new__ and __init__". This seems not the truth. Not providing __new__ and __init__ is also OK. -- messages: 267249 nosy: rhettinger, x

[issue27225] Potential refleak in type_new when setting __new__ fails

2016-06-04 Thread Xiang Zhang
New submission from Xiang Zhang: As the title, there seems to be a potential refleak in type_new when setting __new__ fails. -- files: refleak_in_type_new.patch keywords: patch messages: 267382 nosy: xiang.zhang priority: normal severity: normal status: open title: Potential refleak in

[issue27164] zlib can't decompress DEFLATE using shared dictionary

2016-06-05 Thread Xiang Zhang
Xiang Zhang added the comment: It looks good. I don't think that is a matter since usually I will do a search before change. But of course extracting them to a subroutine helps. -- ___ Python tracker <http://bugs.python.org/is

[issue26867] test_ssl test_options fails on ubuntu 16.04

2016-06-05 Thread Xiang Zhang
Xiang Zhang added the comment: @skip_if_broken_ubuntu_ssl doesn't work in this case. `hasattr(ssl, 'PROTOCOL_SSLv2')` returns False. -- ___ Python tracker <http://bugs.pyt

[issue27235] Heap overflow occurred due to the int overflow (Python-2.7.11/Modules/posixmodule.c)

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

[issue27235] Heap overflow occurred due to the int overflow (Python-2.7.11/Modules/posixmodule.c)

2016-06-06 Thread Xiang Zhang
Xiang Zhang added the comment: I am confused why this could happen. On x86 platform, you can not even create a string of size 0x. On x64 platform, I don't think strlen(s) + 3 can lead to overflow where s is of size Py_ssize_t. -- ___ P

[issue27247] telnetlib AttributeError: 'error' object has no attribute 'errno' (handling of select.error)

2016-06-07 Thread Xiang Zhang
Xiang Zhang added the comment: In py2, select.error is a stand alone exception while in py3 it's an alias of OSError. This difference seems not noticed when introduced in 872afada51b0. -- nosy: +gregory.p.smith, xiang.zhang ___ Python tracker

[issue27248] Possible refleaks in PyType_Ready in error condition

2016-06-07 Thread Xiang Zhang
New submission from Xiang Zhang: As the title, in add_* used in PyType_Ready, the reference counts are not decreased when adding them to dict fails. -- files: refleak_in_pytype_ready.patch keywords: patch messages: 267607 nosy: serhiy.storchaka, xiang.zhang priority: normal severity

[issue27261] io.BytesIO.truncate does not work as advertised

2016-06-07 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +alexandre.vassalotti, serhiy.storchaka ___ Python tracker <http://bugs.python.org/issue27261> ___ ___ Python-bugs-list mailin

[issue27261] io.BytesIO.truncate does not work as advertised

2016-06-07 Thread Xiang Zhang
Xiang Zhang added the comment: Is this a bug or a documentation matter? Inspecting BytesIO.truncate's code, it does resizing similar to list, this seems to be a designed feature, which conflicts with the documented behaviour. -- nosy: +xiang.

[issue26985] Information about CodeType in inspect documentation is outdated

2016-06-09 Thread Xiang Zhang
Xiang Zhang added the comment: So maybe remove the docstring entirely? -- ___ Python tracker <http://bugs.python.org/issue26985> ___ ___ Python-bugs-list mailin

[issue27275] KeyError thrown by optimised collections.OrderedDict.popitem()

2016-06-10 Thread Xiang Zhang
Xiang Zhang added the comment: I think your expiringdict seems not work with the C version OrderedDict, you may need to change your implementation or clarify that :(. The C version's OrderedDict.popitem may call your __getitem__ which then does deletion and emit KeyError when expires. I

[issue27275] KeyError thrown by optimised collections.OrderedDict.popitem()

2016-06-10 Thread Xiang Zhang
Xiang Zhang added the comment: Raymond, In single threaded case popitem may still fail. I want to correct my last message that popitem does not fail in this case because it calls __getitem__ but instead it calls __contains__[1]. In __contains__ it deletes the item since it expires, and

[issue27299] urllib does not splitport while putrequest realhost to HTTP headers

2016-06-11 Thread gr zhang
New submission from gr zhang: h.putheader('Host', "www.github.com:443") # this will make errcode 405, if urllib lib splitport first, and this will set Host ---> www.github.com and get 200 code. h.endheaders(None) errcode, errmsg, headers = h.g

[issue27299] urllib does not splitport while putrequest realhost to HTTP headers

2016-06-11 Thread Xiang Zhang
Xiang Zhang added the comment: The standard[1] says the Host header is OK to include port. Why not use 'https://www.github.com'? [1] https://tools.ietf.org/html/rfc7230#section-5.4 -- nosy: +xiang.zhang ___ Python tracker <http://bu

[issue27299] urllib does not splitport while putrequest realhost to HTTP headers

2016-06-11 Thread gr zhang
gr zhang added the comment: Yes, I mean when set h.putheader('Host', "www.github.com:443") and the status code from httplib will be 405 while when set h.putheader('Host', "www.github.com") the code will be 200, this is confused to me. -- __

[issue27299] urllib does not splitport while putrequest realhost to HTTP headers

2016-06-12 Thread Xiang Zhang
Xiang Zhang added the comment: It's server side behaviour. Asking here may not get results. I think it's normal for the server to return error if it thinks the header is invalid. -- ___ Python tracker <http://bugs.python.o

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-14 Thread Xiang Zhang
Xiang Zhang added the comment: Hello Martin. I've finished a patch to add 64bit support to zlib. I think it solves the 9 problems you mentioned and let the input and output both be larger than UINT_MAX. Hope you are willing to review and we can move this forward. :) -- key

[issue27177] re match.group should support __index__

2016-06-15 Thread Xiang Zhang
Xiang Zhang added the comment: Attach a patch to add this feature to Py3.6. -- nosy: +xiang.zhang Added file: http://bugs.python.org/file43396/issue27177.patch ___ Python tracker <http://bugs.python.org/issue27

[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator

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

[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator

2016-06-15 Thread Xiang Zhang
Xiang Zhang added the comment: Hi, I've written a patch to accomplish this in Py3.6. This patch is much cleaner but has one drawback, when used as decorator factory, you have to specify name as a keyword argument. But considering the codes that have to been imported to check argumen

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-16 Thread Xiang Zhang
Xiang Zhang added the comment: I'm willing to and thanks for your work too :) I have replied to your comments and adjusted my patch accordingly. But there are still several I am confused or want to negotiate more. I now upload the adjusted patch. -- Added file:

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-16 Thread Xiang Zhang
Xiang Zhang added the comment: Sorry, I suddenly find that I've misunderstood one of your comments. I changed according then. Please use the new version. -- Added file: http://bugs.python.org/file43408/64bit_support_for_zlib_v3.patch ___ P

[issue26985] Information about CodeType in inspect documentation is outdated

2016-06-16 Thread Xiang Zhang
Xiang Zhang added the comment: Hmm, when I am going to delete the list in the docstring, I find other functions get lists too in inspect.py. So maybe we should open another issue to clean them after first merging this thread? -- ___ Python tracker

[issue27333] validate_step in rangeobject.c, incorrect code logic but right result

2016-06-16 Thread Xiang Zhang
New submission from Xiang Zhang: Here is a drawback in validate_step of rangeobject. PyNumber_AsSsize_t returns clipped value and won't set an exception when the argument *exc* is set NULL. So if step overflows, istep is always PY_SSIZE_MAX or PY_SSIZE_MIN. But the following code is to

[issue27333] validate_step in rangeobject.c, incorrect code logic but right result

2016-06-16 Thread Xiang Zhang
Changes by Xiang Zhang : -- components: +Interpreter Core type: -> behavior versions: +Python 2.7, Python 3.5, Python 3.6 ___ Python tracker <http://bugs.python.org/issu

[issue27342] Clean up some Py_XDECREFs in rangeobject.c and bltinmodule.c

2016-06-17 Thread Xiang Zhang
New submission from Xiang Zhang: Some Py_XDECREFs in rangeobject.c and bltinmodule.c are not necessary. Py_DECREF is enough. Clean up them. -- files: cleanup_some_xdecrefs.patch keywords: patch messages: 268711 nosy: xiang.zhang priority: normal severity: normal status: open title

[issue27333] validate_step in rangeobject.c, incorrect code logic but right result

2016-06-17 Thread Xiang Zhang
Xiang Zhang added the comment: This looks fine. But maybe code like this looks more clear: if (step && _PyLong_Sign(step) == 0) { PyErr_SetString(PyExc_ValueError, "range() arg 3 must not be zero"); Py_CLEAR(step); } I think assert(PyLong_Check(

[issue27342] Clean up some Py_XDECREFs in rangeobject.c and bltinmodule.c

2016-06-17 Thread Xiang Zhang
Xiang Zhang added the comment: Thanks for review. Eliminate the wrongs ones. -- Added file: http://bugs.python.org/file43440/cleanup_some_xdecrefs_v2.patch ___ Python tracker <http://bugs.python.org/issue27

[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator

2016-06-17 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +loewis, serhiy.storchaka ___ Python tracker <http://bugs.python.org/issue7769> ___ ___ Python-bugs-list mailing list Unsub

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-18 Thread Xiang Zhang
Xiang Zhang added the comment: Upload the new patch to fix bugs and make improvements. I'll add tests later. -- Added file: http://bugs.python.org/file43450/64bit_support_for_zlib_v4.patch ___ Python tracker <http://bugs.python.org/is

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-18 Thread Xiang Zhang
Changes by Xiang Zhang : Added file: http://bugs.python.org/file43459/64bit_support_for_zlib_v4.patch ___ Python tracker <http://bugs.python.org/issue27130> ___ ___ Pytho

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-18 Thread Xiang Zhang
Changes by Xiang Zhang : Removed file: http://bugs.python.org/file43450/64bit_support_for_zlib_v4.patch ___ Python tracker <http://bugs.python.org/issue27130> ___ ___

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-18 Thread Xiang Zhang
Xiang Zhang added the comment: Attach patch to restore argument parsing support for __int__. -- Added file: http://bugs.python.org/file43460/64bit_support_for_zlib_v5.patch ___ Python tracker <http://bugs.python.org/issue27

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-18 Thread Xiang Zhang
Changes by Xiang Zhang : Removed file: http://bugs.python.org/file43460/64bit_support_for_zlib_v5.patch ___ Python tracker <http://bugs.python.org/issue27130> ___ ___

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-18 Thread Xiang Zhang
Changes by Xiang Zhang : Added file: http://bugs.python.org/file43461/64bit_support_for_zlib_v5.patch ___ Python tracker <http://bugs.python.org/issue27130> ___ ___ Pytho

[issue27351] Unexpected ConfigParser.read() behavior when passed fileobject

2016-06-18 Thread Xiang Zhang
Xiang Zhang added the comment: The doc tells ConfigParser.read accepts a filename or a list of filenames. Why do you pass it fileobject? If you want to use fileobject, why not read_file? -- nosy: +lukasz.langa, xiang.zhang ___ Python tracker <h

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-19 Thread Xiang Zhang
Xiang Zhang added the comment: Upload the near-final patch. This one adds large buffer tests on 64bit platforms. I have tested them on a server with enough memory. I don't add the @support.requires_resource('cpu') since large memory tests are born to be slow. And actually wh

[issue26537] ConfigParser has optionxform, but not sectionxform

2016-06-23 Thread Xiang Zhang
Xiang Zhang added the comment: ping -- ___ Python tracker <http://bugs.python.org/issue26537> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue27381] Typo in zipfile documentation

2016-06-24 Thread Xiang Zhang
New submission from Xiang Zhang: There is a redundant ')' in zipfile doc. Remove it. -- assignee: docs@python components: Documentation files: zipfile_doc.patch keywords: patch messages: 269166 nosy: docs@python, xiang.zhang priority: normal severity: normal status: open titl

[issue22079] Ensure in PyType_Ready() that base class of static type is static

2016-06-24 Thread Xiang Zhang
Xiang Zhang added the comment: I think we can start from index 1 instead of 0. -- nosy: +xiang.zhang ___ Python tracker <http://bugs.python.org/issue22

[issue22079] Ensure in PyType_Ready() that base class of static type is static

2016-06-25 Thread Xiang Zhang
Xiang Zhang added the comment: In the mro list I think the first is always the type itself which has already been checked to be a statically allocated type if we can touch the loop. Starting from 0 checks it twice and it's not a base either. BTW, I don't receive an email from t

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-25 Thread Xiang Zhang
Xiang Zhang added the comment: Add the newest version applying Martin's comments. -- Added file: http://bugs.python.org/file43538/64bit_support_for_zlib_v7.patch ___ Python tracker <http://bugs.python.org/is

[issue22079] Ensure in PyType_Ready() that base class of static type is static

2016-06-25 Thread Xiang Zhang
Xiang Zhang added the comment: Of course, I know it. But doesn't the local variable `bases` refer to mro[1]? [1] https://hg.python.org/cpython/file/tip/Objects/typeobject.c#l4900 -- ___ Python tracker <http://bugs.python.org/is

[issue22079] Ensure in PyType_Ready() that base class of static type is static

2016-06-25 Thread Xiang Zhang
Xiang Zhang added the comment: I thought that too at first. But if we use __bases__, can we still guarantee that 'all bases of statically allocated type should be statically allocated'? How about its grand bases? Is it possible that a statically allocated type inherit a dynamic typ

[issue22079] Ensure in PyType_Ready() that base class of static type is static

2016-06-26 Thread Xiang Zhang
Xiang Zhang added the comment: Oh yes. The mro list can be customized so we can not even guarantee the type appears at index 0 and object at index n-1. It seems we should still keep what it is now, iterating the whole mro list. Sorry that my previous comments seem to be noise. But maybe we

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-27 Thread Xiang Zhang
Xiang Zhang added the comment: This is the v8 patch. It does two things: [1] Apply Martin's comment about decompressobj.decompress so when user passes in PY_SSIZE_T_MAX and there is enough memory, no error will be raised. [2] Now decompressobj.flush can still work ev

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-27 Thread Xiang Zhang
Changes by Xiang Zhang : Added file: http://bugs.python.org/file43563/64bit_support_for_zlib_v8.patch ___ Python tracker <http://bugs.python.org/issue27130> ___ ___ Pytho

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-27 Thread Xiang Zhang
Changes by Xiang Zhang : Removed file: http://bugs.python.org/file43561/64bit_support_for_zlib_v8.patch ___ Python tracker <http://bugs.python.org/issue27130> ___ ___

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-27 Thread Xiang Zhang
Changes by Xiang Zhang : Removed file: http://bugs.python.org/file43563/64bit_support_for_zlib_v8.patch ___ Python tracker <http://bugs.python.org/issue27130> ___ ___

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-27 Thread Xiang Zhang
Xiang Zhang added the comment: Make v8 patch consistent with the latest changeset. -- Added file: http://bugs.python.org/file43564/64bit_support_for_zlib_v8.patch ___ Python tracker <http://bugs.python.org/issue27

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-27 Thread Xiang Zhang
Changes by Xiang Zhang : Added file: http://bugs.python.org/file43565/64bit_support_for_zlib_v8.patch ___ Python tracker <http://bugs.python.org/issue27130> ___ ___ Pytho

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-06-27 Thread Xiang Zhang
Changes by Xiang Zhang : Removed file: http://bugs.python.org/file43564/64bit_support_for_zlib_v8.patch ___ Python tracker <http://bugs.python.org/issue27130> ___ ___

[issue27401] Wrong FTP links in 5.3.2 installer

2016-06-27 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +larry ___ Python tracker <http://bugs.python.org/issue27401> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27411] Possible different behaviour of explicit and implicit __dict__ accessing when involving builtin types' __dict__ descriptors

2016-06-29 Thread Xiang Zhang
New submission from Xiang Zhang: Usually when we access an object's __dict__, it will finally reach subtype_dict[0]. When involving builtin base, it may delegates to the base's __dict__ descriptor. In such a case, it is possible for the __dict__ descriptor to initialize the dict

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

2016-06-29 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +ezio.melotti, pitrou, rhettinger ___ Python tracker <http://bugs.python.org/issue27414> ___ ___ Python-bugs-list mailin

[issue26664] find a bug in activate.fish of venv of cpython3.6

2016-06-30 Thread Xiang Zhang
Xiang Zhang added the comment: I get the same feeling. Add Larry. -- nosy: +larry ___ Python tracker <http://bugs.python.org/issue26664> ___ ___ Python-bugs-list m

[issue26664] Misuse of $ in activate.fish of venv

2016-06-30 Thread Xiang Zhang
Xiang Zhang added the comment: Since the bug is fixed, we can also close issue26348. -- ___ Python tracker <http://bugs.python.org/issue26664> ___ ___ Python-bug

[issue27429] xml.sax.saxutils.escape doesn't escape multiple characters safely

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

[issue27436] Strange code in selectors.KqueueSelector

2016-07-01 Thread Xiang Zhang
Xiang Zhang added the comment: EVENT_* and KQ_FILTER_* are two different sets of constants. EVENT_* represent event types of the abstract event and KQ_FILTER_* represent the kevent filter type. EVENT_* can be combined while kevent.filter can only get one type. -- nosy: +xiang.zhang

[issue27436] Strange code in selectors.KqueueSelector

2016-07-01 Thread Xiang Zhang
Xiang Zhang added the comment: What I am saying is that EVENT_* (1, 2) are bit_masks while KQ_FILTER_* not (-1, -2, -3, -4). So you should use |= with EVENT_* and == with KQ_FILTER_*. It seems not a bug. :) -- ___ Python tracker <h

[issue27436] Strange code in selectors.KqueueSelector

2016-07-01 Thread Xiang Zhang
Xiang Zhang added the comment: But EVENT_* are. If you use =, events can only be either EVENT_READ or EVENT_WRITE, not EVENT_READ & EVENT_WRITE. EVENT_* != KQ_FILTER_*. -- ___ Python tracker <http://bugs.python.org/iss

[issue27436] Strange code in selectors.KqueueSelector

2016-07-01 Thread Xiang Zhang
Xiang Zhang added the comment: Oh, sorry. My focus seem to be on the wrong place. I thought David is arguing something about the constants are bitmasks or not. It's my fault. But actually the current code looks very clearly and I can tell from it that EVENT_* are bitmasks and KQ_FILTER_

[issue27429] xml.sax.saxutils.escape doesn't escape multiple characters safely

2016-07-03 Thread Xiang Zhang
Xiang Zhang added the comment: I think this a bug. There should be no override when escape or unescape. Upload a patch to fix this. -- keywords: +patch nosy: +martin.panter, serhiy.storchaka Added file: http://bugs.python.org/file43616/issue27429.patch

[issue27429] xml.sax.saxutils.escape doesn't escape multiple characters safely

2016-07-03 Thread Xiang Zhang
Xiang Zhang added the comment: I thought of that too. But the doc doesn't tell you that you can not put any characters in the entities, so I think we should make the implementation right when some unexpected characters are passed in. If you don't like the implementation to be change

[issue27429] xml.sax.saxutils.escape doesn't escape multiple characters safely

2016-07-03 Thread Xiang Zhang
Xiang Zhang added the comment: Put a not in escape's doc. -- Added file: http://bugs.python.org/file43617/sax_escape_doc.patch ___ Python tracker <http://bugs.python.org/is

[issue27457] shlex.quote incorrectly quotes ampersants, pipes

2016-07-05 Thread Xiang Zhang
Xiang Zhang added the comment: Doesn't this the expected behaviour of shlex.quote, return a shell-escaped version of the string s? If && is not quoted, how about "pwd && rm -rf ~"? I think in your case there is no need to use shlex.quote.

[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator

2016-07-06 Thread Xiang Zhang
Xiang Zhang added the comment: ping -- ___ Python tracker <http://bugs.python.org/issue7769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue27248] Possible refleaks in PyType_Ready in error condition

2016-07-06 Thread Xiang Zhang
Xiang Zhang added the comment: ping -- ___ Python tracker <http://bugs.python.org/issue27248> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue26915] Test identity first in membership operation of ItemsView, ValuesView and Sequence in collections.abc

2016-07-06 Thread Xiang Zhang
Xiang Zhang added the comment: ping -- ___ Python tracker <http://bugs.python.org/issue26915> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue27460] Change bytes exception when overflow

2016-07-06 Thread Xiang Zhang
New submission from Xiang Zhang: I suggest change `bytes` exception message when an iterable containing overflow integers. Right now, bytes([sys.maxsize+1]) emits ValueError: cannot fit 'int' into an index-sized integer "ValueError: cannot fit 'int' into an index

[issue27460] Change bytes exception when overflow

2016-07-06 Thread Xiang Zhang
Changes by Xiang Zhang : -- type: -> enhancement versions: +Python 3.6 ___ Python tracker <http://bugs.python.org/issue27460> ___ ___ Python-bugs-list mai

[issue27460] Change bytes exception when overflow

2016-07-06 Thread Xiang Zhang
Changes by Xiang Zhang : Added file: http://bugs.python.org/file43643/bytes_exception_msg.patch ___ Python tracker <http://bugs.python.org/issue27460> ___ ___ Python-bug

[issue27460] Change bytes exception when overflow

2016-07-06 Thread Xiang Zhang
Changes by Xiang Zhang : Removed file: http://bugs.python.org/file43637/bytes_exception_msg.patch ___ Python tracker <http://bugs.python.org/issue27460> ___ ___ Python-bug

[issue27460] Change bytes exception when overflow

2016-07-06 Thread Xiang Zhang
Xiang Zhang added the comment: The constructor has been well tested in https://hg.python.org/cpython/file/tip/Lib/test/test_bytes.py#l111. It looks like that the original author only wants to guarantee the exception type but not message. So I didn't add a assertRaisesRegex

[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator

2016-07-07 Thread Xiang Zhang
Xiang Zhang added the comment: >From the old comments from Brian it seems he's willing to accept such a >feature. But unfortunately Brian seems not interested in this now. IMHO, this >is good feature especially to people familiar with Bottle and Flask. Writing >in a decorat

[issue27467] distutils.config API different between <=3.5.1 and 3.5.2

2016-07-08 Thread Xiang Zhang
Xiang Zhang added the comment: I think it's intentional. You can see issue20120. -- nosy: +xiang.zhang ___ Python tracker <http://bugs.python.org/is

[issue27467] distutils.config API different between <=3.5.1 and 3.5.2

2016-07-08 Thread Xiang Zhang
Xiang Zhang added the comment: Berker, what doc needs to be changed? Although RawConfigParser is legacy but that does not mean it's deprecated, right? We can still use it although the doc suggests us use ConfigParser. -- ___ Python tracker

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-09 Thread Xiang Zhang
Changes by Xiang Zhang : -- type: -> behavior versions: +Python 3.6 ___ Python tracker <http://bugs.python.org/issue27473> ___ ___ Python-bugs-list mai

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-09 Thread Xiang Zhang
New submission from Xiang Zhang: bytes_concat uses following code to check overflow: size = va.len + vb.len; if (size < 0): { PyErr_NoMemory(); goto done; } This is wrong since signed ints overflow is undefined bahaviour. But one point is that Python's Makefile defines -fwr

[issue27474] Unify exception in _Py_bytes_contains for integers

2016-07-09 Thread Xiang Zhang
New submission from Xiang Zhang: Now, `sys.maxsize+1 in b'foo'` raises "TypeError: 'int' does not support the buffer interface" which seems weird. In such case, I don't think there is any difference between sys.maxsize+1 and 256. So I suggest make it emits th

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-09 Thread Xiang Zhang
Xiang Zhang added the comment: Attach a patch to fix this. -- keywords: +patch Added file: http://bugs.python.org/file43671/bytes_concat_overflow_check.patch ___ Python tracker <http://bugs.python.org/issue27

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Xiang Zhang
Xiang Zhang added the comment: Yes, the current code is valid with -fwrapv. But I am not sure if every compiler supports this feature. So maybe we can't totally rely on it. And in issue1621, some efforts seem to have worked to factor thes

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Xiang Zhang
Xiang Zhang added the comment: Of course. I forgot to check bytearray. :( The new patch now also includes bytearray. -- Added file: http://bugs.python.org/file43675/bytes_concat_overflow_check_v2.patch ___ Python tracker <http://bugs.python.

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Xiang Zhang
Xiang Zhang added the comment: Sorry. v3 now includes iconcat. -- Added file: http://bugs.python.org/file43676/bytes_concat_overflow_check_v3.patch ___ Python tracker <http://bugs.python.org/issue27

[issue27473] bytes_concat seems to check overflow using undefined behaviour

2016-07-10 Thread Xiang Zhang
Xiang Zhang added the comment: Left a comment. -- ___ Python tracker <http://bugs.python.org/issue27473> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26867] test_ssl test_options fails on ubuntu 16.04

2016-07-10 Thread Xiang Zhang
Xiang Zhang added the comment: Does this need to be backport to py2.7? It suffers from the same problem. -- ___ Python tracker <http://bugs.python.org/issue26

[issue27481] Replace TypeError with ValueError in doc regarding "embedded NUL character"

2016-07-11 Thread Xiang Zhang
New submission from Xiang Zhang: Errors regarding "embedded NUL character" were changed from TypeError to ValueError, in r92365, issue22215, but the doc doesn't get updated. Add a patch to apply the change in doc. -- assignee: docs@python components: Docu

[issue27481] Replace TypeError with ValueError in doc regarding "embedded NUL character"

2016-07-11 Thread Xiang Zhang
Xiang Zhang added the comment: Just for a note, there has already been an issue26401 fixing the function.rst. Upload a new patch adding versionchanged tag. -- Added file: http://bugs.python.org/file43686/null_characters_doc_v2.patch ___ Python

[issue27481] Replace TypeError with ValueError in doc regarding "embedded NUL character"

2016-07-11 Thread Xiang Zhang
Xiang Zhang added the comment: Yes. I noticed the change but didn't change it. Now add it. -- Added file: http://bugs.python.org/file43689/null_characters_doc_v3.patch ___ Python tracker <http://bugs.python.org/is

[issue27481] Replace TypeError with ValueError in doc regarding "embedded NUL character"

2016-07-11 Thread Xiang Zhang
Xiang Zhang added the comment: Sorry, I didn't notice the difference. -- Added file: http://bugs.python.org/file43690/null_characters_doc_v4.patch ___ Python tracker <http://bugs.python.org/is

[issue27492] Enhance bytearray_repr with bytes_repr's logic

2016-07-12 Thread Xiang Zhang
New submission from Xiang Zhang: Right now bytearray_repr's implementation mimics old string_repr, but it has a drawback: It arbitrarily checks overflow using four times the bytearray object's length, but the representation length of the value can range from 1 to 4. I think

[issue27492] Enhance bytearray_repr with bytes_repr's logic

2016-07-12 Thread Xiang Zhang
Xiang Zhang added the comment: I considered that too. But I was not sure what code could go into bytes_methods.c then, Python level methods, all common parts or only tp->methods? I'll try to factor the common part out later. -- ___ Python

[issue27492] Enhance bytearray_repr with bytes_repr's logic

2016-07-12 Thread Xiang Zhang
Xiang Zhang added the comment: Hi, Serhiy. I've tried one version factoring the common parts out. I make them one function but it seems not very elegant. I also think about passing the object and use it to get the type and then determine how to get the string, what the pre/postfix are

[issue27506] bytes/bytearray delete acts as keyword argument

2016-07-13 Thread Xiang Zhang
New submission from Xiang Zhang: Write a patch to make bytes/bytearray.translate's delete argument support acting as keyword arguments. This won't break any backwards compatibility and make the method more flexible to use. Besides, in the C code level, it stops using argument clini

[issue27506] make bytes/bytearray deletechars a keyword argument named delete

2016-07-13 Thread Xiang Zhang
Xiang Zhang added the comment: Hmm, David, that may be not quite right. Users only reading the doc never know it's deletechars not delete. The doc is always delete, though conflicting with __doc__. >>> print(bytes.translate.__doc__) B.translate(table[, deletechars]) -

[issue27506] make bytes/bytearray delete a keyword argument

2016-07-13 Thread Xiang Zhang
Xiang Zhang added the comment: Please review the new version. It makes two changes comparing with the last one. 1. It exposes Python parameter as "delete" (which the document always uses so I think it's the API) while still use "deletechars" (which I prefer as a C var

[issue27507] bytearray.extend lacks overflow check when increasing buffer

2016-07-13 Thread Xiang Zhang
New submission from Xiang Zhang: As the title, bytearray.extend simply use `buf_size = len + (len >> 1) + 1;` to determine next *buf_size* when increasing buffer. But this can overflow in theory. So I suggest adding overflow check. -- components: Interpreter Core

[issue27507] bytearray.extend lacks overflow check when increasing buffer

2016-07-13 Thread Xiang Zhang
Xiang Zhang added the comment: Ohh, sorry for the disturb. I made a mistake. This is not needed and now close it. -- resolution: -> not a bug status: open -> closed ___ Python tracker <http://bugs.python.org/i

<    6   7   8   9   10   11   12   13   14   15   >