[issue27922] Make IDLE tests less flashy

2016-09-04 Thread Xiang Zhang
Xiang Zhang added the comment: Hi Terry, I think this issue may be not completed. While running idlelib test with -ugui, I can sometimes still get a window flash. I think it's due to test_searchbase. Running python -m idlelib.idle_test.test_searchbase can reproduce the flash and a

[issue27922] Make IDLE tests less flashy

2016-09-04 Thread Xiang Zhang
Xiang Zhang added the comment: After some tries, I think it seems to be caused by the second open in test_open_and_close in SearchDialogBaseTest. The second open calls self.top.deiconify. -- ___ Python tracker <http://bugs.python.org/issue27

[issue19500] Add client-side SSL session resumption

2016-09-05 Thread Xiang Zhang
Xiang Zhang added the comment: Patch LGTM. But one thing is that every time it returns a new instance of SSL.Session. That means ssl_sock.session == ssl_sock.session will always return False right now. Is it useful to make it comparable? -- nosy: +xiang.zhang

[issue27922] Make IDLE tests less flashy

2016-09-05 Thread Xiang Zhang
Xiang Zhang added the comment: It's fine, knowing that the maintainer thinks this behaviour is okay. :) -- ___ Python tracker <http://bugs.python.org/is

[issue27963] null poiter dereference in set_conversion_mode due uncheck _ctypes_conversion_errors

2016-09-05 Thread Xiang Zhang
Xiang Zhang added the comment: Hmm, I tested the example snippet but it works. And PyMem_Free shouldn't fail when encounter NULL. The doc explicitly says "If p is NULL, no operation is performed". -- nosy: +xiang.zhang ___ Python

[issue27962] null poiter dereference in set_conversion_mode due uncheck _ctypes_conversion_encoding

2016-09-05 Thread Xiang Zhang
Xiang Zhang added the comment: Same as my comment in issue27963. Python 2.7.12+ (2.7:de9e410e78d8, Sep 6 2016, 12:28:48) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import ctypes &g

[issue27963] null poiter dereference in set_conversion_mode due uncheck _ctypes_conversion_errors

2016-09-05 Thread Xiang Zhang
Xiang Zhang added the comment: Ooh, I treat dereference as decref, sorry. Then I think it may happen when there is not enough memory. But your patch is not complete, at least you should Py_DECREF(result). But this function may need more care since the malloc failure in it will alter states

[issue27962] null poiter dereference in set_conversion_mode due uncheck _ctypes_conversion_encoding

2016-09-05 Thread Xiang Zhang
Xiang Zhang added the comment: I suggest close this as duplicate of issue27963 and fix these all in that issue. -- ___ Python tracker <http://bugs.python.org/issue27

[issue27963] null poiter dereference in set_conversion_mode due uncheck _ctypes_conversion_errors

2016-09-05 Thread Xiang Zhang
Xiang Zhang added the comment: issue27963.patch tries to fix the crash caused by not enough memory and avoid inconsistent state when failure. -- keywords: +patch Added file: http://bugs.python.org/file44390/issue27963.patch ___ Python tracker <h

[issue27967] Remove unused variables causing compile warnings in sqlite3 module

2016-09-05 Thread Xiang Zhang
New submission from Xiang Zhang: Compile py2.7 will generate two unused variable warnings in sqlite3 module. The variables have already not existed in py3. /home/angwer/py2.7/Modules/_sqlite/cursor.c: In function ‘pysqlite_cursor_dealloc’: /home/angwer/py2.7/Modules/_sqlite/cursor.c:121:9

[issue27968] test_coroutines generates some warnings

2016-09-05 Thread Xiang Zhang
New submission from Xiang Zhang: ./python -m test test_coroutines Run tests sequentially 0:00:00 [1/1] test_coroutines /home/angwer/cpython/Lib/test/test_coroutines.py:891: RuntimeWarning: coroutine 'CoroutineTest.test_await_12..coro' was never awaited return await Awaitable() /h

[issue27969] Suppress unnecessary message when running test_gdb

