[issue46110] `eval("-"*3000000 + "4")` in cmd causes hard crash

2021-12-17 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

This is the top of the stacktrace I got on Windows in Visual Studio:

ucrtbased.dll!7ff9096d8ea8()Unknown
ucrtbased.dll!7ff9096d727c()Unknown
ucrtbased.dll!7ff9096d6f69()Unknown
ucrtbased.dll!7ff9096d70b3()Unknown
ucrtbased.dll!7ff9096d72e9()Unknown
ucrtbased.dll!7ff9096cef0c()Unknown
ucrtbased.dll!7ff9096cf446()Unknown
>   python311_d.dll!tok_get(tok_state * tok, const char * * p_start, const 
> char * * p_end) Line 1699C
python311_d.dll!_PyTokenizer_Get(tok_state * tok, const char * * 
p_start, const char * * p_end) Line 2061   C
python311_d.dll!_PyPegen_fill_token(Parser * p) Line 223C
python311_d.dll!_PyPegen_is_memoized(Parser * p, int type, void * pres) 
Line 309C
python311_d.dll!factor_rule(Parser * p) Line 12622  C
python311_d.dll!factor_rule(Parser * p) Line 12682  C
python311_d.dll!factor_rule(Parser * p) Line 12682  C
python311_d.dll!factor_rule(Parser * p) Line 12682  C
python311_d.dll!factor_rule(Parser * p) Line 12682  C
python311_d.dll!factor_rule(Parser * p) Line 12682  C
python311_d.dll!factor_rule(Parser * p) Line 12682  C
python311_d.dll!factor_rule(Parser * p) Line 12682  C
python311_d.dll!factor_rule(Parser * p) Line 12682  C
python311_d.dll!factor_rule(Parser * p) Line 12682  C
python311_d.dll!factor_rule(Parser * p) Line 12682  C
python311_d.dll!factor_rule(Parser * p) Line 12682  C
...

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46110>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45978] deepfreeze opaquely fails on Windows when building from Visual Studio

2021-12-18 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

This was fixed by https://github.com/python/cpython/pull/30143

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue45978>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45609] Specialize STORE_SUBSCR

2021-12-18 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +28414
pull_request: https://github.com/python/cpython/pull/30193

___
Python tracker 
<https://bugs.python.org/issue45609>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46148] Optimize pathlib

2021-12-22 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I have https://github.com/python/cpython/pull/27828 open already to add 
vectorcall to itemgetter and attrgetter

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46148>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46161] `class A(1, 2, 3, **d): pass` gives bad bytecode

2021-12-23 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Bisected to here:


13bc13960cc83dbd1cb5701d9a59ac9b9144b205 is the first bad commit
commit 13bc13960cc83dbd1cb5701d9a59ac9b9144b205
Author: Mark Shannon 
Date:   Thu Jan 23 09:25:17 2020 +

bpo-39320: Handle unpacking of *values in compiler (GH-17984)

* Add three new bytecodes: LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE. Use them 
to implement star unpacking expressions.

* Remove four bytecodes BUILD_LIST_UNPACK, BUILD_TUPLE_UNPACK, 
BUILD_SET_UNPACK and  BUILD_TUPLE_UNPACK_WITH_CALL opcodes as they are now 
unused.

* Update magic number and dis.rst for new bytecodes.



In debug mode, the following code gives fails a C-level assertion:

d = {'metaclass': type}
for _ in [1]:
class A(1, 2, 3, **d):
pass

Assertion failed: b->b_startdepth < 0 || b->b_startdepth == depth, file 
compile.c, line 6959

--
nosy: +Dennis Sweeney, Mark.Shannon
title: Incorrect bytecpde compilation for class -> `class A(1, 2, 3, **d): 
pass` gives bad bytecode
type: compile error -> crash
versions: +Python 3.10, Python 3.11, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue46161>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46161] `class A(1, 2, 3, **d): pass` gives bad bytecode

2021-12-23 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I was trying to figure out how code like this could ever *not* raise an 
exception, and here is one case that runs to completion on 3.6--3.8, but it 
raises `TypeError: 'str' object is not callable` on 3.9--3.11.


class I(int):
def __init__(*args, **kwargs): pass
def __new__(*args, **kwargs): pass

d = {'metaclass': I}
class A(1, 2, 3, **d):
pass

--

___
Python tracker 
<https://bugs.python.org/issue46161>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46177] can't install launcher for all users

2021-12-25 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Try right-clicking the installer and choosing "run as administrator". Then 
hopefully that checkbox should be available.

It's not enough to be logged in as an admin, you also have to run this 
particular program with admin permissions.

------
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46177>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46190] Omit k in random.sample()

2021-12-28 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Can you describe more about your use-case for this?

You can already do something like this now with something like the following:

def random_subset(sequence):
source = random.randbytes(len(sequence))
return [x for x, r in zip(sequence, source) if r & 1]

You could add a random.shuffle() call at the end if your application needs it.

For the case with counts, you could do getrandbits(i).bit_count() to get a 
binomial distribution to choose how many of each element to include.

--
components: +Library (Lib) -Extension Modules
nosy: +Dennis Sweeney, rhettinger
versions: +Python 3.11

___
Python tracker 
<https://bugs.python.org/issue46190>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46190] Omit k in random.sample()

2021-12-28 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

For completeness:

def random_subset_with_counts(sequence, counts):
result = []
for x, k in zip(sequence, counts):
result.extend([x] * random.getrandbits(k).bit_count())
return result

--

___
Python tracker 
<https://bugs.python.org/issue46190>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45508] Specialize INPLACE_ADD

2021-12-28 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue45508>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41850] inspect.py: access block stack

2021-12-28 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

With the advent of zero-cost exception handling in Python 3.10, there is no 
block stack, neither for exceptions nor for loops. These were always regarded 
as an implementation detail of the compiler. If you have any new ideas for a 
feature like this, I would suggest sending them to the Python-Ideas mailing 
list, but I'm closing this for now.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41850>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46192] Optimize builtin functions min() and max()

2021-12-31 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Kind of like what's mentioned at 
https://github.com/faster-cpython/ideas/discussions/131 , it may be interesting 
to explore implementing min()/max() in Pure python, considering recent 
specializations to COMPARE_OP, and potential future specializations of FOR_ITER.

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46192>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Another option would be to use globals:

>>> BREAKPOINTS = [60, 70, 80, 90]
>>> GRADES = "FDCBA"
>>> def grade(score):
... i = bisect(BREAKPOINTS, score)
... return GRADES[i]
... 
>>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]
['F', 'A', 'C', 'C', 'B', 'A', 'A']

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46224>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue46224>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-02 Thread Dennis Sweeney


New submission from Dennis Sweeney :

Some benchmarks for this change are below. The case with the largest speedup, 
`[None] * 1`, is the case that I would consider the most important: 
initializing counters of the form `[0] * N` is very common in my experience.

The following were taken from a PGO build on Windows without CPU isolation, so 
take them with a grain of salt:

