New submission from INADA Naoki:
In [1]: import datetime
In [2]: datetime.datetime.utcfromtimestamp(0)
Out[2]: datetime.datetime(1970, 1, 1, 0, 0)
In [3]:
datetime.datetime.utcfromtimestamp(0).replace(tzinfo=datetime.timezone.utc)
Out[3]: datetime.datetime(1970, 1, 1, 0, 0, tzinfo
INADA Naoki added the comment:
This is not a spelling issue.
When people writing code converting between unixtime and datetime,
they should find `.timestamp()` and `.utcfromtimestamp()`.
But they may not awake about `.replace(tzinfo=datetime.timezone.utc)` is very
important.
Since
INADA Naoki added the comment:
akira:
It seems cleaner than utcfromtimestamp().replace().
I think utcfromtimestamp() should have note about it.
"""
Note that it returns **naive** (tz=None) datetime. Naive datetime is
treated as localtime in most functions.
If you want to create
New submission from INADA Naoki:
I prefer ensure_ascii=False because it's efficient.
But I notice it is very slower.
On Python 3.4.2:
In [3]: %timeit json.dumps([{'hello': 'world'}]*100)
1 loops, best of 3: 74.8 µs per loop
In [4]: %timeit json.dumps([{'hello
INADA Naoki added the comment:
I've copied test_encode_basestring_ascii.py and modify it for this patch.
--
Added file: http://bugs.python.org/file37654/test_encode_basestring.py
___
Python tracker
<http://bugs.python.org/is
INADA Naoki added the comment:
Patch update.
Now C version does escaping same way to Python version.
--
Added file: http://bugs.python.org/file37656/json-fast-unicode-encode.patch
___
Python tracker
<http://bugs.python.org/issue23
INADA Naoki added the comment:
I've updated patch to use PyUnicode_MAX_CHAR_VALUE().
--
Added file: http://bugs.python.org/file37669/json-fast-unicode-encode.patch
___
Python tracker
<http://bugs.python.org/is
INADA Naoki added the comment:
test_encode_basestring_ascii.py has duplicated test cases.
--
Added file: http://bugs.python.org/file37670/json-fast-unicode-encode.patch
___
Python tracker
<http://bugs.python.org/issue23
New submission from INADA Naoki:
surrogateescape is recommended way to mix binary data in string protocol.
But surrogateescape is too slow and it cause usability problem.
One actual problem is: https://github.com/PyMySQL/PyMySQL/issues/366
surrogateescape is slow because errorhandler is called
INADA Naoki added the comment:
On MacBook Pro (Core i5 2.6GHz), surrogateescape 1MB data takes 250ms.
In [1]: bs = bytes(range(256)) * (4 * 1024)
In [2]: len(bs)
Out[2]: 1048576
In [3]: %timeit x = bs.decode('ascii', 'surrogateescape')
1 loops, best o
INADA Naoki added the comment:
I've stripped Serhiy's patch for ascii.
Here is benchmark result:
https://gist.github.com/methane/2376ac5d20642c05a8b6#file-result-md
Is there chance for applying this patch to 3.5.1?
--
Added file:
http://bugs.python.org/file40195/faster-de
INADA Naoki added the comment:
> Why are bytes being escaped in a binary blob? The reason to use
> surrogateescape is when you have data that is mostly text, should be
> processed as text, but can have occasional binary data. That wouldn't seem
> to apply to a database bi
INADA Naoki added the comment:
UTF-8 and Latin1 are typical encoding for MySQL query.
When inserting BLOB:
# Decode binary data
x = data.decode('ascii', 'surrogateescape')
# %-format query
psql = sql % (escape(x),) # sql is unicode
# Encode sql to connection enco
INADA Naoki added the comment:
FYI, I found a workaround.
https://github.com/PyMySQL/PyMySQL/pull/409
_table = [chr(i) for i in range(128)] + [chr(i) for i in range(0xdc80, 0xdd00)]
def decode_surroundescape(s):
return s.decode('latin1').translate(_table)
In [15]: data = b
New submission from INADA Naoki:
Script cannot run in iBook is included in ePub.
Attached patch resolves the issue.
--
assignee: docs@python
components: Documentation
files: epub.patch
keywords: patch
messages: 258734
nosy: docs@python, naoki
priority: normal
severity: normal
status
INADA Naoki added the comment:
O/T
Hi, Julien.
I'm maintainer of Python Document Japanese translation project.
(http://docs.python.jp/ )
We use Transifex to ease many volunteers working on translating.
https://www.transifex.com/python-doc-ja/python-35/dashboard/
Repository of Pytho
Changes by INADA Naoki :
--
nosy: +naoki
___
Python tracker
<http://bugs.python.org/issue10401>
___
___
Python-bugs-list mailing list
Unsubscribe:
INADA Naoki added the comment:
Can we use LTO without PGO?
PGO increases build time few times.
--
nosy: +naoki
___
Python tracker
<http://bugs.python.org/issue25
INADA Naoki added the comment:
Sorry my poor English.
I meant that "Does `./configure --with-lto && make` use LTO?".
--
___
Python tracker
<http://bugs.
INADA Naoki added the comment:
I've tried LTO without PGO in Debian Jessie.
$ LTOFLAGS='-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none'
$ CFLAGS=$LTOFLAGS LDFLAGS=$LTOFLAGS ./configure --prefix=...
$ make -j32
results is here (compared with neither LTO
INADA Naoki added the comment:
The machine is Google Compute Engine n1-highcpu-32 (Intel Ivy Bridge)
Linux bench 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17)
x86_64 GNU/Linux
cpuinfo:
processor : 31
vendor_id : GenuineIntel
cpu family : 6
model
INADA Naoki added the comment:
> For sure you are not the only user that has active workloads on the physical
> machine while you do benchmarks :)
I think largest machine type I chosen (32core) can avoid sharing physical
machine with other users.
> On the other hand, the path you
INADA Naoki added the comment:
https://github.com/python/peps/compare/master...IanLee1521:issue26763
--
nosy: +naoki
___
Python tracker
<http://bugs.python.org/issue26
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
<http://bugs.python.o
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:
On Fri, Apr 15, 2016 at 11:31 PM, Guido van Rossum
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.
https
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
<h
INADA Naoki added the comment:
lgtm.
But http://bugs.python.org/issue27350 conflicts this.
--
nosy: +methane
___
Python tracker
<http://bugs.python.org/issue27
Changes by INADA Naoki :
Added file: http://bugs.python.org/file44395/compact-dict.patch
___
Python tracker
<http://bugs.python.org/issue27350>
___
___
Python-bugs-list m
INADA Naoki added the comment:
Update the patch to use standard int types instead of adding PY_INT16_T
ref: https://bugs.python.org/issue17884
--
Added file: http://bugs.python.org/file44418/compact-dict.patch
___
Python tracker
<h
INADA Naoki added the comment:
I've forgot to convert split table into combined table when del and .pop().
I'm sorry, and thanks to finding it.
--
Added file: http://bugs.python.org/file44497/fix-compact-dict-deletion.patch
___
Python trac
Changes by INADA Naoki :
Added file: http://bugs.python.org/file44498/fix-compact-dict-deletion.patch
___
Python tracker
<http://bugs.python.org/issue28040>
___
___
Pytho
INADA Naoki added the comment:
> Xiang Zhang added the comment:
>
> Are you sure INADA? The previous dict implementation has the same constraint
> but does merge in dict_pop.
>
Yes. New dict implementation preserves insertion order.
class A:
...
a, b = A(), A()
a.a, a.b
Changes by INADA Naoki :
Added file: http://bugs.python.org/file44519/fix-splittable-pop.patch
___
Python tracker
<http://bugs.python.org/issue28040>
___
___
Python-bug
INADA Naoki added the comment:
Added test which reproduce the issue on current master.
--
___
Python tracker
<http://bugs.python.org/issue28040>
___
___
Python-bug
INADA Naoki added the comment:
> Inada, I sent you an invite.
Does the invite sent me by email?
I'm sorry, but I may lost the mail.
--
___
Python tracker
<http://bugs.python.org
INADA Naoki added the comment:
3% slowdown in microbench is not surprising.
Compact dict introduces one additional indirection.
Instead, I've added freelist for most compact PyDictKeys.
So I think overall performance is almost same to before compact
INADA Naoki added the comment:
Which hg (or git) revision do you use?
--
___
Python tracker
<http://bugs.python.org/issue28061>
___
___
Python-bugs-list mailin
INADA Naoki added the comment:
According to IRC log, the issue happens on Windows.
And hg revision is a477ef882a16.
I'll try building Python on Windows 10 amd64 in this weekend.
--
___
Python tracker
<http://bugs.python.org/is
Changes by INADA Naoki :
Added file: http://bugs.python.org/file44531/fastfuture.patch
___
Python tracker
<http://bugs.python.org/issue26081>
___
___
Python-bugs-list m
INADA Naoki added the comment:
Oh, I'm sorry.
I usually working on git, and convert git diff to hg diff when posting patch.
I've used `patch -p1` instead of `hg import --no-edit` to apply git patch into
hg workdir.
I wonder if Rietveld accepts git diff format...
--
Added
INADA Naoki added the comment:
Sorry, again. fixed.
Now this passes `./python -m test.test_asyncio`
--
Added file: http://bugs.python.org/file44547/fastfuture.patch
___
Python tracker
<http://bugs.python.org/issue26
INADA Naoki added the comment:
I built acfe53a (git hash). Then:
c:\Users\inada-n\work\cpython>PCbuild\win32\python_d.exe -m test.test_dict
..
--
INADA Naoki added the comment:
I noticed I tested win32 mode. I'll rebuild on amd64 mode.
> Oh, same questions for you Naoki in fact :-)
I don't know about how to describe exist version of my Windows environment. Is
these enough?
Windows 10 Home (with Anniversary Update)
10.
INADA Naoki added the comment:
amd64 result
c:\Users\inada-n\work\cpython>PCbuild\amd64\python_d.exe -m test.test_dict
..
--
Ran 78 tests in 1.498s
INADA Naoki added the comment:
It cannot hit from Python.
The function never called for split table, since resize function combine
split table.
So we can just comment the function supports only combined table.
--
___
Python tracker
<h
INADA Naoki added the comment:
Xiang:
Preserving insertion order in shared-key dict is possible, but it's hard.
If we allow it, we should add tons of test for shared-key dict.
I'll describe why it's harder than you think.
Current implementation allow insertion to split
INADA Naoki added the comment:
> 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?
Yes. `mp->ma_used == ix` means no more guard about key ordering.
class C:
...
a, b = C()
a.a, a.b = 1, 2 # s
INADA Naoki added the comment:
Oh, very thank you, Xiang.
--
___
Python tracker
<http://bugs.python.org/issue28120>
___
___
Python-bugs-list mailing list
Unsub
INADA Naoki added the comment:
I don't understand the leak yet.
> Each time dict_resize is called, it gets a new, larger size `> minused`. If
> this is triggered many times, it will keep growing in size by a factor of two
> each time, as the previous size is passed as min
INADA Naoki added the comment:
Ah, is the leak happen in 3.6b1?
dict.pop() in 3.6b1 doesn't combine split table. It was a bug and
fixed in master branch already.
Regardless the leak, I agree that grow dict when popping is bad idea.
I'll improve
INADA Naoki added the comment:
Nice catch!
--
___
Python tracker
<http://bugs.python.org/issue28144>
___
___
Python-bugs-list mailing list
Unsubscribe:
INADA Naoki added the comment:
I confirmed and investigated it. Thanks!
I'll post patch including more test in 24 hours.
--
___
Python tracker
<http://bugs.python.org/is
Changes by INADA Naoki :
Added file: http://bugs.python.org/file44665/fix-28147.patch
___
Python tracker
<http://bugs.python.org/issue28147>
___
___
Python-bugs-list m
INADA Naoki added the comment:
This issue is caused by dictresize() and _PyObjectDict_SetItem()
1. a.__dict__.pop('a') convert the dict to combined table which has double
keysize.
2. a.a = 1 converts the dict to split table again if there are no instances
sharing key with class.
Changes by INADA Naoki :
Added file: http://bugs.python.org/file44666/fix-28147.patch
___
Python tracker
<http://bugs.python.org/issue28147>
___
___
Python-bugs-list m
INADA Naoki added the comment:
xiang is right. Python 3.5 has same issue when using popitem().
I'll make patch for 3.5. But it will be bit differ from patch for 3.6 and they
will conflict.
--
___
Python tracker
<http://bugs.python.org/is
INADA Naoki added the comment:
I'm working on fixing points you commented. Wait a minute.
Implementing __del__ and __repr__ in C is bit hard task to me.
I can't do it in this week. (maybe I can't do it in this month too.)
On Thu, Sep 15, 2016 at 7:37 AM, Yury Selivanov
INADA Naoki added the comment:
This is the patch.
And git branch is here https://github.com/methane/cpython/pull/5
--
Added file: http://bugs.python.org/file44670/fastfuture.patch
___
Python tracker
<http://bugs.python.org/issue26
INADA Naoki added the comment:
This is patch for Python 3.5.
The patch uses more conservative approach.
--
Added file: http://bugs.python.org/file44696/fix-28147-py35.patch
___
Python tracker
<http://bugs.python.org/issue28
INADA Naoki added the comment:
LGTM, thanks.
--
___
Python tracker
<http://bugs.python.org/issue28183>
___
___
Python-bugs-list mailing list
Unsubscribe:
INADA Naoki added the comment:
xiang:
dictresize(d, n) may choose keysize==n (when n == 2**m) with this patch.
If there are any integer a such as ESTIMATE_SIZE(a) == n and n == 2**m and
USABLE_FRACTION(n) == a - 1,
a items cannot be inserted into dict after dictresize(d, ESTIMATE_SIZE(a
INADA Naoki added the comment:
Current compact ordered dict implementation is bit different from yours.
When there was removed item, there are NULL entries in ma_entries, instead of
swapping last item and deleted item.
It's important to keep insertion order.
But it's easy to detect
New submission from INADA Naoki:
Current perturb shift code is like following:
for (perturb = hash; ; perturb >>= PERTURB_SHIFT) {
i = mask & ((i << 2) + i + perturb + 1);
This loop is start after first conflict. It means perturb == hash for first
conflict.
The pu
INADA Naoki added the comment:
> We can still clean this up for Python 3.6. We're in feature freeze, not
> development freeze.
Does it mean there is a chance to improve OrderedDict to use new dict
implementation, if it seems safe enough?
Is new implementation a feature?
(After
Changes by INADA Naoki :
--
keywords: +patch
Added file: http://bugs.python.org/file44759/dict-perturb-shift.patch
___
Python tracker
<http://bugs.python.org/issue28
INADA Naoki added the comment:
josh.r:
> I believe per PEP7, we're still sticking to ANSI C (aka C89), and
> specifically, "all declarations must be at the top of a block (not
> necessarily at the top of function".
Python 3.6 branch allows some C99 features.
https:/
Changes by INADA Naoki :
Added file: http://bugs.python.org/file44774/dict-perturb-shift.patch
___
Python tracker
<http://bugs.python.org/issue28201>
___
___
Python-bug
INADA Naoki added the comment:
Thanks. It seems coverity doesn't understand assert(j >= 0);
Can I tell it to coverity from source code?
--
___
Python tracker
<http://bugs.python.org
INADA Naoki added the comment:
OK, I ignored it on Coverity site.
--
___
Python tracker
<http://bugs.python.org/issue28042>
___
___
Python-bugs-list mailin
INADA Naoki added the comment:
FYI: Here is interesting article. doubly-linked list is more inefficient than
most people think.
http://alex.dzyoba.com/programming/dynamic-arrays.html
--
___
Python tracker
<http://bugs.python.org/issue28
INADA Naoki added the comment:
I want locale free Python which behaves like on C.UTF-8 locale.
(stdio encoding, preferred encoding, weekday in _strptime._strptime,
and more maybe)
But Python 3.6 is feature freeze already >_<;;
--
nosy: +inada
INADA Naoki added the comment:
lgtm
--
nosy: +inada.naoki
___
Python tracker
<http://bugs.python.org/issue18893>
___
___
Python-bugs-list mailing list
Unsub
Changes by INADA Naoki :
--
versions: +Python 2.7, Python 3.5, Python 3.6 -Python 3.2, Python 3.3, Python
3.4
___
Python tracker
<http://bugs.python.org/issue18
Changes by INADA Naoki :
--
versions: +Python 3.5
___
Python tracker
<http://bugs.python.org/issue28147>
___
___
Python-bugs-list mailing list
Unsubscribe:
INADA Naoki added the comment:
Serhiy, may I update your patch, if you're busy in this week?
--
___
Python tracker
<http://bugs.python.org/issue28183>
___
___
INADA Naoki added the comment:
Updated with small refactoring.
Confirmed passes quicktest and no warning from clang on OS X.
--
Added file: http://bugs.python.org/file44857/dict_iter3.patch
___
Python tracker
<http://bugs.python.org/issue28
Changes by INADA Naoki :
--
versions: +Python 3.7
Added file: http://bugs.python.org/file44864/dict_iter4.patch
___
Python tracker
<http://bugs.python.org/issue28
INADA Naoki added the comment:
Draft Misc/NEWS entry (and commit message) is:
Core and Builtins
-
+- Issue #28183: Optimize dict iteration.
+
--
___
Python tracker
<http://bugs.python.org/issue28
INADA Naoki added the comment:
haypo, Could you review fix-28147-py35.patch and fix-28147.patch ?
Draft NEWS entry:
- Issue #28147: Fixed split table dict may consume unlimited memory.
--
___
Python tracker
<http://bugs.python.org/issue28
INADA Naoki added the comment:
lgtm
--
nosy: +inada.naoki
___
Python tracker
<http://bugs.python.org/issue27275>
___
___
Python-bugs-list mailing list
Unsub
Changes by INADA Naoki :
Added file: http://bugs.python.org/file44874/dict_iter5.patch
___
Python tracker
<http://bugs.python.org/issue28183>
___
___
Python-bugs-list m
Changes by INADA Naoki :
--
keywords: +patch
Added file: http://bugs.python.org/file44875/lookdict_unicode_comment.patch
___
Python tracker
<http://bugs.python.org/issue24
INADA Naoki added the comment:
recreate patch with different option, since Rietveld doesn't accept
dict_iter5.patch
--
Added file: http://bugs.python.org/file44876/dict_iter6.patch
___
Python tracker
<http://bugs.python.org/is
Changes by INADA Naoki :
Added file: http://bugs.python.org/file44879/dict_iter7.patch
___
Python tracker
<http://bugs.python.org/issue28183>
___
___
Python-bugs-list m
INADA Naoki added the comment:
Could anyone review the patch?
I'm starting to #28199. But it must conflict with this patch.
--
assignee: -> inada.naoki
___
Python tracker
<http://bugs.python.org
INADA Naoki added the comment:
As written in comment, reusing keys object breaks odict implementation.
I think we can't avoid copy for Python 3.6.
--
keywords: +patch
Added file: http://bugs.python.org/file44888/dictresize.patch
___
Python tr
INADA Naoki added the comment:
$ ./install/bin/python3.6-default -m perf timeit -s 'x = range(1000); d={}'
'for i in x: d[i]=i; del d[i];'
Median +- std dev: 363 us +- 11 us
$ ./install/bin/python3.6 -m perf timeit -s 'x = range(1000); d={}'
INADA Naoki added the comment:
Refactoring includes replacing PyDict_Next with _PyDict_Next.
It can improve performance by skipping some checks.
But it would be too small to see difference from benchmark.
I'll reduce diff size, hopefully in this we
INADA Naoki added the comment:
Ah, I'm sorry.
I forget to remove some changes relating to inplace compaction (reusing oldkeys
when oldsize==newsize).
--
Added file: http://bugs.python.org/file44893/dictresize2.patch
___
Python tracker
Changes by INADA Naoki :
--
stage: -> patch review
type: -> performance
___
Python tracker
<http://bugs.python.org/issue28201>
___
___
Python-bugs-list
Changes by INADA Naoki :
--
assignee: -> inada.naoki
stage: needs patch -> patch review
___
Python tracker
<http://bugs.python.org/issue24274>
___
___
Pyth
New submission from INADA Naoki:
"CPython implementation detail:" label is removed when contents of impl-detail
directive is translated.
This is very bad for people reading translated documents.
Attached patch fixes this, with enabling translating the label, like
versionchanged
INADA Naoki added the comment:
dict_iter8.patch is based on dict_iter3.patch. Added some comments and fixing
indents.
No change about _PyDict_Next API.
--
Added file: http://bugs.python.org/file44921/dict_iter8.patch
___
Python tracker
<h
INADA Naoki added the comment:
I run attached test, and saw following errors.
On macOS 10.11 (XCode 8)
$ hg summary
parent: 104258:0d948a46c59a
test_invalid_sequences seems don't have to stay in CAPITest.
branch: 3.6
commit: 1 modified, 1 unknown
update: (current)
$ ./python.e
INADA Naoki added the comment:
Attached patch fixes first two errors.
Last one error is from test. I've commented it in review tool.
--
Added file: http://bugs.python.org/file44941/geometric_mean.patch
___
Python tracker
<http://bugs.py
INADA Naoki added the comment:
lgtm.
But I think adding note like following may be helpful to avoid users try
switching protocols which protocol author doesn't expect.
(I'm not good English writer. I hope someone polish my sentence).
.. note::
Generally speaking, switching
INADA Naoki added the comment:
I've fixed dict support of python-gdb.py.
But I found py-bt and py-bt-full are broken. They doesn't show builtin method.
I think it's because FASTCALL. But I'm not sure.
I just skip the test for py-bt in attached patch.
--
assig
INADA Naoki added the comment:
Fixed conflict with current 3.6 branch, and added NEWS entry.
--
Added file: http://bugs.python.org/file44966/dict-perturb-shift2.patch
___
Python tracker
<http://bugs.python.org/issue28
INADA Naoki added the comment:
default.css was changed?
https://docs.python.org/3.3/_static/default.css
https://docs.python.org/3.4/_static/default.css
--
nosy: +inada.naoki
___
Python tracker
<http://bugs.python.org/issue28
2801 - 2900 of 3039 matches
Mail list logo