Inada Naoki added the comment:
@Deric-W Please create another PR to change from `choise` to `choises` if you
want to optimize it.
--
___
Python tracker
<https://bugs.python.org/issue42
Inada Naoki added the comment:
> But `dict.popitem()` returns the last item in the insertion order. The item
> must be the last item of collision chain too.
This assumption was wrong. Inserting new item may overwrite dummy entry. In
this case, the last item in the middle of collision
New submission from Inada Naoki :
co_consts are merged already, but I forget about code attributes other than
co_consts.
Duplication ratio is vary by code style, but in case of logging, we can reduce
25% of them.
```
>>> data = open('Lib/logging/__pycache__/__init__.python
Change by Inada Naoki :
--
keywords: +patch
pull_requests: +21975
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/23056
___
Python tracker
<https://bugs.python.org/issu
Inada Naoki added the comment:
> Both changes add significant amount of code (100 and 85 lines
> correspondingly). Even if they speed up a particular case of dict constructor
> it is not common use case.
You are right, but please wait.
Marco is new contributor and he can write
Inada Naoki added the comment:
@Serhiy
> Do you mean sharing values of co_code and co_lnotab between code objects of
> the same module?
Yes.
> How much memory does this save (in absolute and relative value)?
Maybe 1~3%, but I am not sure. I am more interested in reducing
Inada Naoki added the comment:
> It should *not* be affected by the change. Anyway, I run the bench other 10
> times, and the lowest value with the CPython code without the PR is not lower
> than 67.7 ns. With the PR, it reaches 53.5 ns. And I do not understand why.
The benchmar
Change by Inada Naoki :
--
pull_requests: +21987
pull_request: https://github.com/python/cpython/pull/23068
___
Python tracker
<https://bugs.python.org/issue42
Change by Inada Naoki :
--
pull_requests: +22023
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/23106
___
Python tracker
<https://bugs.python.org/issu
Inada Naoki added the comment:
> I did PGO+LTO... --enable-optimizations --with-lto
I'm sorry about that. PGO+LTO *reduce* noises, but there are still noises. And
unpack_sequence is very fragile.
I tried your branch again, and unpack_sequence is 10% *slower* than master
branc
Inada Naoki added the comment:
OK. Microbenchmark don't justify adding complexity to the eval loop and the
compiler.
--
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https:
Inada Naoki added the comment:
Short result (minspeed=2):
Slower (4):
- unpack_sequence: 65.2 ns +- 1.3 ns -> 69.2 ns +- 0.4 ns: 1.06x slower (+6%)
- unpickle_list: 5.21 us +- 0.04 us -> 5.44 us +- 0.02 us: 1.04x slower (+4%)
- chameleon: 9.80 ms +- 0.08 ms -> 10.0 ms +- 0.1 ms: 1.0
Inada Naoki added the comment:
And bench_kwcall.py is a microbenchmark for _PyEval_EvalCode.
$ cpython/release/python -m pyperf compare_to master.json kwcall-nodup.json
kwcall-3: Mean +- std dev: [master] 192 us +- 2 us -> [kwcall-nodup] 175 us +-
1 us: 1.09x faster (-9%)
kwcall-6: M
Inada Naoki added the comment:
While this is an interesting optimization, the gain is not enough.
I close this issue for now.
@Marco Sulla
Optimizing dict is a bit hard job. If you want to continue, I have an idea:
`dict(zip(keys, row))` is common use case. It is used by asdict() in datacalss
Inada Naoki added the comment:
I don't think UTF-8 mode should override os.device_encoding() on Windows.
UTF-8 mode can be used to ignore legacy locale encoding, and
os.device_encoding() uses the locale encoding on Unix. So overriding it make
sense.
But locale encoding and console c
Change by Inada Naoki :
--
resolution: -> duplicate
superseder: -> image/webp support in mimetypes
___
Python tracker
<https://bugs.python.org/i
Change by Inada Naoki :
--
resolution: -> duplicate
superseder: -> image/webp support in mimetypes
___
Python tracker
<https://bugs.python.org/i
Inada Naoki added the comment:
I'm +1 to add it in common types, because webp is really de-facto standard.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
If no objection, I will merge this in next week.
--
nosy: +methane
versions: +Python 3.10 -Pytho
Change by Inada Naoki :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue42205>
___
___
Pyth
Change by Inada Naoki :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue42049>
___
___
Pyth
Inada Naoki added the comment:
Please note that tutorial is a tutorial. It is document to help new user who
are learning Python.
Do you believe special attributes like __cause__ and __contexts__ are really
worth to teach for tutorial readers?
Generally speaking, I think we should *reduce
Inada Naoki added the comment:
> 1. Such understanding of a tutorial is debatable. Tutorial is just a material
> for learning written with some system in mind, which is more interesting to
> read than dry reference material. A tutorial, generally dpeaking, may be both
> for begin
Change by Inada Naoki :
--
nosy: +methane
nosy_count: 4.0 -> 5.0
pull_requests: +22073
pull_request: https://github.com/python/cpython/pull/23162
___
Python tracker
<https://bugs.python.org/issu
Change by Inada Naoki :
--
pull_requests: +22074
pull_request: https://github.com/python/cpython/pull/23162
___
Python tracker
<https://bugs.python.org/issue42
Inada Naoki added the comment:
New changeset bde33e428d5b5f88ec7667598fd27d1091840537 by Inada Naoki in branch
'master':
bpo-42179: Doc/tutorial: Remove mention of __cause__ (GH-23162)
https://github.com/python/cpython/commit/bde33e428d5b5f88ec7667598fd27d
Change by Inada Naoki :
--
resolution: -> out of date
stage: needs patch -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
>> 1. Such understanding of a tutorial is debatable. Tutorial is just a
>> material for learning written with some system in mind, which is more
>> interesting to read than dry reference material. A tutorial, generally
>> dpeaking, may b
Change by Inada Naoki :
--
resolution: -> rejected
___
Python tracker
<https://bugs.python.org/issue42141>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Inada Naoki :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue24886>
___
___
Inada Naoki added the comment:
> Yes, but the code for creating a dict can be simpler. In any case we will
> better see what format is better when try to write a code.
Note that many annotations are not accessed. RAM usage of annotation
information is important than how easy to creat
Inada Naoki added the comment:
I don't like co_annotations.
* It changes PyCode_NewXXX() API.
* Many functions don't have annotations. Adding annotation to code object makes
code object fatter even if the function doesn't have annotation.
* Code object is immutable &am
Change by Inada Naoki :
--
nosy: +lukasz.langa
___
Python tracker
<https://bugs.python.org/issue42202>
___
___
Python-bugs-list mailing list
Unsubscribe:
Inada Naoki added the comment:
> (1) add a .dedent() method to str (and bytes?) - behaviors to consider
> mirroring are textwrap.dedent() and inspect.cleandoc(). Given their utility
> and similarities, it makes sense to offer both behaviors; behavior could be
> selected by a
Inada Naoki added the comment:
> I don't think we need two algorithms here. I'm +1 to add str.dedent() which
> mirroring only inspect.cleandoc().
I withdraw this. If we add str.dedent(), it must not be optimized for
triple-quote literal.
Auto dedenting is very nice to
Inada Naoki added the comment:
New changeset 7301979b23406220510dd2c7934a21b41b647119 by Yurii Karabas in
branch 'master':
bpo-42202: Store func annotations as a tuple (GH-23316)
https://github.com/python/cpython/commit/7301979b23406220510dd2c7934a21
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
Thank you for reporting. I removed these APIs to get such feedback as early as
possible.
We are free to revive these APIs if it breaks too much and some projects can
not be fixed before Python 3.10 release.
Some project maintainers ignore deprecations and
Inada Naoki added the comment:
New changeset c8aaf71dde464c0c351e2f935f87652c3d54 by Volker-Weissmann in
branch 'master':
bpo-17852: Doc: Fix the tutorial about closing files (GH-23135)
https://github.com/python/cpython/commit/c8aaf71dde464c0c351e2f935f87652c3d54
-
Inada Naoki added the comment:
At first glance, you used ctypes.cdll, which releases GIL. But you called
Python/C API in extension module. You shouldn't do it.
Try ctypes.pydll, which don't release GIL.
If it doesn't help you, please continue it in another communities.
I don
Inada Naoki added the comment:
I concur with Serhiy. Current document and example describe clearly
that this API is for checking inclusion, not equality.
Current example:
"""
>>> mock = Mock(return_value=None)
>>> mock(1)
>>> mock(2)
>>&g
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
> I opened the bug because we have evidence that users find the current
> documentation confusing. Saying that its not confusing to us doesn't fix the
> confusion.
Is there evidence people get confused by the document?
I suppose people get co
New submission from Inada Naoki :
New changeset 51aa35e9e17eef60d04add9619fe2a7eb938358c by Inada Naoki (David
Carlier) in branch 'master':
bpo-33164: update blake2 implementation (GH-6286)
https://github.com/python/cpython/commit/51aa35e9e17eef60d04add9619fe2a7eb938358c
-
Change by Inada Naoki :
--
pull_requests: -7043
___
Python tracker
<https://bugs.python.org/issue33164>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
I want to wait this until PEP 590 is implemented.
Unlike CALL_METHOD, we can not avoid prepending self.
New method signature may be like this:
PyObject_VectorCallMethod(PyObject *name, PyObject **args, Py_ssize_t nargs,
PyObject *kwds);
And args[0] is self
New submission from Inada Naoki :
Reported here:
*
https://stackoverflow.com/questions/56228799/python-hangs-indefinitely-trying-to-delete-deeply-recursive-object
* https://mail.python.org/pipermail/python-dev/2019-May/157635.html
--
components: Interpreter Core
messages: 343344
nosy
Change by Inada Naoki :
--
title: PyObject_Free is O(N^2) where N = # of arenas -> PyObject_Free is O(N)
where N = # of arenas
___
Python tracker
<https://bugs.python.org/issu
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
New changeset ea2b76bdc5f97f49701213d105b8ec2387ea2fa5 by Inada Naoki in branch
'3.7':
bpo-27987: align PyGC_Head to alignof(long double) (GH-13335)
https://github.com/python/cpython/commit/ea2b76bdc5f97f49701213d105b8ec
Change by Inada Naoki :
--
pull_requests: +13488
pull_request: https://github.com/python/cpython/pull/13581
___
Python tracker
<https://bugs.python.org/issue27
Inada Naoki added the comment:
New changeset 47dd2f9fd86c32a79e77fef1fbb1ce25dc929de6 by Inada Naoki (Michael
J. Sullivan) in branch 'master':
bpo-37017: PyObject_CallMethodObjArgs uses LOAD_METHOD optimization (GH-13516)
https://github.com/python/cpyt
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
> I was wondering why it was decided against backporting to 3.7?
Because I treats this is just a code cleanup.
> 6fa84bd12c4b83bee6a41b989363230d5c03b96c fixes an actual bug #35990 (string
> mask in tuple argument for IPv4Interfaces).
I didn't
Change by Inada Naoki :
--
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue36891>
___
___
Inada Naoki added the comment:
I closed this because this proposal is not discussed well in conda community.
See https://github.com/python/cpython/pull/13246#issuecomment-492447317
--
___
Python tracker
<https://bugs.python.org/issue36
Inada Naoki added the comment:
I don't like this.
It removes guarantee that code object is constant / immutable.
> Because the code objects are on random pages and are ref counted the ref
> counts can cause all of the code to not be shared across processes.
These ref cou
Inada Naoki added the comment:
Current default value is decided in here:
https://bugs.python.org/review/21527/#ps11902
It seems there were no strong reason for current cpu_count * 5.
I think cpu_count + 4 is better default value, because:
* When people are using threadpool for CPU heavy job
Inada Naoki added the comment:
> If you want to limit to 16-20 that may be ok but `cpu_count + 4` doesn't work
> in this case. On cloud servers, I see 128 or even more cores very often.
> 160+4 is not that you want to propose, sure.
I proposed cpu_count + 4 because #24882 al
Change by Inada Naoki :
--
keywords: +patch
pull_requests: +13520
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/13618
___
Python tracker
<https://bugs.python.org/issu
Inada Naoki added the comment:
New changeset 9a7e5b1b42abcedb895b1ce49d83fe067d01835c by Inada Naoki in branch
'master':
bpo-35279: reduce default max_workers of ThreadPoolExecutor (GH-13618)
https://github.com/python/cpython/commit/9a7e5b1b42abcedb895b1ce49d83fe
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
read-only is slightly different than const / immutable.
const / immutable means anyone can not modify the memory.
read-only means only the memory should not be modified through
the buffer. But underlaying memory block can be modified by
owner who creates
Inada Naoki added the comment:
> Could someone create a buffer object which still allows the underlying memory
> to be written? Sure. But I can use ctypes to modify byte code today as well
> with something like "ctypes.cast(id(f.__code__.co_code) + 32,
> ctypes.POINTER(c
Inada Naoki added the comment:
New changeset d8b755167235e0621814eb5ac39163b3db6879bb by Inada Naoki (David
Carlier) in branch 'master':
bpo-33164: blake2 fix for HP-UX (GH-13633)
https://github.com/python/cpython/commit/d8b755167235e0621814eb5ac39163
Inada Naoki added the comment:
Can we dedent docstring too?
Is there any string like inspect.cleandoc(s) != inspect.cleandoc(s.dedent())?
--
nosy: +inada.naoki
___
Python tracker
<https://bugs.python.org/issue36
Inada Naoki added the comment:
> In the Instagram case there's about 20mb of byte code total and there are 3-4
> dozen worker processes running per server. The byte code also represents the
> second largest section of memory as far as serialized code objects are
> co
Inada Naoki added the comment:
master:
build time 0:48:53.664428
teardown time 4:58:20.132930
patched:
build time 0:48:08.485639
teardown time 0:01:10.466707
About 250x speedup!
--
Added file: https://bugs.python.org/file48382/result.txt
Inada Naoki added the comment:
On Sat, Jun 1, 2019 at 2:47 AM Brett Cannon wrote:
>
> Brett Cannon added the comment:
>
> RE: "I think it needs significant benefits for typical users, not only for
> Instagram. If only Instagram get benefit from this, keep it as Instagram
Inada Naoki added the comment:
> And I understood that Dino proposed to share one code instance as a memory
> mapped file for *all* processes.
What instance means? code object? co_code?
Anyway, Dino didn't propose such thing. He only proposed accepting buffer
object for code
Inada Naoki added the comment:
New changeset 91234a16367b56ca03ee289f7c03a34d4cfec4c8 by Inada Naoki in branch
'master':
bpo-26219: per opcode cache for LOAD_GLOBAL (GH-12884)
https://github.com/python/cpython/commit/91234a16367b56ca03ee289f7c03a3
Inada Naoki added the comment:
I committed cache only for LOAD_GLOBAL, which is much simpler than
LOAD_ATTR or LOAD_METHOD.
Caches for other instructions will be implemented 3.9 or later.
--
___
Python tracker
<https://bugs.python.org/issue26
Change by Inada Naoki :
--
pull_requests: +13661
pull_request: https://github.com/python/cpython/pull/12884
___
Python tracker
<https://bugs.python.org/issue33
Change by Inada Naoki :
--
pull_requests: +13662
pull_request: https://github.com/python/cpython/pull/13775
___
Python tracker
<https://bugs.python.org/issue26
Inada Naoki added the comment:
New changeset 395420e2a35937fa9777fc3c8b0086629db95e27 by Inada Naoki in branch
'master':
bpo-26219: remove unused code (GH-13775)
https://github.com/python/cpython/commit/395420e2a35937fa9777fc3c8b0086
Change by Inada Naoki :
--
pull_requests: +13663
pull_request: https://github.com/python/cpython/pull/13775
___
Python tracker
<https://bugs.python.org/issue33
Change by Inada Naoki :
--
keywords: +patch
pull_requests: +13671
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/13787
___
Python tracker
<https://bugs.python.org/issu
Change by Inada Naoki :
--
pull_requests: +13676
pull_request: https://github.com/python/cpython/pull/13787
___
Python tracker
<https://bugs.python.org/issue33
Inada Naoki added the comment:
On Tue, Jun 4, 2019 at 8:45 AM Dino Viehland wrote:
>
> The 20MB of savings is actually the amount of byte code that exists in the IG
> code base.
Wait, do you expect you can reduce 100% saving of co_code object?
co_code takes 0byte?
You said "t
Inada Naoki added the comment:
> Stefan Krah added the comment:
>
> 720MB <= "3-4 dozen" * 20 MB <= 960MB. Per server.
>
> It has all been said. :-)
I don't understand what message you are replying.
I'm not interested in the number. Who asked MBs /
Inada Naoki added the comment:
I'm sorry, I thought "fantasy" was good metaphor.
I just meant "the estimation seems too optimistic and rough. discussion should
not based on it".
--
___
Python tracker
<https:
Change by Inada Naoki :
--
pull_requests: +13731
pull_request: https://github.com/python/cpython/pull/13856
___
Python tracker
<https://bugs.python.org/issue35
Inada Naoki added the comment:
New changeset cb65202520e7959196a2df8215692de155bf0cc8 by Inada Naoki in branch
'master':
bpo-35551: remove mac_centeuro encoding (GH-13856)
https://github.com/python/cpython/commit/cb65202520e7959196a2df8215692d
Inada Naoki added the comment:
How about do `inspect.cleandoc()` instead of just a dedent?
Some method has docstring like this:
"""First line
blah blah blah blah
example code here
...
"""
In such docstring, dedent can not strip i
Change by Inada Naoki :
--
pull_requests: +13803
pull_request: https://github.com/python/cpython/pull/13935
___
Python tracker
<https://bugs.python.org/issue37
Inada Naoki added the comment:
Hmm,, about encoding, I agree that default encoding of open() should be used.
If we change it, encoding of log files are changed unexpectedly after upgrading
Python.
On the other hand, couldn't we use different default error handler?
"r
Inada Naoki added the comment:
> I've left it as is using the same rationale as I guess open() has at the
> moment - "Errors should never pass silently. Unless explicitly silenced".
But open() is general purpose, and logging is for logging.
Note that stderr uses
Inada Naoki added the comment:
> What logging does when UnicodeEncodeError is happened?
Hm, it seems logging does best job, show enough information to stderr.
But sometime, Python is embedded in web servers and there is no stderr.
pythonw.exe may not have stderr too
I still f
Inada Naoki added the comment:
New changeset b4b814b3988abf69f07f8492d82e855c51b2a75d by Inada Naoki (Jeroen
Demeyer) in branch 'master':
bpo-37231: optimize calls of special methods (GH-13973)
https://github.com/python/cpython/commit/b4b814b3988abf69f07f8492d82e85
New submission from Inada Naoki :
When stdout is redirected to file and cp65001 is used, stdout encoding is
unexpectable:
# Power Shell 6 (use cp65001 by default)
PS C:¥> python3 -c "print('おはよう')" > ps.txt
# cmd.exe
C:¥> chcp 65001
C:¥> python3 -
Inada Naoki added the comment:
New changeset b2f94730d947f25b8507c5f76202e917683e76f7 by Inada Naoki (Jeroen
Demeyer) in branch 'master':
bpo-37249: add declaration of _PyObject_GetMethod (GH-14015)
https://github.com/python/cpython/commit/b2f94730d947f25b8507c5f76202e9
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
On Sat, Jun 15, 2019 at 2:43 AM Eryk Sun wrote:
>
> Eryk Sun added the comment:
>
> > # Power Shell 6 (use cp65001 by default)
> > PS C:¥> python3 -c "print('おはよう')" > ps.txt
>
> PowerShell standard I/O redi
Change by Inada Naoki :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue37275>
___
___
Change by Inada Naoki :
--
resolution: wont fix ->
stage: resolved ->
status: closed -> open
versions: +Python 3.9 -Python 3.7, Python 3.8
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
New changeset 5600b5e1b24a3491e83f1b3038a7ea047a34c0bf by Inada Naoki (Jeroen
Demeyer) in branch 'master':
bpo-28805: document METH_FASTCALL (GH-14079)
https://github.com/python/cpython/commit/5600b5e1b24a3491e83f1b3038a7ea047a34c0bf
-
Inada Naoki added the comment:
New changeset 0456df4a55ec9a4e8f4425df92bbe63a290f3f2f by Inada Naoki (Jeroen
Demeyer) in branch 'master':
bpo-37231: remove _PyObject_FastCall_Prepend (GH-14153)
https://github.com/python/cpython/commit/0456df4a55ec9a4e8f4425df92bbe6
Inada Naoki added the comment:
New changeset 2e9954d3472a23919b96323fcd5bb6c1d6927155 by Inada Naoki (Jeroen
Demeyer) in branch 'master':
bpo-36922: use Py_TPFLAGS_METHOD_DESCRIPTOR in lookup_maybe_method() (GH-13865)
https://github.com/python/cpyt
New submission from Inada Naoki :
HTMLParser.unescape was removed once but resurrected because of distlib
depended on it. (see https://bugs.python.org/issue19688 )
Since it is deprecated from 3.4, it's safe to remove.
--
components: Library (Lib)
messages: 345954
nosy: inada.
Change by Inada Naoki :
--
keywords: +patch
pull_requests: +14023
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/14186
___
Python tracker
<https://bugs.python.org/issu
901 - 1000 of 3039 matches
Mail list logo