Slower (16):
- [None] * 2: 61.6 ns +- 3.3 ns -> 71.0 ns +- 1.5 ns: 1.15x slower
- list(range(10)) * 1: 205 us +- 49 us -> 232 us +- 93 us: 1.13x slower
- ["Python", "Perl"] * 1: 31.4 us +- 4.3 us -> 34.4 us +- 0.2 us: 1.10x 
slower
- list(range(100)) * 2: 370 ns +- 12 ns -> 395 ns +- 14 ns: 1.07x slower
- list(range(10)) * 2: 81.5 ns +- 2.8 ns -> 86.9 ns +- 2.4 ns: 1.07x slower
- [None] * 10: 72.3 ns +- 2.2 ns -> 75.8 ns +- 2.1 ns: 1.05x slower
- ["Python", "Perl"] * 100: 442 ns +- 67 ns -> 463 ns +- 4 ns: 1.05x slower
- tuple(range(10)) * 2: 88.2 ns +- 2.9 ns -> 91.9 ns +- 2.7 ns: 1.04x slower
- ("Python", "Perl") * 10: 92.6 ns +- 7.8 ns -> 96.0 ns +- 4.5 ns: 1.04x slower
- ["Python", "Perl"] * 10: 86.1 ns +- 4.2 ns -> 89.1 ns +- 2.7 ns: 1.04x slower
- (None,) * 10: 69.4 ns +- 1.9 ns -> 71.2 ns +- 3.1 ns: 1.03x slower
- ["Python", "Perl"] * 2: 63.9 ns +- 2.6 ns -> 65.3 ns +- 1.4 ns: 1.02x slower
- (None,) * 2: 54.0 ns +- 0.7 ns -> 55.1 ns +- 2.1 ns: 1.02x slower
- ("Python", "Perl") * 2: 57.5 ns +- 3.0 ns -> 58.6 ns +- 2.4 ns: 1.02x slower
- list(range(10)) * 10: 238 ns +- 8 ns -> 242 ns +- 7 ns: 1.02x slower
- tuple(range(100)) * 2: 414 ns +- 19 ns -> 420 ns +- 6 ns: 1.02x slower

Faster (22):
- [None] * 1: 25.1 us +- 0.2 us -> 12.8 us +- 0.2 us: 1.97x faster
- tuple(range(10)) * 1: 255 us +- 91 us -> 176 us +- 77 us: 1.45x faster
- tuple(range(1000)) * 10: 17.8 us +- 0.3 us -> 12.4 us +- 0.1 us: 1.44x faster
- [None] * 100: 355 ns +- 11 ns -> 251 ns +- 7 ns: 1.41x faster
- list(range(1000)) * 10: 16.8 us +- 0.2 us -> 12.5 us +- 0.1 us: 1.34x faster
- tuple(range(100)) * 100: 15.9 us +- 0.2 us -> 12.7 us +- 0.2 us: 1.26x faster
- tuple(range(10)) * 100: 1.63 us +- 0.02 us -> 1.33 us +- 0.01 us: 1.23x faster
- tuple(range(1000)) * 2: 3.61 us +- 0.06 us -> 2.93 us +- 0.03 us: 1.23x faster
- list(range(100)) * 100: 13.8 us +- 0.3 us -> 11.2 us +- 0.1 us: 1.23x faster
- tuple(range(100)) * 10: 1.68 us +- 0.02 us -> 1.40 us +- 0.01 us: 1.20x faster
- tuple(range(1000)) * 100: 240 us +- 87 us -> 200 us +- 102 us: 1.20x faster
- tuple(range(1000)) * 1: 33.8 ms +- 0.8 ms -> 28.3 ms +- 1.5 ms: 1.19x 
faster
- list(range(1000)) * 1: 33.9 ms +- 0.9 ms -> 28.6 ms +- 1.4 ms: 1.19x 
faster
- list(range(100)) * 10: 1.47 us +- 0.10 us -> 1.25 us +- 0.01 us: 1.18x faster
- list(range(10)) * 100: 1.41 us +- 0.02 us -> 1.22 us +- 0.02 us: 1.16x faster
- list(range(100)) * 1: 3.15 ms +- 0.13 ms -> 2.79 ms +- 0.13 ms: 1.13x 
faster
- list(range(1000)) * 2: 3.32 us +- 0.07 us -> 2.94 us +- 0.04 us: 1.13x faster
- tuple(range(100)) * 1: 3.24 ms +- 0.13 ms -> 2.88 ms +- 0.14 ms: 1.13x 
faster
- (None,) * 1: 26.7 us +- 0.2 us -> 24.1 us +- 0.2 us: 1.11x faster
- tuple(range(10)) * 10: 258 ns +- 7 ns -> 249 ns +- 6 ns: 1.04x faster
- ("Python", "Perl") * 100: 438 ns +- 7 ns -> 436 ns +- 7 ns: 1.01x faster
- ("Python", "Perl") * 1: 31.1 us +- 0.3 us -> 30.9 us +- 0.2 us: 1.01x 
faster

Benchmark hidden because not significant (2): list(range(1000)) * 100, (None,) 
* 100

Geometric mean: 1.10x faster

--
components: Interpreter Core
messages: 409546
nosy: Dennis Sweeney
priority: normal
severity: normal
status: open
title: Do all ref-counting at once for sequence multiplication
type: performance
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue46235>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-02 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
keywords: +patch
pull_requests: +28558
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30346

___
Python tracker 
<https://bugs.python.org/issue46235>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-02 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

# benchmarking script

from pyperf import Runner
runner = Runner()

for n in [2, 10, 100, 10_000]:
for A in [
'[None]',
'["Python", "Perl"]',
'list(range(10))',
'list(range(100))',
'list(range(1000))',
'(None,)',
'("Python", "Perl")',
'tuple(range(10))',
'tuple(range(100))',
'tuple(range(1000))',
]:
runner.timeit(
name=f"{A} * {n}",
setup=f"x = {A}",
stmt=f"x * {n}",
)

--

___
Python tracker 
<https://bugs.python.org/issue46235>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46148] Optimize pathlib

2022-01-02 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +28560
pull_request: https://github.com/python/cpython/pull/27828

___
Python tracker 
<https://bugs.python.org/issue46148>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42202] Optimize function annotation

2022-01-02 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I believe this change accidentally affected the API of 
PyFunction_GetAnnotations: previously it would only return dict or NULL, now it 
can also return a tuple. See bpo-46236

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue42202>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46236] PyFunction_GetAnnotations returning Tuple vs Dict

2022-01-02 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
nosy: +methane

___
Python tracker 
<https://bugs.python.org/issue46236>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-03 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Hm... the effects are completely different on GCC. This is with 
--enable-optimizations and GCC on WSL:

Slower (29):
- tuple(range(100)) * 10: 1.22 us +- 0.02 us -> 2.29 us +- 0.05 us: 1.87x slower
- tuple(range(100)) * 2: 345 ns +- 7 ns -> 629 ns +- 5 ns: 1.82x slower
- tuple(range(1000)) * 2: 3.03 us +- 0.06 us -> 5.32 us +- 0.05 us: 1.76x slower
- tuple(range(10)) * 100: 1.25 us +- 0.08 us -> 2.18 us +- 0.03 us: 1.74x slower
- tuple(range(10)) * 1000: 12.9 us +- 0.2 us -> 20.8 us +- 0.2 us: 1.61x slower
- tuple(range(100)) * 100: 13.0 us +- 0.2 us -> 20.9 us +- 0.1 us: 1.60x slower
- tuple(range(100)) * 1000: 138 us +- 2 us -> 211 us +- 2 us: 1.52x slower
- ("Python", "Perl") * 1000: 3.18 us +- 0.03 us -> 4.69 us +- 0.03 us: 1.47x 
slower
- tuple(range(100)) * 1: 1.52 ms +- 0.02 ms -> 2.21 ms +- 0.02 ms: 1.45x 
slower
- tuple(range(10)) * 1: 148 us +- 7 us -> 211 us +- 2 us: 1.43x slower
- tuple(range(1000)) * 10: 15.9 us +- 0.4 us -> 22.3 us +- 0.2 us: 1.40x slower
- ("Python", "Perl") * 1: 33.8 us +- 0.8 us -> 46.5 us +- 0.6 us: 1.38x 
slower
- ("Python", "Perl") * 100: 428 ns +- 9 ns -> 577 ns +- 6 ns: 1.35x slower
- tuple(range(1000)) * 100: 167 us +- 2 us -> 218 us +- 2 us: 1.30x slower
- tuple(range(10)) * 2: 85.5 ns +- 3.9 ns -> 111 ns +- 3 ns: 1.30x slower
- (None,) * 100: 306 ns +- 4 ns -> 396 ns +- 3 ns: 1.29x slower
- tuple(range(1000)) * 1000: 1.78 ms +- 0.03 ms -> 2.27 ms +- 0.02 ms: 1.27x 
slower
- (None,) * 1000: 2.66 us +- 0.02 us -> 3.25 us +- 0.03 us: 1.22x slower
- tuple(range(10)) * 10: 236 ns +- 17 ns -> 287 ns +- 2 ns: 1.22x slower
- tuple(range(1000)) * 1: 23.2 ms +- 0.4 ms -> 28.1 ms +- 0.3 ms: 1.21x 
slower
- ("Python", "Perl") * 10: 88.6 ns +- 2.7 ns -> 106 ns +- 3 ns: 1.19x slower
- (None,) * 1: 27.5 us +- 0.3 us -> 31.5 us +- 0.2 us: 1.14x slower
- ("Python", "Perl") * 2: 48.9 ns +- 0.6 ns -> 54.7 ns +- 0.8 ns: 1.12x slower
- (None,) * 10: 63.4 ns +- 1.7 ns -> 70.0 ns +- 0.6 ns: 1.10x slower
- (None,) * 2: 46.7 ns +- 0.5 ns -> 49.8 ns +- 0.5 ns: 1.06x slower
- list(range(10)) * 2: 73.5 ns +- 1.2 ns -> 76.6 ns +- 2.3 ns: 1.04x slower
- [None] * 10: 58.1 ns +- 0.7 ns -> 60.3 ns +- 0.7 ns: 1.04x slower
- ["Python", "Perl"] * 2: 56.1 ns +- 0.6 ns -> 57.4 ns +- 0.9 ns: 1.02x slower
- [None] * 2: 51.9 ns +- 0.5 ns -> 52.3 ns +- 0.5 ns: 1.01x slower