2016-09-06 Thread Xiang Zhang
New submission from Xiang Zhang: Right now, when running test_gdb generates following message: ./python -m test test_gdb Run tests sequentially 0:00:00 [1/1] test_gdb *Python Exception No module named gdb: *gdb: warning: *Could not load the Python gdb module from `/usr/local/share/gdb/python

[issue27971] utf-16 decoding can't handle lone surrogates

2016-09-06 Thread Xiang Zhang
Xiang Zhang added the comment: With the latest build, even encode will fail: Python 3.6.0a4+ (default:dad4c42869f6, Sep 6 2016, 21:41:38) [GCC 5.2.1 20151010] on linux Type "help", "copyright", "credits" or "license" for more information. >>&

[issue27744] Add AF_ALG (Linux Kernel crypto) to socket module

2016-09-06 Thread Xiang Zhang
Xiang Zhang added the comment: My PC is Ubuntu15.10, kernel 4.2, though CPU not Skylake. Everything works fine. test_aead_aes_gcm (test.test_socket.LinuxKernelCryptoAPI) ... skipped "('[Errno 2] No such file or directory', 'aead',

[issue27974] Remove dead code in importlib._bootstrap

2016-09-06 Thread Xiang Zhang
New submission from Xiang Zhang: _ManageReload in importlib._bootstrap seems obsolete since reve729b946cc03, remove it? -- files: importlib__bootstrap.patch keywords: patch messages: 274564 nosy: brett.cannon, xiang.zhang priority: normal severity: normal status: open title: Remove

[issue27963] null poiter dereference in set_conversion_mode due uncheck _ctypes_conversion_errors

2016-09-06 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +serhiy.storchaka ___ Python tracker <http://bugs.python.org/issue27963> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27683] ipaddress subnet slicing iterator malfunction

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

[issue27968] test_coroutines generates some warnings

2016-09-06 Thread Xiang Zhang
Xiang Zhang added the comment: Run hg bisect and get 756c27efe193. -- nosy: +benjamin.peterson ___ Python tracker <http://bugs.python.org/issue27968> ___ ___ Pytho

[issue27782] Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP

2016-09-06 Thread Xiang Zhang
Xiang Zhang added the comment: Thanks for your notice, Nick. :) Of course I am interested. I'll start following import-sig and reading Petr's good idea. -- ___ Python tracker <http://bugs.python.o

[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator

2016-09-07 Thread Xiang Zhang
Xiang Zhang added the comment: > Also one side effect that I can not eliminate is when it is used as a normal > function, the function instead of None is returned. I see the former patches > get this problem too. I think this does not matter after seeing functools.singledisp

[issue27984] singledispatch register should typecheck its argument

2016-09-07 Thread Xiang Zhang
Xiang Zhang added the comment: It's also better to add the typecheck to dispatch. Otherwise sometimes it can generate not obvious exception message. >>> from enum import IntEnum >>> from functools import singledispatch >>> IS = IntEnum("IS",

[issue28014] Strange interaction between methods in subclass of C OrderedDict

2016-09-07 Thread Xiang Zhang
Xiang Zhang added the comment: Please see issue27275. Someone has already complained about this. And I think the cause is the gap between Pure Python implementation and C implementation when it comes to subclasses. -- nosy: +xiang.zhang ___ Python

[issue28021] Calculating wrong modulus manually

2016-09-08 Thread Xiang Zhang
Xiang Zhang added the comment: You should use a//b instead of int(a/b). >>> 11**19 - 11**19//23*23 15 >>> 11**19 - int(11**19/23)*23 1395 -- nosy: +xiang.zhang ___ Python tracker <http://bugs.

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

2016-09-08 Thread Xiang Zhang
Xiang Zhang added the comment: Ping this and hope you don't forget about it David. :) -- ___ Python tracker <http://bugs.python.org/issue27931> ___ ___ Pytho

[issue28040] compact dict : SystemError: returned NULL without setting an error.

2016-09-09 Thread Xiang Zhang
Xiang Zhang added the comment: It looks to me the only reason to this is dk_lookup returns wrong value and I seem to find one in lookdict. Not sure this can solve the problem. -- nosy: +xiang.zhang ___ Python tracker <http://bugs.python.

[issue28040] compact dict : SystemError: returned NULL without setting an error.

2016-09-09 Thread Xiang Zhang
Changes by Xiang Zhang : -- keywords: +patch Added file: http://bugs.python.org/file44493/issue28040.patch ___ Python tracker <http://bugs.python.org/issue28

[issue28040] compact dict : SystemError: returned NULL without setting an error.

2016-09-09 Thread Xiang Zhang
Xiang Zhang added the comment: Are you sure INADA? The previous dict implementation has the same constraint but does merge in dict_pop. -- ___ Python tracker <http://bugs.python.org/issue28

[issue28040] compact dict : SystemError: returned NULL without setting an error.

2016-09-09 Thread Xiang Zhang
Xiang Zhang added the comment: does should be does not. Sorry. -- ___ Python tracker <http://bugs.python.org/issue28040> ___ ___ Python-bugs-list mailin

[issue28040] compact dict : SystemError: returned NULL without setting an error.

2016-09-09 Thread Xiang Zhang
Changes by Xiang Zhang : Removed file: http://bugs.python.org/file44493/issue28040.patch ___ Python tracker <http://bugs.python.org/issue28040> ___ ___ Python-bugs-list m

[issue28040] compact dict : SystemError: returned NULL without setting an error.

2016-09-09 Thread Xiang Zhang
Changes by Xiang Zhang : -- Removed message: http://bugs.python.org/msg275292 ___ Python tracker <http://bugs.python.org/issue28040> ___ ___ Python-bugs-list m

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

2016-09-09 Thread Xiang Zhang
Xiang Zhang added the comment: You are right David. But I don't understand what it has to do with headerregistry. I update my original patch to get that behaviour, limit it the affection in angleaddr. Now seems everything is fine. >>> email._header_value_parser.get_angle_addr(&#

[issue25969] Update lib2to3 grammar to include missing unpacking generalizations.

2016-09-10 Thread Xiang Zhang
Xiang Zhang added the comment: Gregory, the change adds a print in: https://hg.python.org/cpython/file/tip/Lib/lib2to3/fixes/fix_reload.py#l29 ./python -m test test_lib2to3 Run tests sequentially 0:00:00 [1/1] test_lib2to3 obj: Leaf(1, 'a') obj: Leaf(1, 'a') obj: Leaf(1,

[issue28064] String executed inside a function ignores global statements

2016-09-10 Thread Xiang Zhang
Xiang Zhang added the comment: Not a bug. Put the global statement inside: >>> variable = 'test' >>> def changeVariable(): ... exec("global variable; variable = 'newText'") ... >>> changeVariable() >>> print(variable) newT

[issue28077] Fix find_empty_slot in dictobject

2016-09-11 Thread Xiang Zhang
New submission from Xiang Zhang: find_empty_slot will also do *value_addr = &mp->ma_values[-1] if it encounters a split dict. -- components: Interpreter Core files: find_empty_slot.patch keywords: patch messages: 275800 nosy: haypo, methane, xiang.zhang priority: normal s

[issue28078] Silence resource warnings in test_socket

2016-09-11 Thread Xiang Zhang
New submission from Xiang Zhang: test_aead_aes_gcm (test.test_socket.LinuxKernelCryptoAPI) ... /home/angwer/cpython/Lib/unittest/case.py:600: ResourceWarning: unclosed testMethod() skipped "('[Errno 2] No such file or directory', 'aead', 'gcm(a

[issue28078] Silence resource warnings in test_socket

2016-09-11 Thread Xiang Zhang
Changes by Xiang Zhang : -- keywords: +patch Added file: http://bugs.python.org/file44556/test_socket.patch ___ Python tracker <http://bugs.python.org/issue28

[issue28078] Silence resource warnings in test_socket

2016-09-11 Thread Xiang Zhang
Xiang Zhang added the comment: It's your code. Do what you like. :) -- ___ Python tracker <http://bugs.python.org/issue28078> ___ ___ Python-bugs-list m

[issue28078] Silence resource warnings in test_socket

2016-09-11 Thread Xiang Zhang
Xiang Zhang added the comment: Christian, you forget a : after else. -- status: pending -> open ___ Python tracker <http://bugs.python.org/issue28078> ___ _

[issue28078] Silence resource warnings in test_socket

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

[issue28093] ResourceWarning in test_ssl

2016-09-11 Thread Xiang Zhang
New submission from Xiang Zhang: I can consistently product a ResourceWarning when running test_ssl: ./python -m test test_ssl Run tests sequentially 0:00:00 [1/1] test_ssl Exception in thread Thread-81: Traceback (most recent call last): File "/home/angwer/cpython/Lib/threading.py"

[issue28093] ResourceWarning in test_ssl

2016-09-11 Thread Xiang Zhang
Xiang Zhang added the comment: The problem lies in test_echo, using PROTOCOL_TLS_CLIENT as the server but doesn't not provide a hostname? I make a try which seems solving the problem but not sure this is what you want. -- keywords: +patch stage: -> patch review Added fi

[issue28093] ResourceWarning in test_ssl

2016-09-12 Thread Xiang Zhang
Xiang Zhang added the comment: The warning is gone. Close this thread. :) -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <http://bugs.python.or

[issue28077] Fix find_empty_slot in dictobject

2016-09-12 Thread Xiang Zhang
Xiang Zhang added the comment: Yes. It cannot be hit and I want to remove it at first. But I decide not to do that since there is no clue in the future find_empty_slot will not be used against split dict. And hapyo, if you decide to make find_empty_slot support only combined dict, why not

[issue28077] Fix find_empty_slot in dictobject

2016-09-12 Thread Xiang Zhang
Xiang Zhang added the comment: mp_values should be mp->ma_values, sorry. -- ___ Python tracker <http://bugs.python.org/issue28077> ___ ___ Python-bugs-list mai

[issue28077] Fix find_empty_slot in dictobject

2016-09-12 Thread Xiang Zhang
Xiang Zhang added the comment: Just need to delete the lines :) : diff -r 0773e5cb8608 Objects/dictobject.c --- a/Objects/dictobject.c Mon Sep 12 14:43:14 2016 +0200 +++ b/Objects/dictobject.c Mon Sep 12 21:26:41 2016 +0800 @@ -1011,10 +1011,7 @@ ep = &ep0[mp->

[issue28077] Fix find_empty_slot in dictobject

2016-09-12 Thread Xiang Zhang
Changes by Xiang Zhang : -- resolution: fixed -> status: closed -> open ___ Python tracker <http://bugs.python.org/issue28077> ___ ___ Python-bugs-list

[issue28040] compact dict : SystemError: returned NULL without setting an error.

2016-09-12 Thread Xiang Zhang
Xiang Zhang added the comment: I'd like to reopen this one since I still don't think this change is needed and suggest to revert since this change make split table combined on deletion. Deletion will not alter split dict's order. Only insertion after deletion will. But this

[issue28040] compact dict : SystemError: returned NULL without setting an error.

2016-09-12 Thread Xiang Zhang
Xiang Zhang added the comment: Ohh, mistakes. > so you can produce can should be can not > We only add We only need to add > you can product the product should be produce -- ___ Python tracker <http://bugs.python.or

[issue28040] compact dict : SystemError: returned NULL without setting an error.

2016-09-12 Thread Xiang Zhang
Xiang Zhang added the comment: > add tons of test for shared-key dict So what if we delete mp->ma_used == ix or use mp->ma_keys->dk_nentries == ix? Do we still have any case breaking the order? -- ___ Python tracker <http://

[issue27952] Finish converting fixcid.py from regex to re

2016-09-12 Thread Xiang Zhang
Xiang Zhang added the comment: Can we silence the debug output? ./python -m test test_tools Run tests sequentially 0:00:00 [1/1] test_tools *recursedown('@test_20410_tmp') 1 test OK. Total duration: 4 sec Tests result: SUCCESS -- nosy: +xiang.zhang status: clos

[issue28040] compact dict : SystemError: returned NULL without setting an error.

2016-09-13 Thread Xiang Zhang
Xiang Zhang added the comment: > assert list(b.__dict__.keys()) == ['b', 'a']) # AssertionError! No, there is no error. Once an pending slot is encountered it is combined. But inserting pending slots is prohibited and it's far from ideal. We need to know if

[issue28077] Fix find_empty_slot in dictobject

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

[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-09-13 Thread Xiang Zhang
New submission from Xiang Zhang: _PyDict_GetItem_KnownHash should handle dk_lookup return value the same as PyDict_GetItem. BTW, it seems PyDict_GetItem can call _PyDict_GetItem_KnownHash to remove duplicate code, if you like, maybe another issue? diff -r 6acd2b575a3c Objects/dictobject.c

[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-09-13 Thread Xiang Zhang
Xiang Zhang added the comment: Hmm, I thought this is trivial so I didn't. Now upload the file patch ;). -- keywords: +patch Added file: http://bugs.python.org/file44625/issue28123.patch ___ Python tracker <http://bugs.python.org/is

[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-09-13 Thread Xiang Zhang
Xiang Zhang added the comment: _PyDict_GetItem_KnownHash is not invoked by any other dict methods. So to achieve it in pure Python level, we have to rely on others modules and objects such as OrderedDict, lru_cache. Is it a good idea to rely on those

[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-09-13 Thread Xiang Zhang
Xiang Zhang added the comment: How about let PyDict_GetItem call it? Just like the relationship of delitem and delitem_knownhash. You can see they share most codes. If we do that, it seems we can easily write a test(or there has already been a test) for it

[issue28120] Bug in _PyDict_Pop() on a splitted table

2016-09-13 Thread Xiang Zhang
Xiang Zhang added the comment: No need, you can reproduce it by this: >>> class C: ... pass ... >>> a, b = C(), C() >>> a.a, a.b = 1, 2 >>> b.a = 1 >>> b.__dict__.pop('b') python: Objects/dictobject.c:1739: _PyDict_Pop: Assertion `

