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
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
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
Xiang Zhang added the comment:
It's fine, knowing that the maintainer thinks this behaviour is okay. :)
--
___
Python tracker
<http://bugs.python.org/is
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
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
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
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
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
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
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
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
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.
>>&
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',
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
Changes by Xiang Zhang :
--
nosy: +serhiy.storchaka
___
Python tracker
<http://bugs.python.org/issue27963>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
ping :)
--
___
Python tracker
<http://bugs.python.org/issue27683>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
Run hg bisect and get 756c27efe193.
--
nosy: +benjamin.peterson
___
Python tracker
<http://bugs.python.org/issue27968>
___
___
Pytho
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
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
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",
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
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.
Xiang Zhang added the comment:
Ping this and hope you don't forget about it David. :)
--
___
Python tracker
<http://bugs.python.org/issue27931>
___
___
Pytho
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.
Changes by Xiang Zhang :
--
keywords: +patch
Added file: http://bugs.python.org/file44493/issue28040.patch
___
Python tracker
<http://bugs.python.org/issue28
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
Xiang Zhang added the comment:
does should be does not. Sorry.
--
___
Python tracker
<http://bugs.python.org/issue28040>
___
___
Python-bugs-list mailin
Changes by Xiang Zhang :
Removed file: http://bugs.python.org/file44493/issue28040.patch
___
Python tracker
<http://bugs.python.org/issue28040>
___
___
Python-bugs-list m
Changes by Xiang Zhang :
--
Removed message: http://bugs.python.org/msg275292
___
Python tracker
<http://bugs.python.org/issue28040>
___
___
Python-bugs-list m
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(
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,
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
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
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
Changes by Xiang Zhang :
--
keywords: +patch
Added file: http://bugs.python.org/file44556/test_socket.patch
___
Python tracker
<http://bugs.python.org/issue28
Xiang Zhang added the comment:
It's your code. Do what you like. :)
--
___
Python tracker
<http://bugs.python.org/issue28078>
___
___
Python-bugs-list m
Xiang Zhang added the comment:
Christian, you forget a : after else.
--
status: pending -> open
___
Python tracker
<http://bugs.python.org/issue28078>
___
_
Changes by Xiang Zhang :
--
resolution: -> fixed
stage: commit review -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.or
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"
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
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
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
Xiang Zhang added the comment:
mp_values should be mp->ma_values, sorry.
--
___
Python tracker
<http://bugs.python.org/issue28077>
___
___
Python-bugs-list mai
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->
Changes by Xiang Zhang :
--
resolution: fixed ->
status: closed -> open
___
Python tracker
<http://bugs.python.org/issue28077>
___
___
Python-bugs-list
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
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
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://
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
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
Changes by Xiang Zhang :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.or
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
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
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
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
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 `
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.
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
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
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
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
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
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]).
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
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
Xiang Zhang added the comment:
Hah, Okay. I'll make the corresponding change then.
--
___
Python tracker
<http://bugs.python.org/issue28123>
___
___
Pytho
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
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__)
[
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
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 __
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
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
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
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
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
Xiang Zhang added the comment:
Thanks for the merge Raymond. :)
--
stage: patch review -> resolved
___
Python tracker
<http://bugs.python.org/issue28189>
___
_
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
Changes by Xiang Zhang :
--
nosy: +brett.cannon, eric.snow, ncoghlan
___
Python tracker
<http://bugs.python.org/issue28202>
___
___
Python-bugs-list mailin
Changes by Xiang Zhang :
--
Removed message: http://bugs.python.org/msg276964
___
Python tracker
<http://bugs.python.org/issue28204>
___
___
Python-bugs-list m
Changes by Xiang Zhang :
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue28204>
___
___
Python-bugs-list mailing list
Unsubscrib
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
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
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
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"
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
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
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
Changes by Xiang Zhang :
--
keywords: +patch
Added file: http://bugs.python.org/file44789/calendar_pryear_.patch
___
Python tracker
<http://bugs.python.org/issue28
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
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
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
Changes by Xiang Zhang :
--
Removed message: http://bugs.python.org/msg277263
___
Python tracker
<http://bugs.python.org/issue28255>
___
___
Python-bugs-list m
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>
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
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
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
Xiang Zhang added the comment:
Why not OrderedDict.popitem(last=False)?
--
___
Python tracker
<http://bugs.python.org/issue28293>
___
___
Python-bugs-list mailin
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
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
1501 - 1600 of 1760 matches
Mail list logo