Faster (18):
- list(range(100)) * 1: 1.98 ms +- 0.33 ms -> 953 us +- 14 us: 2.08x faster
- list(range(1000)) * 100: 168 us +- 2 us -> 86.8 us +- 0.9 us: 1.93x faster
- list(range(1000)) * 10: 15.9 us +- 0.2 us -> 8.40 us +- 0.13 us: 1.89x faster
- list(range(100)) * 100: 13.1 us +- 0.2 us -> 7.41 us +- 0.09 us: 1.77x faster
- list(range(1000)) * 1000: 1.80 ms +- 0.05 ms -> 1.04 ms +- 0.04 ms: 1.73x 
faster
- list(range(100)) * 1000: 140 us +- 2 us -> 82.2 us +- 4.9 us: 1.70x faster
- list(range(1000)) * 1: 26.0 ms +- 0.6 ms -> 15.4 ms +- 0.3 ms: 1.69x 
faster
- ["Python", "Perl"] * 1: 33.8 us +- 0.3 us -> 21.2 us +- 0.2 us: 1.59x 
faster
- ["Python", "Perl"] * 1000: 3.41 us +- 0.03 us -> 2.17 us +- 0.02 us: 1.57x 
faster
- list(range(10)) * 1000: 12.2 us +- 0.2 us -> 8.11 us +- 0.21 us: 1.51x faster
- list(range(10)) * 1: 136 us +- 2 us -> 91.7 us +- 1.0 us: 1.49x faster
- list(range(10)) * 100: 1.19 us +- 0.10 us -> 806 ns +- 15 ns: 1.47x faster
- list(range(1000)) * 2: 3.05 us +- 0.07 us -> 2.08 us +- 0.04 us: 1.46x faster
- list(range(100)) * 10: 1.17 us +- 0.03 us -> 850 ns +- 16 ns: 1.38x faster
- ["Python", "Perl"] * 100: 440 ns +- 8 ns -> 325 ns +- 5 ns: 1.35x faster
- list(range(10)) * 10: 172 ns +- 2 ns -> 148 ns +- 2 ns: 1.16x faster
- list(range(100)) * 2: 320 ns +- 19 ns -> 289 ns +- 3 ns: 1.11x faster
- ["Python", "Perl"] * 10: 85.0 ns +- 3.1 ns -> 79.7 ns +- 2.4 ns: 1.07x faster

Benchmark hidden because not significant (3): [None] * 100, [None] * 1000, 
[None] * 1

Geometric mean: 1.01x slower

--

___
Python tracker 
<https://bugs.python.org/issue46235>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-03 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Benchmarks are definitively better with the most recent change (in which the 
major data-copying loop is between parts of the same buffer):

-- MSVC 

Slower (3):
- (None,) * 2: 54.0 ns +- 0.7 ns -> 63.4 ns +- 2.5 ns: 1.17x slower
- [None] * 2: 61.6 ns +- 3.3 ns -> 69.0 ns +- 1.4 ns: 1.12x slower
- [None] * 10: 72.3 ns +- 2.2 ns -> 73.9 ns +- 2.3 ns: 1.02x slower

Faster (33):
- [None] * 1: 25.1 us +- 0.2 us -> 12.8 us +- 0.2 us: 1.96x faster
- (None,) * 1: 26.7 us +- 0.2 us -> 15.2 us +- 0.2 us: 1.76x faster
- list(range(1000)) * 100: 248 us +- 95 us -> 146 us +- 50 us: 1.70x faster
- list(range(1000)) * 10: 16.8 us +- 0.2 us -> 10.4 us +- 0.1 us: 1.61x faster
- list(range(100)) * 100: 13.8 us +- 0.3 us -> 8.60 us +- 0.09 us: 1.60x faster
- list(range(10)) * 100: 1.41 us +- 0.02 us -> 924 ns +- 15 ns: 1.53x faster
- list(range(100)) * 10: 1.47 us +- 0.10 us -> 981 ns +- 14 ns: 1.50x faster
- tuple(range(10)) * 1: 255 us +- 91 us -> 171 us +- 51 us: 1.49x faster
- [None] * 100: 355 ns +- 11 ns -> 245 ns +- 7 ns: 1.45x faster
- (None,) * 100: 357 ns +- 4 ns -> 261 ns +- 3 ns: 1.37x faster
- tuple(range(1000)) * 10: 17.8 us +- 0.3 us -> 13.3 us +- 0.1 us: 1.34x faster
- list(range(10)) * 1: 205 us +- 49 us -> 157 us +- 95 us: 1.31x faster
- list(range(1000)) * 2: 3.32 us +- 0.07 us -> 2.63 us +- 0.03 us: 1.26x faster
- tuple(range(100)) * 100: 15.9 us +- 0.2 us -> 13.0 us +- 0.1 us: 1.22x faster
- list(range(1000)) * 1: 33.9 ms +- 0.9 ms -> 28.2 ms +- 1.6 ms: 1.20x 
faster
- ["Python", "Perl"] * 1: 31.4 us +- 4.3 us -> 26.2 us +- 0.7 us: 1.20x 
faster
- tuple(range(1000)) * 1: 33.8 ms +- 0.8 ms -> 28.3 ms +- 1.3 ms: 1.19x 
faster
- tuple(range(100)) * 10: 1.68 us +- 0.02 us -> 1.42 us +- 0.01 us: 1.18x faster
- ["Python", "Perl"] * 100: 442 ns +- 67 ns -> 376 ns +- 6 ns: 1.18x faster
- tuple(range(10)) * 100: 1.63 us +- 0.02 us -> 1.40 us +- 0.02 us: 1.17x faster
- tuple(range(1000)) * 2: 3.61 us +- 0.06 us -> 3.11 us +- 0.06 us: 1.16x faster
- list(range(10)) * 10: 238 ns +- 8 ns -> 206 ns +- 6 ns: 1.16x faster
- list(range(100)) * 1: 3.15 ms +- 0.13 ms -> 2.73 ms +- 0.15 ms: 1.15x 
faster
- list(range(100)) * 2: 370 ns +- 12 ns -> 323 ns +- 6 ns: 1.14x faster
- tuple(range(100)) * 1: 3.24 ms +- 0.13 ms -> 2.85 ms +- 0.13 ms: 1.14x 
faster
- ("Python", "Perl") * 1: 31.1 us +- 0.3 us -> 27.4 us +- 0.3 us: 1.14x 
faster
- ("Python", "Perl") * 100: 438 ns +- 7 ns -> 389 ns +- 9 ns: 1.13x faster
- ["Python", "Perl"] * 10: 86.1 ns +- 4.2 ns -> 77.3 ns +- 2.4 ns: 1.11x faster
- list(range(10)) * 2: 81.5 ns +- 2.8 ns -> 77.0 ns +- 2.1 ns: 1.06x faster
- ("Python", "Perl") * 10: 92.6 ns +- 7.8 ns -> 88.4 ns +- 4.8 ns: 1.05x faster
- ["Python", "Perl"] * 2: 63.9 ns +- 2.6 ns -> 61.3 ns +- 1.7 ns: 1.04x faster
- tuple(range(100)) * 2: 414 ns +- 19 ns -> 404 ns +- 6 ns: 1.02x faster
- tuple(range(10)) * 10: 258 ns +- 7 ns -> 253 ns +- 8 ns: 1.02x faster