[issue28120] Bug in _PyDict_Pop() on a splitted table

2016-09-13 Thread Xiang Zhang
Xiang Zhang added the comment: I submit a patch that can solve this. Actually I find it before but forget about it -- keywords: +patch Added file: http://bugs.python.org/file44631/issue28120.patch ___ Python tracker <http://bugs.python.

[issue28120] Bug in _PyDict_Pop() on a splitted table

2016-09-13 Thread Xiang Zhang
Xiang Zhang added the comment: v2 now enhances existing dict.pop() unittest to cover this case. -- Added file: http://bugs.python.org/file44632/issue28120_v2.patch ___ Python tracker <http://bugs.python.org/issue28

[issue28120] Bug in _PyDict_Pop() on a splitted table

2016-09-13 Thread Xiang Zhang
Changes by Xiang Zhang : Added file: http://bugs.python.org/file44633/issue28120_v3.patch ___ Python tracker <http://bugs.python.org/issue28120> ___ ___ Python-bugs-list m

[issue28131] assert statements missed when loaded by zipimporter

2016-09-13 Thread Xiang Zhang
Xiang Zhang added the comment: This is introduced in 663a62bcf9c9. The compile optimize flag is opened in the change. -- nosy: +steve.dower, xiang.zhang ___ Python tracker <http://bugs.python.org/issue28

