New submission from Inada Naoki :
PyDict_DelItem stores DUMMY entry in the hash table. Without DUMMY, collision
chain will be broken so proving will be not working.
But `dict.popitem()` returns the last item in the insertion order. The item
must be the last item of collision chain too.
So
Inada Naoki added the comment:
> Are annotations now always known at compile time?
Yes, because `from __future__ import annotations` is enabled by default from
Python 3.10.
> As for representation, it can also be a sequence of pairs (('x', 'int'),
> ('z', 'float'), ('retur
New submission from Inada Naoki :
Look this example:
code:
```
# code
def foo(x: int, /, y, *, z: float) -> Hoge:
pass
# dis
2 12 LOAD_CONST 2 ('int')
14 LOAD_CONST 3 ('float')
16 LOAD_CONST 4 ('H
Inada Naoki added the comment:
Thanks
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.6, Python 3.7, Python 3.8, Python 3.9
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
>> Fast shutdown option
>
> You can use os._exit(0).
Yes. Instagram use it as `atexit.register(os._exit, 0)`.
https://instagram-engineering.com/dismissing-python-garbage-collection-at-instagram-4dca40b29172
I think this hack can be supported in mul
Inada Naoki added the comment:
New changeset 8e409cebad42032bb7d0f2cadd8b1e36081d98af by Eric W in branch
'master':
bpo-42160: tempfile: Reduce overhead of pid check. (GH-22997)
https://github.com/python/cpython/commit/8e409cebad42032bb7d0f2cadd8b1e36081d98af
--
nosy: +methane
Change by Inada Naoki :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue42176>
___
___
Change by Inada Naoki :
--
versions: +Python 3.10 -Python 3.9
___
Python tracker
<https://bugs.python.org/issue40255>
___
___
Python-bugs-list mailing list
Unsub
Inada Naoki added the comment:
I'm big -1 too. But I am interested in Instagram usage.
* How % of heap are CoW-ed with gc.freeze()?
* When CoW happen? in execution time, or shutdown?
* Which type cause CoW?
I have two ideas to reduce CoW:
* Fast shutdown option
Currently Python try
Inada Naoki added the comment:
I concur with Benjamin.
Although two variables are similar, they are used in the different layer.
--
nosy: +methane
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tracke
Inada Naoki added the comment:
New changeset a053a7ecfef006b834a9957468fa461dafb332db by Miss Skeleton (bot)
in branch '3.8':
bpo-41662: Fix bugs in binding parameters in sqlite3 (GH-21998)
https://github.com/python/cpython/commit/a053a7ecfef006b834a9957468fa461dafb332db
--
nosy
Inada Naoki added the comment:
New changeset f6255a2ccb55a63194caf698f471c803c08be359 by Zackery Spytz in
branch '3.8':
bpo-39871: Fix an error in a news entry (GH-21749)
https://github.com/python/cpython/commit/f6255a2ccb55a63194caf698f471c803c08be359
Inada Naoki added the comment:
Python 2.7 became EOL.
--
nosy: +methane
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Inada Naoki :
--
keywords: +newcomer friendly
versions: +Python 3.10 -Python 2.7, Python 3.6, Python 3.7
___
Python tracker
<https://bugs.python.org/issue32
Inada Naoki added the comment:
Oh, I didn't know that. Thank you.
I thought Chinese and Korean use surname-given name order because of "Xí
Jìnpíng", "Moon Jae-in", and "Kim Jong-un". Japanese previous P.M. used "Shinzo
Abe" English notation,
Inada Naoki added the comment:
> On the other hand, GH-22479 is affect to all index API() whether the number
> is large or small.
Then, no need to revert GH-22479 for consistency. Thanks.
> p.s by the way, Naoki is the last name or first name? ;)
It is difficult to say what is f
Inada Naoki added the comment:
I had not noticed that there are rangeobject and longrangeobject. It doesn't
affect to range(1) definitely.
--
___
Python tracker
<https://bugs.python.org/issue42
Inada Naoki added the comment:
I agree that 1<<1000 is artificial example. But isn't this patch affects more
regular patterns like [[] for _ in range(1)]?
If we reject this, shouldn't we revert GH-22479 too?
I believe iterating range object is much more common use case than range
Inada Naoki added the comment:
I run pyperformance=1.0.0 for your speedup_dictinit branch (7df3b9c) and master
branch, with PGO+LTO build.
```
$ ./python -m pyperf compare_to master-opt.json dictinit.json -G --min-speed=1
Slower (22):
- unpack_sequence: 62.7 ns +- 0.7 ns -> 70.3 ns +- 0.5
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: -Python 3.7
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
> 1. dicts from other dicts that are not "perfect" (combined and without holes)
> 3. copies of dicts with many holes
Note that I have optimized and rejected it by myself already.
See https://github.com/python/cpython/pull/21669
and https:/
Inada Naoki added the comment:
I confirmed _PyDict_FromItems() can be used to optimize _PyStack_AsDict() too.
See https://github.com/methane/cpython/pull/25
But I can not confirm significant performance gain from it too.
--
___
Python tracker
Inada Naoki added the comment:
@Marco Sulla
> @methane: well, to be honest, I don't see much difference between the two
> pulls. The major difference is that you merged insertdict_init in
> dict_merge_init.
Not only it but also some simplification which make 10% faster than
Inada Naoki added the comment:
@Mark.Shannon I had seen some speedup on tornado benchmark when I didn't use
PGO+LTO. but it was noise.
Now I use PGO+LTO. master vs PR-22909:
$ ./python -m pyperf compare_to master-opt.json speedup_kw-opt.json -G
--min-speed=1
Slower (11):
- spectral_norm
Inada Naoki added the comment:
I close this issue for now. Please reopen or create a new issue if you came up
with better idea.
--
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -P
Inada Naoki added the comment:
@Marco Sulla Please take a look at GH-22909. It is simplified version of your
PR. And I wrote another optimization based on it #42126.
--
___
Python tracker
<https://bugs.python.org/issue41
Inada Naoki added the comment:
It is difficult to estimate. Real world applications has different code-style
than stdlib. And pyperformance didn't include whole real world applications too.
Some application may use dict display in heavy loop. But it is difficult to say
how much exactly.
One
Inada Naoki added the comment:
$ ./python -m pyperf timeit --compare-to ~/pyenv/versions/3.10-dev/bin/python
'{}'
/home/inada-n/pyenv/versions/3.10-dev/bin/python: . 23.5 ns
+- 0.2 ns
/home/inada-n/work/python/cpython/python: . 22.4 ns +- 0.1
ns
Mean
Change by Inada Naoki :
--
keywords: +patch
pull_requests: +21842
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/22911
___
Python tracker
<https://bugs.python.org/issu
New submission from Inada Naoki :
BUILD_CONST_KEY_MAP can be optimized based on #41835 optimization.
1. compiler checks keys tuple is distinct.
2. Add distinct flag to BUILD_CONST_KEY_MAP oparg
To be considered:
* Should we use new opcode, instead of flag in oparg?
* Is this technique safe
Inada Naoki added the comment:
Ok. Performance improvement comes from:
a. Presizing
b. Bypassing some checks in PyDict_SetItem
c. Avoiding duplication check.
(b) is relatively small so I tried to focus on (a) and (b). See GH-22909.
In case of simple keyword arguments, it is 10% faster than
Change by Inada Naoki :
--
keywords: +patch
pull_requests: +21840
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/22909
___
Python tracker
<https://bugs.python.org/issu
Inada Naoki added the comment:
I had suspected that pypeformance just don't have enough workload for non-small
int.
For example, spectral_norm is integer heavy + some float warkload. But
bm_spectral_norm uses `DEFAULT_N = 130`. So most integers are fit into smallint
cache.
On the othar
Inada Naoki added the comment:
I heard pyperformance 1.0.0 works and here is the result of PR-22884.
$ ./python-master -m pyperf compare_to master.json patched.json -G --min-speed=1
Slower (8):
- pathlib: 26.3 ms +- 0.3 ms -> 26.8 ms +- 0.4 ms: 1.02x slower (+2%)
- chameleon: 12.8 ms +-
Inada Naoki added the comment:
I updated the patch.
I can not run pyperformance for now, because:
AssertionError: would build wheel with unsupported tag ('cp310', 'cp310',
'linux_x86_64'
I added this config, but it can not solve the problem:
```
$ cat ~/.config/pip/pip.conf
[global
Change by Inada Naoki :
--
pull_requests: +21823
pull_request: https://github.com/python/cpython/pull/22884
___
Python tracker
<https://bugs.python.org/issue24
Inada Naoki added the comment:
One more idea: BINARY_ADD_INT. Operand is int immediate.
This idea can be implemented without opcode cache. I will try it.
--
___
Python tracker
<https://bugs.python.org/issue42
Inada Naoki added the comment:
FWIW, php7 is about 5x faster than Python on spectral norm benchmark.
https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/php-python3.html
There two major reasons:
* PHP uses scalar type for float and int
* PHP uses type-specialized bytecode
Inada Naoki added the comment:
Thank you for reporting with reproducer.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Inada Naoki :
--
resolution: -> not a bug
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
New changeset 8f6787d93db1b6022db44b1e1d22460c2b74f60b by Inada Naoki in branch
'3.9':
bpo-42057: Add a test case (GH-22878)
https://github.com/python/cpython/commit/8f6787d93db1b6022db44b1e1d22460c2b74f60b
Change by Inada Naoki :
--
pull_requests: +21820
pull_request: https://github.com/python/cpython/pull/22878
___
Python tracker
<https://bugs.python.org/issue42
Inada Naoki added the comment:
New changeset 07a44d9572c7746568a7fe2fbcd42127fd6d4019 by Inada Naoki in branch
'3.9':
bpo-42057: Fix peephole optimizer (GH-22802)
https://github.com/python/cpython/commit/07a44d9572c7746568a7fe2fbcd42127fd6d4019
Inada Naoki added the comment:
Can we add search box using DuckDuckGo?
https://duckduckgo.com/?q=site%3Adocs.python.org%2F3%2F+list+append
--
nosy: +methane
___
Python tracker
<https://bugs.python.org/issue42
Inada Naoki added the comment:
New changeset c756c2b507b088919ac0c1aa8b0d8c8bdbdd75ee by Miss Skeleton (bot)
in branch '3.8':
bpo-41819: Fix compiler warning in init_dump_ascii_wstr() (GH-22332)
https://github.com/python/cpython/commit/c756c2b507b088919ac0c1aa8b0d8c8bdbdd75ee
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8
___
Python tracker
<https://bugs.python.or
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: -Python 3.5, Python 3.6, Python 3.7
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
New changeset 19019eccdeeb8dea027bd7766ca9fe2892972da4 by Miss Skeleton (bot)
in branch '3.9':
bpo-41646: Mention path-like objects support in the docs for shutil.copy()
(GH-22208)
https://github.com/python/cpython/commit
Inada Naoki added the comment:
New changeset 6443a8ccc886749f5e83a8ca073006742b605d90 by Miss Skeleton (bot)
in branch '3.8':
bpo-41646: Mention path-like objects support in the docs for shutil.copy()
(GH-22208)
https://github.com/python/cpython/commit
Inada Naoki added the comment:
New changeset d0bfce992c4ce0e6e71f13a993c91903a97a62f3 by Miss Skeleton (bot)
in branch '3.9':
bpo-41744: Package python.props with correct name in NuGet package (GH-22154)
https://github.com/python/cpython/commit/d0bfce992c4ce0e6e71f13a993c91903a97a62f3
Change by Inada Naoki :
--
versions: +Python 3.10 -Python 3.7
___
Python tracker
<https://bugs.python.org/issue30680>
___
___
Python-bugs-list mailing list
Unsub
Inada Naoki added the comment:
> Agreed. It makes great sense that textwrap started as highly ASCII-centric.
> But in the Python 3, Unicode-friendly era, ASCII-biased isn't where we should
> leave things.
It needs Unicode experts. If we support Unicode, we should implemente UAX
Inada Naoki added the comment:
+1
--
versions: +Python 3.10 -Python 3.9
___
Python tracker
<https://bugs.python.org/issue38980>
___
___
Python-bugs-list mailin
Inada Naoki added the comment:
Thank you
--
nosy: +methane
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
New changeset 25492a5b59c5b74328278f195540e318ab87674f by Dong-hee Na in branch
'master':
bpo-41902: Micro optimization for compute_item of range (GH-22492)
https://github.com/python/cpython/commit/25492a5b59c5b74328278f195540e318ab87674f
--
nosy
Change by Inada Naoki :
--
pull_requests: +21759
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/22802
___
Python tracker
<https://bugs.python.org/issu
Change by Inada Naoki :
--
title: pytest case which catch exceptions become segfault -> peephole
optimizer bug relating to JUMP_IF_NOT_EXC_MATCH
___
Python tracker
<https://bugs.python.org/issu
Inada Naoki added the comment:
I confirmed fix42057.patch fix the assertion failure. But I don't know where
and how to write test yet.
--
keywords: +patch
Added file: https://bugs.python.org/file49527/fix42057.patch
___
Python tracker
<ht
Inada Naoki added the comment:
I confirmed the issue. The simple version of the reproducer is:
```
def callee():
raise Exception
def caller():
try:
callee()
except Exception or Exception:
pass
caller()
```
I can see assertion failure consisntently, when I use
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
> In my implementation, there is guards that do early return in those cases and
> there are tests that check that indeed we don't crash of that happens when
> calling the exposed functions
The guard doesn't help much. _PyObject_GC_UNTRACK() is called
Inada Naoki added the comment:
and this:
https://github.com/python/cpython/blob/b67cbbda3a022cec5e2ad929f0531162166e7c8d/Include/internal/pycore_object.h#L111-L113
--
___
Python tracker
<https://bugs.python.org/issue42
Inada Naoki added the comment:
I meant this:
https://github.com/python/cpython/blob/b67cbbda3a022cec5e2ad929f0531162166e7c8d/Include/internal/pycore_object.h#L75-L78
--
___
Python tracker
<https://bugs.python.org/issue42
Change by Inada Naoki :
--
nosy: +Michael.Felt
___
Python tracker
<https://bugs.python.org/issue42030>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Inada Naoki :
--
nosy: +David.Edelsohn
___
Python tracker
<https://bugs.python.org/issue42030>
___
___
Python-bugs-list mailing list
Unsubscribe:
Inada Naoki added the comment:
There are many code that an object is tracked/untracked. This API can cause
fatal error too easily.
I think this API should be exposed only in _testcapi.
--
nosy: +methane
___
Python tracker
<https://bugs.python.
Inada Naoki added the comment:
Thank you for finding/fixing.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Inada Naoki added the comment:
New changeset 2d2af320d94afc6561e8f8adf174c9d3fd9065bc by Kevin Adler in branch
'master':
bpo-41894: Fix UnicodeDecodeError while loading native module (GH-22466)
https://github.com/python/cpython/commit/2d2af320d94afc6561e8f8adf174c9d3fd9065bc
Inada Naoki added the comment:
Yes, please.
--
___
Python tracker
<https://bugs.python.org/issue41894>
___
___
Python-bugs-list mailing list
Unsubscribe:
Inada Naoki added the comment:
OK. Let's use PyUnicode_DecodeLocale() with surrogateescape for consistency.
--
___
Python tracker
<https://bugs.python.org/issue41
Inada Naoki added the comment:
> So the main problem is: should we allow surrogateescape in error message?
Note that error message may be written to file, stream, structured log (JSON).
They may be UTF-8:strict. We can not write surrogateescape-d string to t
Inada Naoki added the comment:
> I think that it is more correct to use the locale encoding. If error messages
> are translated for readability, we should not ruin this by outputting \xXX.
* PyUnicode_DecodeLocale() doesn't support "backslashescape" error handler.
* Error me
Inada Naoki added the comment:
New changeset 35f041dd0171f575fc3adce1709b31fdf45a5ff6 by Phil Elson in branch
'master':
bpo-41376: Fix the documentation of `site.getusersitepackages()` (GH-21602)
https://github.com/python/cpython/commit/35f041dd0171f575fc3adce1709b31fdf45a5ff6
Inada Naoki added the comment:
> I have since changed the PR to use PyUnicode_DecodeFSDefault based on review
> feedback. I was going to say that you will have to fight it out with @methane
> on GH, but I see that that's you. :D Would have been nice if you would have
> left
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Inada Naoki :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue35291>
___
___
Inada Naoki added the comment:
I succeeded to reproduce it on Ubuntu 20.04.
$ sudo vi /var/lib/locales/supported.d/ja # add "ja_JP.EUC-JP EUC-JP"
$ sudo locale-gen ja_JP.EUC-JP
Generating locales (this might take a while)...
ja_JP.EUC-JP... done
Generatio
Change by Inada Naoki :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue33235>
___
___
Inada Naoki added the comment:
I have a Linux desktop machine for benchmarking & profiling in my office. But
the machine is offline and I am working from home several weeks.
So please wait several weeks until I confirm your branch.
> This change speeds up the code up to a 30%.
Inada Naoki added the comment:
PyUnicode_AsUTF8 is useful "API". But it can be implemented as C macro, C
inline function, or functions/macros in any other languages using
PyUnicode_AsUTF8AndSize.
PyUnicode_AsUTF8AndSize is more importan
Change by Inada Naoki :
--
versions: +Python 3.10
___
Python tracker
<https://bugs.python.org/issue41784>
___
___
Python-bugs-list mailing list
Unsubscribe:
Inada Naoki added the comment:
+1. It is a very important API.
--
___
Python tracker
<https://bugs.python.org/issue41784>
___
___
Python-bugs-list mailin
Inada Naoki added the comment:
Since we have positional-only argument, can we document it as `seek(offset,
whence=SEEK_SET, /)`?
--
___
Python tracker
<https://bugs.python.org/issue41
Inada Naoki added the comment:
For the record, https://github.com/python/cpython/pull/14691/files reintroduced
`whence=SEEK_SET`.
--
nosy: +inada.naoki
___
Python tracker
<https://bugs.python.org/issue41
Inada Naoki added the comment:
+1
--
___
Python tracker
<https://bugs.python.org/issue41692>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Inada Naoki :
--
nosy: +inada.naoki
___
Python tracker
<https://bugs.python.org/issue39102>
___
___
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
New submission from Inada Naoki :
https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files
Current tutorial doesn't mention about encoding and example uses locale
encoding.
Since UTF-8 is major text encoding and many Windows environment doesn't use
UTF-8 by default
Inada Naoki added the comment:
New changeset a4084b9d1e40c1c9259372263d1fe8c8a562b093 by Konge in branch
'master':
bpo-41497: Fix potential UnicodeDecodeError in dis CLI (GH-21757)
https://github.com/python/cpython/commit/a4084b9d1e40c1c9259372263d1fe8c8a562b093
--
nosy
Inada Naoki added the comment:
New changeset 46e19b61d31ba99f049258efa4ff1334856a3643 by Inada Naoki in branch
'master':
bpo-41098: Doc: Add missing deprecated directives (GH-21162)
https://github.com/python/cpython/commit/46e19b61d31ba99f049258efa4ff1334856a3643
Inada Naoki added the comment:
New changeset 54636355805dd2877bb54fbad8d967e1ddd8b553 by Zackery Spytz in
branch 'master':
bpo-39871: Fix an error in a news entry (GH-21749)
https://github.com/python/cpython/commit/54636355805dd2877bb54fbad8d967e1ddd8b553
--
nosy: +inada.naoki
Change by Inada Naoki :
--
versions: -Python 3.5, Python 3.6, Python 3.7
___
Python tracker
<https://bugs.python.org/issue41497>
___
___
Python-bugs-list mailin
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 d9323a8c6e07071a59dc4c910661db33236c01b2 by Inada Naoki in branch
'master':
bpo-41493: Refactoring dictresize (GH-21751)
https://github.com/python/cpython/commit/d9323a8c6e07071a59dc4c910661db33236c01b2
Change by Inada Naoki :
--
keywords: +patch
pull_requests: +20894
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/21751
___
Python tracker
<https://bugs.python.org/issu
New submission from Inada Naoki :
dictresize accept `minsize` and calculate `newsize` which is `newsize >=
minsize`.
Some caller pass the exact dk_size so calculating `newsize` is not necessary.
Split calculating `newsize` from `minused` into new function.
Additonally, use _Py_bit_len
Inada Naoki added the comment:
New changeset 270b4ad4df795783d417ba15080da8f95e598689 by Inada Naoki in branch
'master':
bpo-36346: Doc: Update removal schedule of legacy Unicode (GH-21479)
https://github.com/python/cpython/commit/270b4ad4df795783d417ba15080da8f95e598689
Inada Naoki added the comment:
For the record, deprecation warning is just a waring. Build failure is coming
from here:
```
yarl/_quoting.c:1245:23: error: lvalue required as left operand of assignment
Py_SIZE(list) = len+1;
```
It is not relating PEP 623, and it has been fixed
Change by Inada Naoki :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> performance
___
Python tracker
<https://bugs.python
501 - 600 of 3179 matches
Mail list logo