Benchmark hidden because not significant (4): ("Python", "Perl") * 2, 
tuple(range(10)) * 2, (None,) * 10, tuple(range(1000)) * 100

Geometric mean: 1.21x faster


 GCC PGO on WSL 

Slower (4):
- [None] * 10: 58.1 ns +- 0.7 ns -> 59.4 ns +- 0.9 ns: 1.02x slower
- ("Python", "Perl") * 2: 48.9 ns +- 0.6 ns -> 49.9 ns +- 0.6 ns: 1.02x slower
- [None] * 1000: 1.56 us +- 0.02 us -> 1.59 us +- 0.02 us: 1.02x slower
- [None] * 2: 51.9 ns +- 0.5 ns -> 52.4 ns +- 0.8 ns: 1.01x slower

Faster (44):
- list(range(100)) * 1: 1.98 ms +- 0.33 ms -> 976 us +- 43 us: 2.03x faster
- list(range(1000)) * 100: 168 us +- 2 us -> 84.8 us +- 1.0 us: 1.98x faster
- list(range(1000)) * 10: 15.9 us +- 0.2 us -> 8.47 us +- 0.20 us: 1.88x faster
- list(range(100)) * 100: 13.1 us +- 0.2 us -> 7.02 us +- 0.12 us: 1.87x faster
- list(range(1000)) * 1000: 1.80 ms +- 0.05 ms -> 986 us +- 12 us: 1.83x faster
- list(range(100)) * 1000: 140 us +- 2 us -> 79.1 us +- 0.9 us: 1.77x faster
- list(range(10)) * 1: 136 us +- 2 us -> 77.5 us +- 1.0 us: 1.76x faster
- list(range(1000)) * 1: 26.0 ms +- 0.6 ms -> 15.2 ms +- 0.3 ms: 1.71x 
faster
- list(range(10)) * 1000: 12.2 us +- 0.2 us -> 7.18 us +- 0.08 us: 1.70x faster
- tuple(range(1000)) * 100: 167 us +- 2 us -> 106 us +- 1 us: 1.58x faster
- tuple(range(1000)) * 1000: 1.78 ms +- 0.03 ms -> 1.13 ms +- 0.01 ms: 1.58x 
faster
- tuple(range(10)) * 1: 148 us +- 7 us -> 95.5 us +- 1.1 us: 1.55x faster
- list(range(10)) * 100: 1.19 us +- 0.10 us -> 795 ns +- 20 ns: 1.49x faster
- tuple(range(1000)) * 10: 15.9 us +- 0.4 us -> 10.6 us +- 0.2 us: 1.49x faster
- list(range(100)) * 10: 1.17 us +- 

[issue46236] PyFunction_GetAnnotations returning Tuple vs Dict

2022-01-04 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Pablo, should this be a release blocker?

--
nosy: +Dennis Sweeney, pablogsal

___
Python tracker 
<https://bugs.python.org/issue46236>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46256] Objects __del__ called after module have been removed

2022-01-05 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I'm getting this:

Traceback (most recent call last):
  File "/mnt/c/Users/sween/Source/Repos/cpython2/cpython/delbug.py", line 65, 
in 
conn = psycopg.connect('dbname=cuny_curriculum')
  File "/home/sween/.local/lib/python3.10/site-packages/psycopg/connection.py", 
line 572, in connect
raise ex.with_traceback(None)
psycopg.OperationalError: connection is bad: No such file or directory
Is the server running locally and accepting connections on that socket?

Is there a self-contained way to reproduce the issue without a DB up and 
running? Or to somehow shrink the reproducer down to its cpython-relevant bare 
essentials?

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46256>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46304] Unable to iterate over lines in a file without a block of code

2022-01-08 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I think this might require something like PEP 533 in order to be safe.

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46304>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46321] Don't need delineators on lists

2022-01-09 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

What you typed is already valid syntax, it's just that `a, b, c` makes a tuple, 
not a list. Changing that now would be backwards-incompatible.

Is this a request for some kind of tweak to some documentation, or is this a 
request for a different behavior?

--
nosy: +Dennis Sweeney
status: open -> pending

___
Python tracker 
<https://bugs.python.org/issue46321>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46328] add sys.exception()

2022-01-10 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Would there be any value in spelling this as sys.active_exception() or 
sys.current_exception() or sys.get_exception() or sys.exception_in_flight() or 
similar?

My only worry is confusion between sys.exception() versus builtins.Exception.

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46328>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46352] Spam

2022-01-11 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
components:  -Installation
nosy:  -jacobmartin717
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
title: Steps To Do Arlo Setup -> Spam
type: security -> 
versions:  -Python 3.8

___
Python tracker 
<https://bugs.python.org/issue46352>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46385] Remove parenthetical symbols for readability and nlp

2022-01-14 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

"Removing tuples" would be highly backwards-incompatible, as millions of 
programs rely on tuples, and we can't break them for no reason.

> Lists have everything tuples have and more.

Not true: tuples are hashable, so they can be used as keys in dicts and sets, 
while lists cannot.

The Python-Ideas mailing list, rather than this bug tracker, is probably a 
better location for these sorts of proposals, so I'll close this for now, but 
this ticket can be re-opened if you can arrive at some sort of consensus with 
others on that list.

------
nosy: +Dennis Sweeney
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46385>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46393] Generate frozenset constants when explicitly appropriate

2022-01-15 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

There's also the hacky expression {*()} to get an empty set

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46393>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46404] 3.11a4: a small attrs regression

2022-01-16 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

bisected to here:

631f9938b1604d4f893417ec339b9e0fa9196fb1 is the first new commit
commit 631f9938b1604d4f893417ec339b9e0fa9196fb1
Author: Eric Snow 
Date:   Mon Jun 7 16:52:00 2021 -0600

bpo-43693: Add the MAKE_CELL opcode and interleave fast locals offsets. 
(gh-26396)

This moves logic out of the frame initialization code and into the compiler 
and eval loop.  Doing so simplifies the runtime code and allows us to optimize 
it better.

https://bugs.python.org/issue43693

--
nosy: +Dennis Sweeney, eric.snow

___
Python tracker 
<https://bugs.python.org/issue46404>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-17 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Another option to consider would be a table lookup of a pre-computed table of 
[1 << i for i in range(64)].

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46407>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46420] Use NOTRACE_DISPATCH in specialized opcodes

2022-01-17 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
components: Interpreter Core
nosy: Dennis Sweeney
priority: normal
severity: normal
status: open
title: Use NOTRACE_DISPATCH in specialized opcodes
type: performance
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue46420>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46420] Use NOTRACE_DISPATCH in specialized opcodes

2022-01-17 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
keywords: +patch
pull_requests: +28853
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30652

___
Python tracker 
<https://bugs.python.org/issue46420>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46428] Cython Build: '_PyErr_StackItem’ has no member named ‘exc_traceback’

2022-01-18 Thread Dennis Sweeney

Change by Dennis Sweeney :


--
title: 3.11.0a3 vs 3.11.0a4 -> Cython Build: '_PyErr_StackItem’ has no member 
named ‘exc_traceback’

___
Python tracker 
<https://bugs.python.org/issue46428>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46450] namedtuple leaks data between instances when field's default value is empty list