[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-09-14 Thread Xiang Zhang
Xiang Zhang added the comment: Update the patch with unittest. -- Added file: http://bugs.python.org/file44655/issue28123_v2.patch ___ Python tracker <http://bugs.python.org/issue28

[issue28144] Decrease empty_keys_struct's dk_refcnt

2016-09-14 Thread Xiang Zhang
New submission from Xiang Zhang: There is no dummy_struct any more. So I think we can decrease empty_keys_struct's dk_refcnt. -- files: empty_keys.patch keywords: patch messages: 276405 nosy: haypo, methane, xiang.zhang priority: normal severity: normal status: open title: Dec

[issue28147] Unbounded memory growth resizing split-table dicts

2016-09-14 Thread Xiang Zhang
Xiang Zhang added the comment: > I confirmed and investigated it. Thanks! I'll post patch including more test in 24 hours. Please wait a second. The cause of this problem is that attribute setting causes a combined table to be splitted (the code path is [0]->[1]->[2]->[3]).

[issue28147] Unbounded memory growth resizing split-table dicts

2016-09-14 Thread Xiang Zhang
Xiang Zhang added the comment: > popitem() before does the same thing and should never cause a problem. Ahh, this seems not true. Test it in py3.5 also crash. -- ___ Python tracker <http://bugs.python.org/issu

[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-09-16 Thread Xiang Zhang
Xiang Zhang added the comment: Yes, ignoring exceptions is due to historical reasons. Although it's used rarely but I am still afraid changing it may break knowledge of devs that are already familiar with dict APIs. And what's more is there already exists two versions of getitem, o

[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-09-16 Thread Xiang Zhang
Xiang Zhang added the comment: Hah, Okay. I'll make the corresponding change then. -- ___ Python tracker <http://bugs.python.org/issue28123> ___ ___ Pytho

[issue28179] Segfault in test_recursionlimit_fatalerror

2016-09-17 Thread Xiang Zhang
Xiang Zhang added the comment: This snippet also crashes in Py3.5 -- nosy: +larry, xiang.zhang versions: +Python 3.5 ___ Python tracker <http://bugs.python.org/issue28

[issue28183] Clean up and speed up dict iteration

2016-09-17 Thread Xiang Zhang
Xiang Zhang added the comment: Serhiy, I don't understand your patch. You delete the logic about split table and then iterating split table actually fails. >>> class C: ... pass ... >>> a, b = C(), C() >>> a.a, a.b = 1, 2 >>> list(b.__dict__) [

[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-09-17 Thread Xiang Zhang
Xiang Zhang added the comment: Victor, v3 now applies your suggestion. -- Added file: http://bugs.python.org/file44713/issue28123_v3.patch ___ Python tracker <http://bugs.python.org/issue28

[issue28189] dictitems_contains swallows compare errors

2016-09-17 Thread Xiang Zhang
New submission from Xiang Zhang: Now, when compare errors raised during `in`, dict.keys(), dict.values() and set all propagate the errors. But dict.items() will swallow the errors(only key compare): >>> class BadEq: ... def __hash__(self): ... return 7 ... def __

[issue28183] Clean up and speed up dict iteration

2016-09-18 Thread Xiang Zhang
Xiang Zhang added the comment: Serhiy: Patch LGTM except two trivial comments on Rietveld. Raymond: With such implementation keys, values and hashes are all organized together and there seems no _resize operation can only adjust hashes without breaking the entire layout

[issue28194] Clean up some checks in dict implementation

2016-09-18 Thread Xiang Zhang
New submission from Xiang Zhang: The proposed patch cleans up some unnecessary parts in dict implementation especially NULL checks in lookup functions. There are four states a DictKeyEntry can be. Only in unused(empty) and dummy states me_key can be NULL. So NULL checks in used and pending

[issue28194] Clean up some checks in dict implementation

2016-09-18 Thread Xiang Zhang
Xiang Zhang added the comment: Apply methane's comment, preserving the comment. -- Added file: http://bugs.python.org/file44738/dict_clean_up_v2.patch ___ Python tracker <http://bugs.python.org/is

[issue28147] Unbounded memory growth resizing split-table dicts

2016-09-18 Thread Xiang Zhang
Xiang Zhang added the comment: LGTM. But why this change? -#define ESTIMATE_SIZE(n) (((n)*3) >> 1) +#define ESTIMATE_SIZE(n) (((n)*3+1) >> 1) -- ___ Python tracker <http://bugs.python

[issue28199] Compact dict resizing is doing too much work

2016-09-18 Thread Xiang Zhang
Xiang Zhang added the comment: Then how about entries(key, value pairs)? The size of entries does not match the available hash slots. For example, an empty dict allocates a hash array with 5 available slots and 5 entries. Now we resize the hash array to size 16 and it can afford 10 entries

[issue28189] dictitems_contains swallows compare errors

2016-09-18 Thread Xiang Zhang
Xiang Zhang added the comment: Thanks for the merge Raymond. :) -- stage: patch review -> resolved ___ Python tracker <http://bugs.python.org/issue28189> ___ _

[issue28147] Unbounded memory growth resizing split-table dicts

2016-09-18 Thread Xiang Zhang
Xiang Zhang added the comment: Ahh, I see. > If there are any integer a such as ESTIMATE_SIZE(a) == n and n == 2**m and > USABLE_FRACTION(n) == a - 1. There are, such as 11, 43... > a items cannot be inserted into dict after dictresize(d, ESTIMATE_SIZE(a)) It can but needs another

[issue28202] Python 3.5.1 C API, the global variable is not destroyed when delete the module

2016-09-19 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +brett.cannon, eric.snow, ncoghlan ___ Python tracker <http://bugs.python.org/issue28202> ___ ___ Python-bugs-list mailin

[issue28204] very useful information

2016-09-19 Thread Xiang Zhang
Changes by Xiang Zhang : -- Removed message: http://bugs.python.org/msg276964 ___ Python tracker <http://bugs.python.org/issue28204> ___ ___ Python-bugs-list m

[issue28204] very useful information

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

[issue28211] Wrong return value type in the doc of PyMapping_Keys/Values/Items

2016-09-20 Thread Xiang Zhang
New submission from Xiang Zhang: PyMapping_Keys/Values/Items can only return a list or tuple. Even in the case of a dict, it returns a list. But the doc tells a dictionary view will be returned in case of dict, which is wrong. -- assignee: docs@python components: Documentation files

[issue28216] micro optimization for import_all_from

2016-09-20 Thread Xiang Zhang
New submission from Xiang Zhang: Since PyMapping_Keys always return a list or tuple and most __all__s are list (all in stdlib), I think we can avoid calling PySequence_GetItem for every key and use PySequence_Fast* APIs instead. This doesn't help much since other operations involve

[issue28216] micro optimization for import_all_from

2016-09-20 Thread Xiang Zhang
Xiang Zhang added the comment: As pointed out by Serhiy, PyObject_GetAttr may change __all__ so my proposal is not going to work. Close this and sorry for noise. :-( -- resolution: -> rejected stage: patch review -> resolved status: open -&g

[issue28222] test_distutils fails

2016-09-20 Thread Xiang Zhang
New submission from Xiang Zhang: test_distutils consistently fails now: ./python -m test test_distutils Run tests sequentially 0:00:00 [1/1] test_distutils test test_distutils failed -- Traceback (most recent call last): File "/home/angwer/cpython/Lib/distutils/tests/test_check.py"

[issue28222] test_distutils fails

2016-09-21 Thread Xiang Zhang
Xiang Zhang added the comment: The reason for this failure is lack of pygments. docutils seems to require pygments when parsing code block even in doc. But docutils doesn't treat pygments as a dependency and pip install it won't pull i

[issue28225] bz2 does not support pathlib

2016-09-21 Thread Xiang Zhang
New submission from Xiang Zhang: I opened a similar issue before: issue27511. Feel free to close it. -- nosy: +xiang.zhang ___ Python tracker <http://bugs.python.org/issue28

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

2016-09-23 Thread Xiang Zhang
Xiang Zhang added the comment: calendar internally relies on datetime and uses datetime.date. datetime.date can't represent date more than .12.31 so some logic is broken for it(normally the week list should be of length 7, date outside the month will be (0, x) pair but this is no

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

2016-09-23 Thread Xiang Zhang
Changes by Xiang Zhang : -- keywords: +patch Added file: http://bugs.python.org/file44789/calendar_pryear_.patch ___ Python tracker <http://bugs.python.org/issue28

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

2016-09-23 Thread Xiang Zhang
Xiang Zhang added the comment: Something like this? diff -r 15f82b64eee0 Lib/calendar.py --- a/Lib/calendar.py Thu Sep 22 17:11:53 2016 -0700 +++ b/Lib/calendar.py Fri Sep 23 16:27:03 2016 +0800 @@ -181,6 +181,9 @@ yield (0, date.weekday()) else

[issue28255] TextCalendar.prweek/month/year outputs an extra whitespace character

2016-09-23 Thread Xiang Zhang
New submission from Xiang Zhang: Currently TextCalendar.prweek/month/year outputs an extra whitespace which makes the output weird: >>> calendar.TextCalendar().prweek([(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7)], >>> 2) 1 2 3 4 5 6 7 >>> calendar.Te

[issue28255] TextCalendar.prweek/month/year outputs an extra whitespace character

2016-09-23 Thread Xiang Zhang
Xiang Zhang added the comment: > prweek() in Python 2 adds a final space. Python 3 version looks correct. Really? `print '1',` in my mind will output a newline and no trailing space. And I think we should also add a comma in pryear in py2. -- Added file: http://bu

[issue28255] TextCalendar.prweek/month/year outputs an extra whitespace character

2016-09-23 Thread Xiang Zhang
Changes by Xiang Zhang : -- Removed message: http://bugs.python.org/msg277263 ___ Python tracker <http://bugs.python.org/issue28255> ___ ___ Python-bugs-list m

[issue28255] TextCalendar.prweek/month/year outputs an extra whitespace character

2016-09-23 Thread Xiang Zhang
Xiang Zhang added the comment: A single `print x,` seems to me won't add the trailing space. And I don't understand why in py2 repl even with comma there is still a newline: >>> print 'a', a >>> >>> print('a', end='') a>

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

2016-09-23 Thread Xiang Zhang
Xiang Zhang added the comment: How about the approach in calendar_prcal__demo.patch? If it's not bad I can add tests then. -- Added file: http://bugs.python.org/file44793/calendar_prcal__demo.patch ___ Python tracker <http://bugs.py

[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

[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

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

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

[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

[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

<    11   12   13   14   15   16   17   18   >