INADA Naoki added the comment:
On Fri, Apr 15, 2016 at 11:31 PM, Guido van Rossum <rep...@bugs.python.org>
wrote:
>
> Guido van Rossum added the comment:
>
> I don't like the way "):" is indented in that example.
Me too.
I haven't know about this PEP8 update.
ht
INADA Naoki added the comment:
How about recommend using parentheses to avoid different level operators have
same indent level?
ok:
if (width == 0
and height == 0
and color == 'red'
and emphasis == 'strong
INADA Naoki added the comment:
Thank you for reporting.
Japanese translation team has own issue tracker in Github.
I copied this issue to https://github.com/python-doc-ja/python-doc-ja/issues/733
--
nosy: +naoki
___
Python tracker <
INADA Naoki added the comment:
https://github.com/python/peps/compare/master...IanLee1521:issue26763
--
nosy: +naoki
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
INADA Naoki added the comment:
Roundup doesn't link to Github's branch comparing URL correctly.
How about just create pull request on Github?
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
INADA Naoki added the comment:
@mmarkk
Do you read full docstring? It's documented very clearly.
---
int.to_bytes(length, byteorder, *, signed=False) -> bytes
Return an array of bytes representing an integer.
The integer is represented using length bytes. An OverflowError is
rai
INADA Naoki added the comment:
docstring says:
The integer is represented using length bytes. An OverflowError is
raised if the integer is not representable with the given number of
bytes.
(Python 3.5.2)
--
nosy: +methane
___
Python tracker <
INADA Naoki added the comment:
> asyncio uses loop.create_future() to create sockets. I'd suggest you to
> create two base test classes: one that monkeypatches loop.create_future to
> return pure python Future in its setUp method; an another, that makes
> create_future to return
New submission from INADA Naoki:
https://docs.python.org/3/faq/design.html#why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list
> The major reason is history.
...
> but it’s a part of Python, and it’s too late to make such fundamental c
INADA Naoki added the comment:
Implemented FutureIter
--
Added file: http://bugs.python.org/file44081/futures.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Changes by INADA Naoki <songofaca...@gmail.com>:
Added file: http://bugs.python.org/file44110/compact-dict.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Changes by INADA Naoki <songofaca...@gmail.com>:
Added file: http://bugs.python.org/file44086/compact-dict.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
INADA Naoki added the comment:
> Left a couple of comments; the important one -- Future.__await__ (and
> Future.__iter__) should always return a *new* instance of a generator-like
> object (tied to the Future object).
Implementing full behavior of generator seems difficult to
INADA Naoki added the comment:
Thanks. I'll working on test_asyncio in next few days.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
INADA Naoki added the comment:
Last patch I've posted implements "strict ordering rule" on key sharing dict.
* Insertion order should be strictly equal to order in shared key.
If insertion position is not equal to ma_used, convert it to combined
form.
* Deleting from s
INADA Naoki added the comment:
And Python benchmark result is here.
https://gist.github.com/methane/e7a2ae389ca13905508905f5fa4ad46c
pickup
---
### call_method_slots ###
Min: 0.282221 -> 0.266215: 1.06x faster
Avg: 0.282379 -> 0.266448: 1.06x faster
Significant (t=780.35)
Stddev: 0
Changes by INADA Naoki <songofaca...@gmail.com>:
Added file: http://bugs.python.org/file43558/compact-dict.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
New submission from INADA Naoki:
PyDict_SetDefault() was added Python 3.4
Currently, PyUnicode_InternInPlace() uses PyDict_GetItem, and PyDict_SetItem if
no item found.
It can be replaced PyDict_SetDefault() easily.
--
components: Interpreter Core
files: intern-setdefault.patch
INADA Naoki added the comment:
Thank you for pointing it out.
That comment seems useless when removing PyDict_GetItem(). So I removed it.
--
Added file: http://bugs.python.org/file43634/intern-setdefault2.patch
___
Python tracker <
INADA Naoki added the comment:
I'm working on this. Some bugs are fixed, but doesn't pass tests for now.
https://github.com/methane/cpython/pull/5
--
nosy: +methane
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
INADA Naoki added the comment:
Passing all tests now.
Yury, could you explain what the comment "This isn't a Future class; it's a
BaseFuture" means?
Should it be "_futures.Future" or "_futures.BaseFuture"?
--
_
INADA Naoki added the comment:
Should I send pull request to github.com/python/asyncio?
Or should I post patch here?
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
INADA Naoki added the comment:
OK. Here is current version.
--
Added file: http://bugs.python.org/file43670/futures.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
INADA Naoki added the comment:
In my patch, test_asyncio runs against C version Future.
I saw how test_json tests against C version and pure Python version.
But test_asyncio is more larger than test_json.
Before working on it, could someone give me idea to run whole test_asyncio
INADA Naoki added the comment:
ping
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27350>
___
___
Python-bugs-list mailing list
INADA Naoki added the comment:
Yury, could you review this before 3.6a4?
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26081>
___
__
INADA Naoki added the comment:
I see, and I'm sorry about that.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27350>
___
___
New submission from INADA Naoki:
When bytes(x), bytes_new checks if x is integer via PyNumber_AsSize_t(x).
It cause TypeError internally.
When x is not an integer, especially bytearray or memoryview, the internal
exception cause significant overhead.
# HEAD
$ ./python -m timeit -s 'data
INADA Naoki added the comment:
Thanks for comments.
--
Added file: http://bugs.python.org/file44059/fast-bytearray-fromobject.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
INADA Naoki added the comment:
Maybe, `socket.getfqdn()` returns non-ASCII string in your environment.
smtpd.py has `-u` option which enables utf-8 support.
smtpd.SMTPServer has enable_SMTPUTF8 option.
test_logging.TestSMTPServer should enable this option.
Could you test adding
INADA Naoki added the comment:
Oops, previous patch doesn't update magic number in PC/launcher.c
Should I update it? Or don't touch it to avoid additional conflicts?
--
Added file: http://bugs.python.org/file43601/call_method_3.patch
___
Python
INADA Naoki added the comment:
Updated, based on 102241:908b801f8a62
--
nosy: +naoki
Added file: http://bugs.python.org/file43599/call_method_2.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
INADA Naoki added the comment:
My motivation is improve speed, reduce memory usage, and quicker
startup time for real world applications. If some optimization in
FAT optimizer has significant speedup, I want to try it.
But this time, my motivation is I felt "everyone think constant fo
INADA Naoki added the comment:
OK, let's forget Py_HASH_CUTOFF for now and focus on SipHash-13.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Changes by INADA Naoki <songofaca...@gmail.com>:
--
dependencies: -Add tp_fastcall to PyTypeObject: support FASTCALL calling
convention for all callable objects
resolution: -> fixed
stage: -> resolved
status: open -> closed
___
INADA Naoki added the comment:
I'm running pyperformance.
--
Added file: http://bugs.python.org/file46487/loadmethod-methoddescr.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
INADA Naoki added the comment:
Here is the result. I'll investigate mako result.
+ ../python.default -m perf compare_to default.json patched.json -G
--min-speed=1
Slower (20):
- mako: 40.9 ms +- 0.4 ms -> 44.7 ms +- 0.6 ms: 1.09x slower (+9%)
- chaos: 298 ms +- 3 ms -> 308 ms +- 2 ms:
INADA Naoki added the comment:
microbench:
$ ./python.patched -m perf timeit --compare-to `pwd`/python.default -s "d =
b''" -- "d.decode('ascii')"
python.default: . 109 ns +- 1 ns
python.patched: . 102 ns +- 1 ns
Median +- std dev:
INADA Naoki added the comment:
LOAD_METHOD support was based on tp_fastcall.
Without LOAD_METHOD support, methoddescr_get is called and
stack layout after LOAD_METHOD is:
NULL, (bound)PyCFunction, arg1, arg2, ... argN
With LOAD_METHOD support, stack layout is:
PyMethodDescrObject, self
INADA Naoki added the comment:
I confirmed bm_mako performance degrade is caused by L1 cache miss.
(I didn't use --with-optimization)
https://gist.github.com/methane/b33edbf1f123ae026e704b0e005c3606
--
___
Python tracker <rep...@bugs.python.
INADA Naoki added the comment:
>> We have already Constant and NameConstant. So it seems there are no need for
>> None, Bool, TupleConst, SetConst nodes.
> Yes, Constant is Victor's version of Lit.
Then, may I remove ast.Lit, and use Constant and NameConstant?
>> I thin
Changes by INADA Naoki <songofaca...@gmail.com>:
--
components: +Interpreter Core
type: -> performance
___
Python tracker <rep...@bugs.python.org>
<http://bugs.pyt
INADA Naoki added the comment:
$ ../python.default -m perf compare_to default.json patched4.json -G
Slower (2):
- scimark_sor: 479 ms +- 8 ms -> 485 ms +- 9 ms: 1.01x slower (+1%)
- genshi_xml: 196 ms +- 2 ms -> 196 ms +- 2 ms: 1.00x slower (+0%)
Faster (19):
- json_loads: 62.7 us +-
INADA Naoki added the comment:
Before trying advanced optimizations, I want move suspended obvious
optimizations forwards.
For example, removing unused constants is suspended because constant folding
should be moved from peephole to AST. This is why I found this issue.
After that, I'm
INADA Naoki added the comment:
> PEP 456 defines an API to add more hashing algorithms and make the selection
> of hash algorithm a compile time option. We can easily add SipHash-1-3 and
> make it the default algorithm. Vendors then can select between FNV2,
> SipHash-1-3 and SipH
INADA Naoki added the comment:
> it seems as if it would make sense to not use a fixed
> hash algorithm for all strings lengths, but instead a
> hybrid one to increase performance for short strings
> (which are used a lot in Python).
>
> Is there a good hash algorithm wi
New submission from INADA Naoki:
Rust and Ruby moved from SipHash-2-4 to SipHash-1-3.
https://github.com/rust-lang/rust/issues/29754
https://bugs.ruby-lang.org/issues/13017
SipHash-1-3 seems faster than 2-4 and secure enough.
--
messages: 286590
nosy: inada.naoki
priority: normal
INADA Naoki added the comment:
I'm running pyperformance.
BTW, hashlib doesn't provide siphash24. So can we simply replace siphash24
with siphash13, like ruby?
https://github.com/ruby/ruby/commit/04c94f95d1a1c6a12f5412228a2bcdc00f5de3b2
INADA Naoki added the comment:
I agree.
os.environ is not dict, it's a proxy of "current" environment which
is not copyable.
So I agree to copy.copy() shouldn't copy os.environ implicitly.
--
___
Python tracker <rep...@bugs.pyth
INADA Naoki added the comment:
Current Py_HASH_CUTOFF implementation seems weak.
```
switch(len) {
/* ((hash << 5) + hash) + *p == hash * 33 + *p */
case 7: hash = ((hash << 5) + hash) + *p++; /* fallthrough */
...
case 1: hash = ((hash
INADA Naoki added the comment:
Py_HASH_CUTOFF uses different secret from siphash already.
The problem is the secret doesn't affects to collision at all.
Attacker can produce large number of collision, without knowing the secret.
BTW, we have FNV already. Let's survey about FNV-1 short string
INADA Naoki added the comment:
https://emboss.github.io/blog/2012/12/14/breaking-murmur-hash-flooding-dos-reloaded/
Murmur may be safe for <16 byte too.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.or
INADA Naoki added the comment:
> 1. Changes to AST
I'm working on updating this part. There are some failing tests remains.
But I doubt this stage is worth enough for now.
> a) Merge Num, Str, Bytes and Ellipsis constructors into a single Lit
> (literal) that can hold anything
INADA Naoki added the comment:
I've tried to update ast_opt.c[t] without changing AST.
But I can't find clear way to solve "foo" + "bar" docstring problem.
This patch adds only docstring to AST.
--
Added file: http://bugs.python.org/file46542
New submission from INADA Naoki:
spin off of #11549.
This patch uses code generator to traverse AST.
--
files: ast-constant-folding.patch
keywords: patch
messages: 287186
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: AST-level Constant folding
versions: Python
Changes by INADA Naoki <songofaca...@gmail.com>:
--
dependencies: +Change docstring to attribute from first statement.
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
INADA Naoki added the comment:
I submit new issues:
* #29463 for AST change (change docstring from first statement to attribute).
* #29469 for constant folding
Note that this issue contains more peephole -> AST optimization changes.
But I want to start these two patch to ease rev
Changes by INADA Naoki <songofaca...@gmail.com>:
Added file:
http://bugs.python.org/file46556/29438-sharedkey-useafterfree-py36.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Changes by INADA Naoki <songofaca...@gmail.com>:
--
keywords: +patch
Added file:
http://bugs.python.org/file46521/29438-sharedkey-useafterfree-py35.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
INADA Naoki added the comment:
see https://mail.python.org/pipermail/python-dev/2016-September/146348.html
kwargs, __duct__, and namespace passed to metaclass are ordered by language
design.
order of other dicts are implementation detail
INADA Naoki added the comment:
Do you mean
https://github.com/pypa/pip/blob/403e398330c8e841e4633aceda859430f5f7b913/pip/_vendor/distlib/markers.py
?
This doesn't affect, maybe.
Constant folding is executed right before producing bytecode.
It doesn't affect to PyCF_ONLY_AST.
BTW, how do you
INADA Naoki added the comment:
I think it violates O(1).
"s.add(x); s.discard(x);" loop creates dummy chain.
Average chain length is determined by size of the set. So it is O(len(s))
rather than amortized O(1).
--
___
Python tr
INADA Naoki added the comment:
So what's new entry may be:
+* ``Module``, ``FunctionDef``, ``AsyncFunctionDef``, and
+ ``ClassDef`` AST nodes now have a new ``docstring`` attribute.
+ The first statement in their body is not considered as a docstring anymore.
+ This affects ``co_firstlineno
INADA Naoki added the comment:
This patch affects firstlineno and lnotab of module and class, but not
functions.
module:
- at 0x7f053a8f8b70, file "Lib/importlib/_bootstrap.py",
line 8>
+ at 0x7fdefbf10340, file "Lib/importlib/_bootstrap.py",
line 25>
filename L
INADA Naoki added the comment:
Now I doubt about this patch is really good.
docstring of Module and Class generates two bytecode.
So it's a real, executed statement.
LOAD_CONST 0 ("docstring")
STORE_NAME 0 ("__doc__")
--
__
New submission from INADA Naoki:
spin off of #11549.
http://bugs.python.org/issue11549#msg130955
> b) Docstring is now an attribute of Module, FunctionDef and ClassDef, >
> rather than a first statement. Docstring is a special syntactic
> construction, it's not an executa
INADA Naoki added the comment:
Oh, I misunderstood something.
patched Python 3.7 and system's Python 3.5 shows same output for code below.
I'll check what is actually changed.
inada-n@x250 ~/w/p/ast-docstring> cat -n x.py
1 """module docstring"""
INADA Naoki added the comment:
> Why res == 0 is added? If PyDict_SetItem() triggers recursive calling of
> _PyObjectDict_SetItem() which calls PyDict_SetItem() it may be possible that
> the first PyDict_SetItem() is failed while the dict is changed by the second
> Py
INADA Naoki added the comment:
to: Serhiy
I can reproduce the issue by 29438-minimum.py, on Python 3.7 with pydebug.
But since this issue is "use after free", it may and may not crash.
It's up to how freed memory block is used from another part of Python.
Deterministic test which do
Changes by INADA Naoki <songofaca...@gmail.com>:
Added file: http://bugs.python.org/file46569/ast-docstring-3.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Changes by INADA Naoki <songofaca...@gmail.com>:
Added file:
http://bugs.python.org/file46572/29438-sharedkey-useafterfree-py36-2.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Changes by INADA Naoki <songofaca...@gmail.com>:
--
title: Change docstring to attribute from first statement. -> Add `docstring`
attribute to AST nodes
___
Python tracker <rep...@bugs.python.org>
<http://bugs.pyt
INADA Naoki added the comment:
I like this idea.
--
nosy: +inada.naoki
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29476>
___
___
Changes by INADA Naoki <songofaca...@gmail.com>:
Added file: http://bugs.python.org/file46567/ast-docstring-2.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
INADA Naoki added the comment:
lnotab is changed too.
-0,0,0,115,12,0,0,0,8,4,4,2,8,8,8,12,
-8,25,8,13,114,18,0,0,0,99,0,0,0,0,0,0,
+0,0,0,115,10,0,0,0,12,6,8,8,8,12,8,25,
+8,13,114,18,0,0,0,99,0,0,0,0,0,0,0,0,
115 is header for bytes type.
next 4 bytes is it's length (little
INADA Naoki added the comment:
(PYTHONMALLOC=malloc valgrind find it soon. :)
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
INADA Naoki added the comment:
4385 int was_shared = cached == ((PyDictObject *)dict)->ma_keys;
4386 res = PyDict_SetItem(dict, key, value);
4387 if (was_shared && cached != ((PyDictObject *)dict)->ma_keys)
INADA Naoki added the comment:
This is use after free, not overflow.
This patch is based on Python 3.6, but I think 3.5 has same issue.
I'll check it.
--
keywords: +patch
Added file: http://bugs.python.org/file46514/29438-sharedkey-useafterfree.patch
INADA Naoki added the comment:
valgrind output is here.
https://gist.github.com/methane/3c010daba71a374fd0b6a41a0d98e3ff
It seems another bug relating to key-sharing dict...
--
nosy: +inada.naoki
___
Python tracker <rep...@bugs.python.org>
INADA Naoki added the comment:
At least, ordering of namespace dict and kwargs dict are language spec for 3.6.
This option breaks it. When this option is set, CPython 3.6 is not Python 3.6.
--
___
Python tracker <rep...@bugs.python.org>
INADA Naoki added the comment:
LGTM
--
nosy: +inada.naoki
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29453>
___
___
Python-bugs-
INADA Naoki added the comment:
I can reproduce it on Python 3.5 with attached script.
I think this bug is from Python 3.3, since key-sharing dict is implemented.
"Trigger key sharing dict resize while callbacks (weakref or __del__) called
from setitem" is step to reproduce.
It'
INADA Naoki added the comment:
It's similar to issue27945, but different.
I confirmed this issue is in 3.4 too.
https://github.com/python/cpython/blob/3.4/Objects/dictobject.c#L3798
// _PyObjectDict_SetItem()
if ((tp->tp_flags & Py_TPFLAGS_HEAPTYPE) && (cached =
New submission from INADA Naoki:
sys.getobjects() contains tuples including NULLs.
Even without pydebug, tuple under construction can be exposed accidentally.
Allowing repr() for such tuples ease investigating what is the tuple.
--
components: Interpreter Core
files: tuple-repr
INADA Naoki added the comment:
The patch missed `continue;`.
And I couldn't reproduce the problem for now.
I'll reopen when I can reproduce the problem.
--
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tra
INADA Naoki added the comment:
For checking compatibility with other implementation, I want to wait
until other implementation compatible with 3.6+ which doesn't
keep insertion order of dict.
For now, there are no 3.6+ compatible Python implementation except CPython.
For checking compatibility
INADA Naoki added the comment:
I can't understand what is the problem.
If the package produce same binary when dict keeps insertion order,
isn't it a "reproducible build"?
--
___
Python tracker <rep...@bugs.python.org>
<htt
INADA Naoki added the comment:
Here is issue tracker of Python.
py2exe and requests are third party project.
Please report an issue to py2exe issue tracker.
--
nosy: +inada.naoki
resolution: -> third party
stage: -> resolved
status: open -&g
INADA Naoki added the comment:
Why don't you use OrderdDict and reversed()?
--
nosy: +inada.naoki
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Changes by INADA Naoki <songofaca...@gmail.com>:
Added file: http://bugs.python.org/file46493/loadmethod-methoddescr-2.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
INADA Naoki added the comment:
I don't think this is a regression, bug, bogos naming.
I agree that "_0" is ugly.
But the name describes what is the thread, than "Thread-1".
How about giving default thread_name_prefix less ugly?
e.g. "ThreadPoolExecutor-worker".
INADA Naoki added the comment:
LGTM.
--
nosy: +inada.naoki
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29314>
___
___
Pyth
Changes by INADA Naoki <songofaca...@gmail.com>:
--
stage: needs patch -> commit review
___
Python tracker <rep...@bugs.python.org>
<http://bugs.pyt
INADA Naoki added the comment:
LGTM, except 2-space indent.
--
nosy: +inada.naoki
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
INADA Naoki added the comment:
"iff" is short form of "if and only if".
--
nosy: +inada.naoki
resolution: -> not a bug
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
&l
INADA Naoki added the comment:
Oh, I feel three LGTMs are positive signal.
As I commented on ML, I think "ask forgiveness than permission" is
realistic approach for patches like this.
But it's up to you.
--
___
Python tracker <rep...@bu
INADA Naoki added the comment:
OK. I'll wait for another opinions.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29212>
___
___
INADA Naoki added the comment:
Thanks. Your patch reduced memory consumption by 2%,
and number of tuples by 15%.
$ cat invtuple.py
import app
import sys
import traceback
import tracemalloc
print(tracemalloc.get_traced_memory())
allobj = sys.getobjects(0, tuple)
print(len(allobj
INADA Naoki added the comment:
LGTM
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29337>
___
___
Python-bugs-list mailing list
INADA Naoki added the comment:
merge-constants.patch LGTM
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29336>
___
___
Pyth
101 - 200 of 3038 matches
Mail list logo