2022-01-20 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

This seems to be the standard confusion people have with mutable defaults, just 
with namedtuple defaults rather than function defaults.

Similar behavior elsewhere in Python:

>>> def f(x, y=[]):
... y.append(x)
... print(y)
... 
... 
>>> f(1)
[1]
>>> f(2)
[1, 2]
>>> f(15)
[1, 2, 15]

Or even

>>> a = []
>>> b = a
>>> b.append(4)
>>> a
[4]

This happens because the values you provide as defaults are *objects*, not 
*expressions* to be re-evaluated. If you make one of the defaults a list, you 
ask the namedtuple to "give me this particular list every time", and it will 
give you that same list, even if it has been modified.

There is currently no support for "construct a brand new list every time" in 
namedtuples. You could look to the dataclasses module for such a feature, where 
you can specify default_factory=list, and it will make a new list for each 
instance.

https://docs.python.org/3/library/dataclasses.html#dataclasses.field

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46450>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46071] Graphlib documentation (edge direction)

2022-01-20 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

> It's not obvious if the "predecessor" should be the start or the end point of 
> the edge

https://en.wikipedia.org/wiki/Directed_graph#Basic_terminology :
"""If a path leads from x to y, then y is said to be a successor of x and 
reachable from x, and x is said to be a predecessor of y."""

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46071>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46071] Graphlib documentation (edge direction)

2022-01-21 Thread Dennis Sweeney

Dennis Sweeney  added the comment:

I think I can summarize:

Tim + Current Docs:

* static_order to return [A, B]
* Conceptual/abstract directed graph direction is A --> B
* A is a predecessor of B
* predecessor mapping to be passed is {B: [A]}

David suggests:

* static_order returns [A, B]
* Conceptual/abstract directed graph direction is B --> A
* mapping to be passed is {B: [A]}

It seems David places more value on the idea of the concrete mapping "pointing 
forwards" with respect to the abstract directed graph, while it seems Tim 
places more value on the idea of the abstract mapping direction corresponding 
to the final static order. These two goals are in conflict, assuming we don't 
want to change the behavior.

I think I agree more with Tim, since abstract graphs can be represented in lots 
of ways (set of pairs? adjacency matrix or its transpose? adjacency list/dict? 
Bi-directional mapping?), so the translation from the abstract to the concrete 
is a decent place for the "reversal".

It's very very standard for a topological sort to be conceptualized as taking a 
picture like
A → B
↓   ↓
C → D
and transforming it into a list/iterator like [A, B, C, D], and I think the 
conceptual consistency there should be preserved, even if the concrete 
representation of the abstract graph "points backwards".

--

___
Python tracker 
<https://bugs.python.org/issue46071>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46509] Type-specialized Py_DECREF

2022-01-24 Thread Dennis Sweeney


New submission from Dennis Sweeney :

GCC --enable-optimizations --with-lto on WSL:

Slower (7):
- json_dumps: 12.8 ms +- 0.2 ms -> 13.1 ms +- 0.3 ms: 1.02x slower
- meteor_contest: 106 ms +- 2 ms -> 109 ms +- 3 ms: 1.02x slower
- telco: 6.50 ms +- 0.17 ms -> 6.58 ms +- 0.18 ms: 1.01x slower
- fannkuch: 383 ms +- 5 ms -> 388 ms +- 8 ms: 1.01x slower
- regex_compile: 143 ms +- 2 ms -> 145 ms +- 4 ms: 1.01x slower
- mako: 11.1 ms +- 0.1 ms -> 11.2 ms +- 0.2 ms: 1.01x slower
- chameleon: 7.08 ms +- 0.07 ms -> 7.12 ms +- 0.10 ms: 1.01x slower

Faster (27):
- unpack_sequence: 45.9 ns +- 1.1 ns -> 41.6 ns +- 1.0 ns: 1.10x faster
- logging_silent: 108 ns +- 11 ns -> 101 ns +- 3 ns: 1.06x faster
- nbody: 95.6 ms +- 3.2 ms -> 90.2 ms +- 1.9 ms: 1.06x faster
- spectral_norm: 98.3 ms +- 2.3 ms -> 92.8 ms +- 1.6 ms: 1.06x faster
- regex_dna: 202 ms +- 3 ms -> 194 ms +- 3 ms: 1.04x faster
- scimark_fft: 342 ms +- 12 ms -> 331 ms +- 7 ms: 1.03x faster
- crypto_pyaes: 89.6 ms +- 1.7 ms -> 86.8 ms +- 1.1 ms: 1.03x faster
- json_loads: 27.4 us +- 0.9 us -> 26.5 us +- 1.3 us: 1.03x faster
- scimark_monte_carlo: 69.3 ms +- 1.5 ms -> 67.3 ms +- 1.2 ms: 1.03x faster
- pickle_list: 4.62 us +- 0.21 us -> 4.51 us +- 0.15 us: 1.02x faster
- scimark_sparse_mat_mult: 5.14 ms +- 0.21 ms -> 5.02 ms +- 0.18 ms: 1.02x 
faster
- xml_etree_parse: 161 ms +- 5 ms -> 157 ms +- 6 ms: 1.02x faster
- regex_effbot: 3.07 ms +- 0.05 ms -> 3.00 ms +- 0.07 ms: 1.02x faster
- deltablue: 4.36 ms +- 0.14 ms -> 4.27 ms +- 0.14 ms: 1.02x faster
- pickle_pure_python: 343 us +- 6 us -> 335 us +- 8 us: 1.02x faster
- sqlite_synth: 2.60 us +- 0.06 us -> 2.55 us +- 0.04 us: 1.02x faster
- xml_etree_iterparse: 110 ms +- 2 ms -> 108 ms +- 2 ms: 1.02x faster
- go: 146 ms +- 2 ms -> 143 ms +- 3 ms: 1.02x faster
- pathlib: 20.2 ms +- 0.5 ms -> 19.8 ms +- 0.3 ms: 1.02x faster
- scimark_sor: 117 ms +- 3 ms -> 115 ms +- 2 ms: 1.02x faster
- dulwich_log: 80.9 ms +- 2.0 ms -> 79.6 ms +- 1.7 ms: 1.02x faster
- nqueens: 84.4 ms +- 1.7 ms -> 83.1 ms +- 2.0 ms: 1.02x faster
- python_startup: 8.84 ms +- 0.07 ms -> 8.76 ms +- 0.07 ms: 1.01x faster
- 2to3: 269 ms +- 4 ms -> 266 ms +- 3 ms: 1.01x faster
- float: 77.0 ms +- 1.2 ms -> 76.5 ms +- 1.5 ms: 1.01x faster
- sympy_integrate: 22.7 ms +- 0.3 ms -> 22.5 ms +- 0.2 ms: 1.01x faster
- xml_etree_process: 55.7 ms +- 0.7 ms -> 55.4 ms +- 0.6 ms: 1.01x faster

Benchmark hidden because not significant (24): chaos, django_template, hexiom, 
logging_format, logging_simple, pickle, pickle_dict, pidigits, pyflate, 
python_startup_no_site, raytrace, regex_v8, richards, scimark_lu, 
sqlalchemy_declarative, sqlalchemy_imperative, sympy_expand, sympy_sum, 
sympy_str, tornado_http, unpickle, unpickle_list, unpickle_pure_python, 
xml_etree_generate

Geometric mean: 1.01x faster

--
components: Interpreter Core
messages: 411553
nosy: Dennis Sweeney
priority: normal
severity: normal
status: open
title: Type-specialized Py_DECREF
type: performance
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue46509>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46509] Type-specialized Py_DECREF

2022-01-24 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
keywords: +patch
pull_requests: +29052
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30872

___
Python tracker 
<https://bugs.python.org/issue46509>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46509] Type-specialized Py_DECREF

2022-01-24 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

This attempts to avoid the dispatch dance of

Py_DECREF(op) :: Py_TYPE(op)->tp_dealloc(op) :: Py_TYPE(op)->tp_free((PyObject 
*)op);

