Changes by Xiang Zhang :
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28598>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
gettext_c2py.patch tries to avoid the problem. It still uses eval but manually
parse the expression using tokens extracted from gettext. Tests are passed.
But there is still a problem. Both patched and original c2py fail to handle
nested ternary operator. They
Xiang Zhang added the comment:
Thanks!
--
___
Python tracker
<http://bugs.python.org/issue28580>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
#28580 and #28583 are resolved now. I think dictresize4 can be recommited now.
--
stage: needs patch -> commit review
___
Python tracker
<http://bugs.python.org/issu
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
a
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 woul
Xiang Zhang added the comment:
This seems a same problem as in #27780.
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28620>
___
___
Pytho
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
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
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
<http://bugs.python.
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 repor
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
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?
--
Changes by Xiang Zhang :
--
nosy: +ncoghlan, rhettinger
___
Python tracker
<http://bugs.python.org/issue28638>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 mil
Xiang Zhang added the comment:
LGTM. And I expect there could be a comment about the special decimal number.
--
___
Python tracker
<http://bugs.python.org/issue28
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
decima
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
<http://bug
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
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 l
Changes by Xiang Zhang :
--
keywords: +patch
stage: -> patch review
type: -> behavior
Added file: http://bugs.python.org/file45420/slots_qualname.patch
___
Python tracker
<http://bugs.python.org/i
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
<http://bugs.python.org/is
Changes by Xiang Zhang :
Added file: http://bugs.python.org/file45421/slots_qualname_v2.patch
___
Python tracker
<http://bugs.python.org/issue24329>
___
___
Python-bug
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 th
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
<http://bugs.python.org/issue24
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'
Xiang Zhang added the comment:
s/not/note
--
___
Python tracker
<http://bugs.python.org/issue28659>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
v3 updates the test cases.
--
Added file: http://bugs.python.org/file45444/slots_special_v3.patch
___
Python tracker
<http://bugs.python.org/issue24
Xiang Zhang added the comment:
Sorry Yudai, I cannot reproduce this. Both '/index.py?value=data' and
'/index.py?/' outputs 'value = None' with your index.py.
--
nosy: +martin.panter, xiang.zhang
___
Python tracker
<
Xiang Zhang added the comment:
I think this is a bug in 2.7.5 and has already been fixed. I'd suggest you get
a more recent version of 2.7. :-)
--
___
Python tracker
<http://bugs.python.org/is
Changes by Xiang Zhang :
--
stage: -> resolved
___
Python tracker
<http://bugs.python.org/issue28679>
___
___
Python-bugs-list mailing list
Unsubscrib
Changes by Xiang Zhang :
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue24339>
___
___
Python-bugs-list mailing list
Unsubscribe:
Xiang Zhang added the comment:
> The name _PyUnicode_CompareWithIdEqual looks too long to me. What about
> _PyUnicode_EqualToId?
+1. I think this name is more clear.
Serhiy's idea on the implementation sounds good. As for _PyUnicode_FROM_ID, I
think it's better f
Changes by Xiang Zhang :
Added file: http://bugs.python.org/file45480/_PyUnicode_EqualToId_v2.patch
___
Python tracker
<http://bugs.python.org/issue21449>
___
___
Pytho
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 fai
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
<h
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
Xiang Zhang added the comment:
Maybe you have forgotten to remove the debug print in the patch?
--
nosy: +xiang.zhang
___
Python tracker
<http://bugs.python.org/issue28
Xiang Zhang added the comment:
I think the stacklevel should be 3.
stacklevel = 3:
./python -Walways /tmp/a.py
/tmp/a.py:2: DeprecationWarning: Plural value must be an integer, got float
c2py('n!=1')(1.1)
stacklevel = 4:
./python -Walways /tmp/a.py
sys:1: DeprecationWarning: Pl
Xiang Zhang added the comment:
Ohh, sorry. It should be 4 and I make a mistake. Sorry for the noise. Patch
LGTM.
--
___
Python tracker
<http://bugs.python.org/issue28
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
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
<http://bugs.python.org/issue28
Xiang Zhang added the comment:
LGTM.
--
___
Python tracker
<http://bugs.python.org/issue28701>
___
___
Python-bugs-list mailing list
Unsubscribe:
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.
-
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
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 deque
Dur
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 tr
Xiang Zhang added the comment:
Here is a patch which is just a try. I don't quite like the implementation but
I can not figure out a better solution. The examples in this one and #28696
seems to work and no test fails currently.
--
Added file: http://bugs.python.org/file
Xiang Zhang added the comment:
> Your patch looks to be introducing a number of changes to the structure of
> the data being passed around between threads and even monitored/indirectly
> shared across processes.
That's why I say even myself don't like it. To solve an
Xiang Zhang added the comment:
> My question is simple: in what circumstances the patch has an effect?
My original intention is that there is no need for the caller to check for the
empty string. Even there is no use case now, it could be in future.
But Serhiy, I am actually very glad to
New submission from Xiang Zhang:
The docs of the encoders of unicode-escape and raw-unicode-escape still tell
the result of the encoding is Python string object. It should be Python bytes
object.
--
assignee: docs@python
components: Documentation
files: unicode-escape-doc.patch
Changes by Xiang Zhang :
Added file: http://bugs.python.org/file45559/unicode-escape-doc_v2.patch
___
Python tracker
<http://bugs.python.org/issue28750>
___
___
Python-bug
Xiang Zhang added the comment:
> But I think the word "Python" in "Python bytes object" is redundant. It was
> needed in "Python string object" to distinguish from "C string" and "Python
> Unicode object".
Make sense. This "Pyt
Xiang Zhang added the comment:
Hi, John. This issue of robotparser has been reported in #15851. I'll close
this as duplicate and you can discuss in that thread.
--
nosy: +xiang.zhang
resolution: -> duplicate
status: open -> closed
superseder: -> Lib/robotparser.py
Changes by Xiang Zhang :
--
versions: +Python 3.7 -Python 3.5
___
Python tracker
<http://bugs.python.org/issue15851>
___
___
Python-bugs-list mailing list
Unsub
New submission from Xiang Zhang:
PyUnicode_AsUnicodeEscapeString now still has some old comments and codes about
the original "quotes" parameter of unicodeescape_string. Current implementation
could get rid of them.
--
files: PyUnicode_AsUnicodeEscapeString.patch
keywo
Xiang Zhang added the comment:
Thanks for your work, Serhiy. ;-)
--
___
Python tracker
<http://bugs.python.org/issue28760>
___
___
Python-bugs-list mailin
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
<http://bugs.python.org/issu
Changes by Xiang Zhang :
--
stage: -> resolved
___
Python tracker
<http://bugs.python.org/issue28766>
___
___
Python-bugs-list mailing list
Unsubscrib
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
1701 - 1760 of 1760 matches
Mail list logo