I suspect this earns the most speedup from floats, where freelist manipulation 
can be inlined. This might make a single-digit-int freelist more impactful.

--

___
Python tracker 
<https://bugs.python.org/issue46509>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46420] Use NOTRACE_DISPATCH in specialized opcodes

2022-01-25 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46420>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46549] Error in list comprehension conditionals when used in class attributes

2022-01-27 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I believe this is a duplicate of bpo-45899

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46549>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46549] Error in list comprehension conditionals when used in class attributes

2022-01-27 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

See also 
https://stackoverflow.com/questions/13905741/accessing-class-variables-from-a-list-comprehension-in-the-class-definition

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46549>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46558] Quadratic time internal base conversions

2022-01-27 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Is this similar to https://bugs.python.org/issue3451 ?

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46558>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-27 Thread Dennis Sweeney

Dennis Sweeney  added the comment:

Why? Callee-borrowing-from-caller is the established norm across the C API. You 
mention use-after-free, but can you elaborate on how that can happen in 
practice?

https://docs.python.org/3/extending/extending.html?highlight=borrowed#ownership-rules
 says:

"""When you pass an object reference into another function, in general, the 
function borrows the reference from you — if it needs to store it, it will use 
Py_INCREF() to become an independent owner."""

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46561>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46528] Simplify the VM's stack manipulations

2022-01-28 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Minor nit: I think swaptimize() should check the for PyMem_Malloc returning 
NULL here.

// Create an array with elements {0, 1, 2, ..., depth - 1}:
int *stack = PyMem_Malloc(depth * sizeof(int));
for (int i = 0; i < depth; i++) {
stack[i] = i;
}

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46528>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-28 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Hi Max,

My apologies -- my first message was probably too dismissive.

Is there any way to make the existing code crash with pure Python, and can we 
then add such a test case? If not with pure Python, then perhaps with some 
minimal reproducible example using the C API?

Also, does the change have any effect on microbenchmarks involving the modified 
functions?

--

___
Python tracker 
<https://bugs.python.org/issue46561>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45885] Specialize COMPARE_OP

2022-01-31 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +29223
pull_request: https://github.com/python/cpython/pull/31040

___
Python tracker 
<https://bugs.python.org/issue45885>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46615] Segfault in set intersection (&) and difference (-)

2022-02-02 Thread Dennis Sweeney


New submission from Dennis Sweeney :

Maybe related to https://bugs.python.org/issue8420

Somewhat obscure, but using only standard Python, and no frame- or gc-hacks, it 
looks like we can get a use-after-free:

from random import random

BADNESS = 0.0

class Bad:
def __eq__(self, other):
if random() < BADNESS:
set1.clear()
if random() < BADNESS:
set2.clear()
return True
def __hash__(self):
return 42

SIZE = 100
TRIALS = 10_000

ops = [
"|", "|=",
"==", "!=",
"<", "<=",
">", ">=",
# "&",  # crash!
# "&=", # crash!
"^",
# "^=", # crash
# "-", # crash
"-=",
]

for op in ops:
stmt = f"set1 {op} set2"
print(stmt, "...")
for _ in range(TRIALS):
BADNESS = 0.00
set1 = {Bad() for _ in range(SIZE)}
set2 = {Bad() for _ in range(SIZE)}
BADNESS = 0.02
exec(stmt)
print("ok.")

--
components: Interpreter Core
messages: 412386
nosy: Dennis Sweeney, rhettinger
priority: normal
severity: normal
status: open
title: Segfault in set intersection (&) and difference (-)
type: crash
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue46615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46615] Segfault in set intersection (&) and difference (-)

2022-02-02 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

replacing `return True` with `return random() < 0.5` makes *all* of the 
operations crash, except for `|` and `|=`.

--

___
Python tracker 
<https://bugs.python.org/issue46615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46615] Use-after-free by mutating set during set operations

2022-02-02 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
title: Segfault in set intersection (&) and difference (-) -> Use-after-free by 
mutating set during set operations

___
Python tracker 
<https://bugs.python.org/issue46615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46615] Use-after-free by mutating set during set operations

2022-02-02 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

set1.isdisjoint(set2) also crashes

--

___
Python tracker 
<https://bugs.python.org/issue46615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46615] Use-after-free by mutating set during set operations

2022-02-03 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

It looks like usages of the PyDict_Next API assume the resulting references are 
borrowed and so INCREF them.

Usages of set_next do not, but should.

It should hopefully be a straightforward fix of adding INCREF/DECREFs.

--

___
Python tracker 
<https://bugs.python.org/issue46615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46615] Use-after-free by mutating set during set operations

2022-02-03 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
keywords: +patch
pull_requests: +29301
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31120

___
Python tracker 
<https://bugs.python.org/issue46615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46652] Use code.co_qualname to provide richer information

2022-02-05 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Similar changes at bpo-40679 accidentally broke Cython when it was assumed that 
co_qualname was non-null, which was then fixed by defaulting to co_name in that 
case. I don't know if Cython still produces cases like that, but we should make 
sure not to needlessly break such cases if it does.

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46652>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46680] file calls itself

2022-02-08 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

https://stackoverflow.com/ or https://discuss.python.org/c/users/ are better 
places for this question.

--
nosy: +Dennis Sweeney
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46705] Memory optimization for set.issubset

2022-02-09 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue46705>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46706] AxelRacer

2022-02-09 Thread Dennis Sweeney


New submission from Dennis Sweeney :

I'm closing this -- if you found a bug in Python, please be sure to describe 
thoroughly what bug you found, steps to reproduce the bug, and what behavior 
you expected.

--
nosy: +Dennis Sweeney
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46706>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44953] Add vectorcall on operator.itemgetter and attrgetter objects

2022-02-10 Thread Dennis Sweeney


Dennis Sweeney  added the comment:


New changeset 0a145069e807fdafd1fa0315b9bc22da363d2d39 by Dennis Sweeney in 
branch 'main':
bpo-44953: Add vectorcall for itemgetter and attrgetter instances (GH-27828)
https://github.com/python/cpython/commit/0a145069e807fdafd1fa0315b9bc22da363d2d39


--

___
Python tracker 
<https://bugs.python.org/issue44953>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44953] Add vectorcall on operator.itemgetter and attrgetter objects

2022-02-10 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +29431
pull_request: https://github.com/python/cpython/pull/31265

___
Python tracker 
<https://bugs.python.org/issue44953>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44953] Add vectorcall on operator.itemgetter and attrgetter objects

2022-02-10 Thread Dennis Sweeney


Dennis Sweeney  added the comment:


New changeset 035414a878a772d1d293cdecdc4470bcce5e5d7a by Dennis Sweeney in 
branch 'main':
bpo-44953: Add newline at end of NEWS entry (GH-31265)
https://github.com/python/cpython/commit/035414a878a772d1d293cdecdc4470bcce5e5d7a


--

___
Python tracker 
<https://bugs.python.org/issue44953>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46717] Raising exception multiple times leaks memory

2022-02-10 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I reproduced as far back as Python 3.6 with this:

---
import gc

exc = Exception()
deltas = []

for i in range(2, 15):
ref1 = len(gc.get_objects())
for j in range(2**i):
try:
raise exc
except Exception:
pass
ref2 = len(gc.get_objects())
deltas.append(ref2 - ref1)

print(deltas)
# [4, 8, 16, 9, 64, 128, 256, 512, 1024, 2048, 4072, 8192, 16384]
---


Note that the memory does get freed up once the exception is deleted:

---
import gc

deltas = []

for i in range(2, 15):
ref1 = len(gc.get_objects())

exc = Exception()
for j in range(2**i):
try:
raise exc
except Exception:
pass
del exc  # <<<<<<<<<<<<<<<<<<<<<<<<<<<

ref2 = len(gc.get_objects())
deltas.append(ref2 - ref1)

print(deltas)
# [0, 0, 0, 0, 0, -14, 0, 0, 0, 0, -14, 0, 0]
---

--
nosy: +Dennis Sweeney, iritkatriel

___
Python tracker 
<https://bugs.python.org/issue46717>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44953] Add vectorcall on operator.itemgetter and attrgetter objects

2022-02-11 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue44953>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46615] Use-after-free by mutating set during set operations

2022-02-11 Thread Dennis Sweeney


Dennis Sweeney  added the comment:


New changeset 4a66615ba736f84eadf9456bfd5d32a94cccf117 by Dennis Sweeney in 
branch 'main':
bpo-46615: Don't crash when set operations mutate the sets (GH-31120)
https://github.com/python/cpython/commit/4a66615ba736f84eadf9456bfd5d32a94cccf117


--

___
Python tracker 
<https://bugs.python.org/issue46615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46730] Please consider mentioning property without setter when an attribute can't be set

2022-02-12 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Go ahead and open a PR -- it makes it easier to discuss particular changes.

Regarding backwards-compatibility, error messages improvements are fair game 
for Python 3.11, we just shouldn't backport them to earlier versions.

We can also consider including the type of the relevant object in the error 
messages.

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46730>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46615] Use-after-free by mutating set during set operations

2022-02-12 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +29473
pull_request: https://github.com/python/cpython/pull/31312

___
Python tracker 
<https://bugs.python.org/issue46615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34890] Support functools.partial in inspect.is*function() checks

2022-02-12 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

See https://bugs.python.org/issue46722 for a concern about this change.

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue34890>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46747] bisect.bisect/insort don't document key parameter

2022-02-14 Thread Dennis Sweeney


Dennis Sweeney  added the comment:


New changeset 96084f4256d2d523b0a4d7d900322b032326e3ed by Zackery Spytz in 
branch 'main':
bpo-46747: Add missing key parameters in the bisect docs (GH-31323)
https://github.com/python/cpython/commit/96084f4256d2d523b0a4d7d900322b032326e3ed


--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46747>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46747] bisect.bisect/insort don't document key parameter

2022-02-14 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +29485
pull_request: https://github.com/python/cpython/pull/31329

___
Python tracker 
<https://bugs.python.org/issue46747>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46747] bisect.bisect/insort don't document key parameter

2022-02-14 Thread Dennis Sweeney


Dennis Sweeney  added the comment:


New changeset 841c77d802e9ee8845fa3152700474021efe03fd by Dennis Sweeney in 
branch '3.10':
[3.10] bpo-46747: Add missing key parameters in the bisect docs (GH-31323) 
(GH-31329)
https://github.com/python/cpython/commit/841c77d802e9ee8845fa3152700474021efe03fd


--

___
Python tracker 
<https://bugs.python.org/issue46747>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46747] bisect.bisect/insort don't document key parameter

2022-02-14 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Thanks for the report, Stefan!
Thanks for the PR, Zackery!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46747>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46739] dataclasses __eq__ isn't logical

2022-02-14 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46739>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46730] Please consider mentioning property without setter when an attribute can't be set

2022-02-15 Thread Dennis Sweeney


[issue46730] Please consider mentioning property without setter when an attribute can't be set

2022-02-15 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Thanks for the PR!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46730>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46730] Please consider mentioning property without setter when an attribute can't be set

2022-02-17 Thread Dennis Sweeney


Dennis Sweeney  added the comment:


New changeset 9e06d03672547041239812efe4901c06da6cbd2f by Christian Heimes in 
branch 'main':
bpo-46730: Fix refleak and tighten NULL checks (GH-31389)
https://github.com/python/cpython/commit/9e06d03672547041239812efe4901c06da6cbd2f


--

___
Python tracker 
<https://bugs.python.org/issue46730>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46615] Use-after-free by mutating set during set operations

2022-02-18 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

It does look like there are some pickle situations that crash. Attached is a 
randomized crasher. I haven't done too much careful reasoning about it, but 
adding INCREFs everywhere seems to fix most of the issues.

--
Added file: https://bugs.python.org/file50631/picklecrasher.py

___
Python tracker 
<https://bugs.python.org/issue46615>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46730] Please consider mentioning property without setter when an attribute can't be set

2022-02-18 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +29562
pull_request: https://github.com/python/cpython/pull/31427

___
Python tracker 
<https://bugs.python.org/issue46730>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46802] Wrong result unpacking binary data with ctypes bitfield.

2022-02-19 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Possible duplicate of https://bugs.python.org/issue29753

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46802>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46823] Add LOAD_FAST__LOAD_ATTR_INSTACE_VALUE combined opcode

2022-02-21 Thread Dennis Sweeney


New submission from Dennis Sweeney :

See https://github.com/faster-cpython/ideas/discussions/291

--
messages: 413692
nosy: Dennis Sweeney
priority: normal
severity: normal
status: open
title: Add LOAD_FAST__LOAD_ATTR_INSTACE_VALUE combined opcode

___
Python tracker 
<https://bugs.python.org/issue46823>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46823] Add LOAD_FAST__LOAD_ATTR_INSTACE_VALUE combined opcode

2022-02-21 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
keywords: +patch
pull_requests: +29617
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31484

___
Python tracker 
<https://bugs.python.org/issue46823>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46848] Use optimized string search function in mmap.find()

2022-02-28 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
nosy: +Dennis Sweeney
nosy_count: 2.0 -> 3.0
pull_requests: +29749
pull_request: https://github.com/python/cpython/pull/31625

___
Python tracker 
<https://bugs.python.org/issue46848>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46848] Use optimized string search function in mmap.find()

2022-02-28 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

PR 31625 is an alternative proposal.

It uses the Crochemore and Perrin's Two-Way algorithm that @benrg references 
(see Objects/stringlib/fastsearch.h and 
Objects/stringlib/stringlib_find_two_way_notes.txt), and is 
platform-independent.

--

___
Python tracker 
<https://bugs.python.org/issue46848>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46891] Crash in ModuleType subclass with __slots__

2022-03-01 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Bisected to here:

c3f52b4d707a78eb342372a2be00f3eb846a05b9 is the first bad commit
commit c3f52b4d707a78eb342372a2be00f3eb846a05b9
Author: Mark Shannon 
Date:   Wed Jun 23 10:00:43 2021 +0100

bpo-44486: Make sure that modules always have a dictionary. (GH-26847)

* Make sure that modules always have a dictionary.

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46891>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46891] Crash in ModuleType subclass with __slots__

2022-03-01 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
nosy: +Mark.Shannon

___
Python tracker 
<https://bugs.python.org/issue46891>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46848] Use optimized string search function in mmap.find()

2022-03-01 Thread Dennis Sweeney


Dennis Sweeney  added the comment:


New changeset 6ddb09f35b922a3bbb59e408a3ca7636a6938468 by Dennis Sweeney in 
branch 'main':
bpo-46848: Use stringlib/fastsearch in mmap (GH-31625)
https://github.com/python/cpython/commit/6ddb09f35b922a3bbb59e408a3ca7636a6938468


--

___
Python tracker 
<https://bugs.python.org/issue46848>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46848] Use optimized string search function in mmap.find()

2022-03-01 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Thanks for the report!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> performance

___
Python tracker 
<https://bugs.python.org/issue46848>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46903] Crash when setting attribute with string subclass as the name (--with-pydebug)

2022-03-02 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

a8b9350964f43cb648c98c179c8037fbf3ff8a7d is the first bad commit
commit a8b9350964f43cb648c98c179c8037fbf3ff8a7d
Author: Mark Shannon 
Date:   Wed Oct 13 14:19:34 2021 +0100

bpo-45340: Don't create object dictionaries unless actually needed 
(GH-28802)

* Never change types' cached keys. It could invalidate inline attribute 
objects.

* Lazily create object dictionaries.

* Update specialization of LOAD/STORE_ATTR.

* Don't update shared keys version for deletion of value.

* Update gdb support to handle instance values.

* Rename SPLIT_KEYS opcodes to INSTANCE_VALUE.

------
nosy: +Dennis Sweeney, Mark.Shannon

___
Python tracker 
<https://bugs.python.org/issue46903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46823] Add LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE combined opcode

2022-03-02 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46823>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46935] import of submodule polutes global namespace

2022-03-05 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

This might be something that rapidfuzz can fix, rather than CPython. In 
whatever import process rapidfuzz uses, it populates sys.modules with a module 
named `Levenshtein` in addition to 'rapidfuzz.distance.Levenshtein'. You might 
be able to request that they change something there.

Python 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> m1 = set(sys.modules.keys())
>>> import numpy
>>> m2 = set(sys.modules.keys())
>>> import rapidfuzz
>>> m3 = set(sys.modules.keys())
>>> m2 - m1
{'posixpath', 'numpy.random._pcg64', 'numpy.fft._pocketfft_internal', 
'numpy.core._dtype', 'cython_runtime', 'numpy.random._sfc64', 'urllib', 
'numpy.core.einsumfunc', 'sre_parse', 'numpy.polynomial.laguerre', 
'numpy.fft._pocketfft', 'numpy.lib._iotools', 'numpy.core._exceptions', 
'numpy.random._pickle', 'numpy.lib.twodim_base', 'numpy.polynomial._polybase', 
'numpy.lib._datasource', 'copyreg', 'numpy.random._philox', '_ctypes', 
'numpy.core._ufunc_config', 'platform', 'numpy.lib.histograms', 
'numpy.lib.mixins', 'numpy.core._asarray', 'numpy.polynomial.legendre', 
'numpy.polynomial.polyutils', 'subprocess', 'fnmatch', 'numpy.ctypeslib', 
'ast', 'sre_compile', 'json.scanner', 'numpy.core.arrayprint', 'textwrap', 
'numpy.core.multiarray', 'datetime', 'inspect', 'numpy.core.function_base', 
'hmac', 'numpy.lib.utils', '_json', 'signal', 'numpy.core.machar', 
'numpy.ma.core', 'pathlib', 'numbers', 'numpy.core._methods', 
'numpy.lib.type_check', 'numpy.core.defchararray', 'numpy.core.getlimits', 'n
 umpy.lib.ufunclike', 'numpy.version', 'select', '_sre', 
'numpy.core._dtype_ctypes', 'numpy.lib.arrayterator', 'random', '_blake2', 
'numpy.fft', 'token', 'numpy.core._string_helpers', 'numpy', '_hashlib', 
'opcode', 'tokenize', 'numpy.random._bounded_integers', 'numpy.random.mtrand', 
'ctypes._endian', '_weakrefset', 'numpy.ma', 'numpy.lib.nanfunctions', 
'_random', 'numpy.lib.function_base', '_sha512', 'bisect', 
'numpy.core.records', 'numpy._globals', '_compat_pickle', 'urllib.parse', 
'numpy.random.bit_generator', 'numpy.linalg._umath_linalg', 
'numpy.core._add_newdocs_scalars', 'numpy.polynomial.hermite', 'base64', 
'numpy.linalg.linalg', 'numpy.core._multiarray_tests', '_cython_0_29_24', 
'hashlib', '_struct', 'numpy.lib.arraypad', 'numpy.core', 'msvcrt', 
'numpy.ma.extras', 'numpy.lib.index_tricks', '_locale', 'numpy.lib.shape_base', 
'numpy.compat._inspect', 'numpy.polynomial.hermite_e', 'pickle', 
'numpy._distributor_init', 'numpy.lib._version', '_datetime', 'secrets', 
'numpy.lib.polyno
 mial', 'numpy.core.numerictypes', '_ast', 'numpy.lib.scimath', '_winapi', 
'numpy.matrixlib.defmatrix', '_socket', 'numpy.core.shape_base', 
'numpy.lib.format', 'dis', 'numpy.core._multiarray_umath', 'weakref', 
'numpy.compat.py3k', 'json', 'numpy.core.umath', 'numpy.core.numeric', 
'numpy.core.memmap', 'sre_constants', 'numpy.compat', 
'numpy.core._add_newdocs', 'numpy.polynomial.chebyshev', 'math', 
'numpy.random._common', 'numpy.linalg', 'numpy.random', 're', 'threading', 
'numpy._pytesttester', '_bisect', 'collections.abc', 'socket', 
'numpy.lib.stride_tricks', 'linecache', 'numpy.lib', 'numpy.fft.helper', 
'numpy.core.fromnumeric', 'json.encoder', 'numpy.linalg.lapack_lite', 
'selectors', 

[issue46941] Bug or plug not removed (The operator "is")

2022-03-06 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

In the future, please copy and paste the relevant code and errors as text. 
Images of code are harder for screen-readers for the visually impaired, harder 
to copy-and-paste to verify, and are more likely to be perceived as spam.

Your code is essentially this:

>>> i = 0
>>> i is 0
:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
True

This warning isn't a "stub", it was intentionally added in GH-9642. The warning 
exists because comparing numbers with `is` is generally unsafe (numbers should 
be compared using `==` instead), and can lead to unpredictable results, 
especially if using a different Python implementation (e.g. PyPy or RustPython 
or Jython rather than CPython).

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46941>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46903] Crash when setting attribute with string subclass as the name (--with-pydebug)

2022-03-06 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +29833
pull_request: https://github.com/python/cpython/pull/31718

___
Python tracker 
<https://bugs.python.org/issue46903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45806] Cannot Recover From StackOverflow in 3.9 Tests

2022-03-07 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Should this be backported to make the 3.8 Buildbots happy?

--

___
Python tracker 
<https://bugs.python.org/issue45806>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46952] pip progress bar display bug

2022-03-07 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

pip is maintained externally at https://github.com/pypa/pip , so that is likely 
a better place to open an issue about pip.

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46952>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46952] pip progress bar display bug

2022-03-07 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46952>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39829] __len__ called twice in the list() constructor

2022-03-07 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Related to Matt's idea is https://bugs.python.org/issue43574

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue39829>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46896] add support for watching writes to selected dictionaries

2022-03-09 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

A curiosity: have you considered watching dict keys rather than whole dicts?

That way, changing global values would not have to de-optimize, only adding new 
global keys would.

Indexing into dict values array wouldn't be as efficient as embedding direct 
jump targets in JIT-generated machine code, but as long as we're not doing 
that, maybe watching the keys is a happy medium?

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46896>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46979] Spam

2022-03-10 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
components:  -Build
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
title: Master piece -> Spam
type: security -> 

___
Python tracker 
<https://bugs.python.org/issue46979>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46961] Caching/interning of small ints sometimes fails

2022-03-12 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I believe the issue is the usage of the x_divrem function.

x_divrem always returns fresh ints, never cached small ints. This behavior is 
relied upon in the long_true_divide function, as it mutates the returned 
quotient at the line """x->ob_digit[0] = low & ~(2U*mask-1U);""".

The other uses of x_divrem account for this when handling the *quotient*, but 
apparently missed checking for small ints in the *remainder*.

uses of x_divrem:
- long_divrem
- uses maybe_small_long on quotient
- doesn't check if remainder is small < oops
- long_rem
- throws away quotient
- doesn't check if remainder is small < oops
- long_true_divide
- modifies the quotient
- throws away remainder


Possible patches to fix it:

1) Modify long_divrem and long_rem to check for small remainders, in addition 
to the small-quotient checks they already do.
2) Modify x_divrem to check for small remainders, but still always return fresh 
quotients.
3) Modify x_divrem to return cached quotients and remainders, and modify 
long_true_divide to make a copy before mutating.

I'd lean towards #1, since that quotient check already exists.
In #2, the mismatch of checking/not checking between quotient/remainder would 
be confusing.
In #3, an extra int allocation gets added to integer true divide, which isn't 
ideal.

--
nosy: +Dennis Sweeney

___
Python tracker 
<https://bugs.python.org/issue46961>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46961] Caching/interning of small ints sometimes fails

2022-03-13 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
keywords: +patch
pull_requests: +29942
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31843

___
Python tracker 
<https://bugs.python.org/issue46961>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   4   5   6   >