New submission from Dennis Sweeney :
It would be nice to add the following to .gitignore, so that I can `./python -m
pip install [whatever]` without overwhelming the output of `git status`.
Lib/site-packages/*
!Lib/test/data/README.txt
--
messages: 415114
nosy: Dennis Sweeney
Change by Dennis Sweeney :
--
keywords: +patch
pull_requests: +29960
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/31862
___
Python tracker
<https://bugs.python.org/issu
Dennis Sweeney added the comment:
I made a copy/paste error, it should be:
Lib/site-packages/*
!Lib/site-packages/README.txt
--
___
Python tracker
<https://bugs.python.org/issue47
New submission from Dennis Sweeney :
list_resize is a long function that probably won't get inlined. But for the
vast majority of cases in list.append, we just need to check whether the list
is big enough (not whether it's small enough, or whether it's null or the wrong
typ
Change by Dennis Sweeney :
--
keywords: +patch
pull_requests: +29962
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/31864
___
Python tracker
<https://bugs.python.org/issu
Dennis Sweeney added the comment:
The attached _PyList_AppendTakeRef.diff has the ceval.c, but this
implementation:
int
_PyList_AppendTakeRef(PyListObject *self, PyObject *newitem)
{
assert(self != NULL && newitem != NULL);
assert(PyList_Check(self));
Py_ssi
Change by Dennis Sweeney :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Dennis Sweeney added the comment:
This is because i is not captured by the function definition. `lambda x: x**i`
always makes the "input to the ith power" function, never the "input to the 3rd
power" function, even if i happens to be 3 right now.
Consider replacing `
Dennis Sweeney added the comment:
There's an FAQ entry here:
https://docs.python.org/3/faq/programming.html#why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result
--
___
Python tracker
<https://bugs.py
Dennis Sweeney added the comment:
https://bugs.python.org/issue45469 is similar. Thanks for the report, but I'll
go ahead and close this.
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python t
Dennis Sweeney added the comment:
indeed, bisected to
2cf7f865f099db11cc6903b334d9c376610313e8 is the first bad commit
commit 2cf7f865f099db11cc6903b334d9c376610313e8
Author: Christian Heimes
Date: Tue Mar 15 11:41:04 2022 +0200
bpo-46587: Skip tests if strftime does not support glibc
Dennis Sweeney added the comment:
Would there be substantial benefit of a new feature over using the existing
feature and then calling str.replace()?
>>> b = b'abracadabra'
>>> "0x" + b.hex(":").replace(":", ", 0x"
Dennis Sweeney added the comment:
In particular, it's one ascii character:
>>> b'abracadabra'.hex('😋')
ValueError: sep must be ASCII.
I wouldn't be completely opposed to allowing longer strings, but since there
are easy enough ways to do it
New submission from Dennis Sweeney :
There was a discussion here:
https://github.com/faster-cpython/ideas/discussions/269
Checking for whether the assignment target is the left-hand side, rather than
just checking for the right refcount, is more stable and reduces the number of
Change by Dennis Sweeney :
--
keywords: +patch
pull_requests: +30058
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/31318
___
Python tracker
<https://bugs.python.org/issu
Change by Dennis Sweeney :
--
type: security -> performance
___
Python tracker
<https://bugs.python.org/issue47053>
___
___
Python-bugs-list mailing list
Un
Dennis Sweeney added the comment:
New changeset ac8308d3eaf2526318c1bbf13d4a214fd24605d2 by Pieter Eendebak in
branch 'main':
bpo-47005: Improve performance of bytearray_repeat and bytearray_irepeat
(GH-31856)
https://github.com/python/cpython/commit/ac8308d3eaf2526318c1bbf13d4a21
Dennis Sweeney added the comment:
Thanks for the contribution -- that's a really nice speedup.
--
___
Python tracker
<https://bugs.python.org/is
Change by Dennis Sweeney :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Dennis Sweeney added the comment:
I'd bet we could add a couple of utility functions that could be used in
multiple places, to keep the "trick" all in one place. Something like
void
_PyBytes_RepeatInPlace(char **buffer, size_t start_len, size_t end_len)
{
// Repeatedly dou
Dennis Sweeney added the comment:
I profiled dict[str, int](a=1, b=2), and it looks like a decent chunk of time
comes from PyUnicode_New as used by PyObject_SetAttrString.
You could also try replacing PyObject_SetAttrString with PyObject_SetAttr and
adding "__orig_class__" to
Dennis Sweeney added the comment:
In bpo-47067, there was concern about the addition of the makefile target from
PR 31637:
regen-global-objects: regen-deepfreeze
After a new `&_Py_ID(__orig_class__)` is added to Objects/genericaliasobject.c,
running `make regen-global-objects` st
Dennis Sweeney added the comment:
New changeset 1ea055bd53ccf976e88018983a3c13447c4502be by penguin_wwy in branch
'main':
bpo-47067: Optimize calling GenericAlias objects (GH-31996)
https://github.com/python/cpython/commit/1ea055bd53ccf976e88018983a3c13
Dennis Sweeney added the comment:
The help text says this:
>>> help(list.index)
Help on method_descriptor:
index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
Dennis Sweeney added the comment:
New changeset bd1cf6ecee76bcdce87b4f69567b95756ecf5a4c by Kumar Aditya in
branch 'main':
bpo-47012: speed up iteration of bytes and bytearray (GH-31867)
https://github.com/python/cpython/commit/bd1cf6ecee76bcdce87b4f69567b95756ecf5a4c
-
Dennis Sweeney added the comment:
Possible duplicate of https://bugs.python.org/issue44080
--
nosy: +Dennis Sweeney
___
Python tracker
<https://bugs.python.org/issue47
Change by Dennis Sweeney :
--
pull_requests: +30202
pull_request: https://github.com/python/cpython/pull/32122
___
Python tracker
<https://bugs.python.org/issue47
Dennis Sweeney added the comment:
New changeset c23ddf5ec229b7302437a1cf32d366df5cc5b837 by Pieter Eendebak in
branch 'main':
bpo-47116: use _PyLong_FromUnsignedChar instead of PyLong_FromLong (GH-32110)
https://github.com/python/cpython/commit/c23ddf5ec229b7302437a1cf32d366
Dennis Sweeney added the comment:
Thanks!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Dennis Sweeney :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue47132>
___
___
Python-bugs-list mailing list
Unsubscribe:
Dennis Sweeney added the comment:
New changeset 850687df47b03e98c1433e6e70e71a8921eb4454 by Pieter Eendebak in
branch 'main':
bpo-47070: Add _PyBytes_Repeat() (GH-31999)
https://github.com/python/cpython/commit/850687df47b03e98c1433e6e70e71a
Dennis Sweeney added the comment:
New changeset 788154919c2d843a0a995994bf2aed2d074761ec by Dennis Sweeney in
branch 'main':
bpo-47053: Refactor BINARY_OP_INPLACE_ADD_UNICODE (GH-32122)
https://github.com/python/cpython/commit/788154919c2d843a0a995994bf2aed
Dennis Sweeney added the comment:
see also https://bugs.python.org/issue44931
--
nosy: +Dennis Sweeney
___
Python tracker
<https://bugs.python.org/issue47
Dennis Sweeney added the comment:
Out of curiosity, what are the use cases for adding nodes after get_ready has
already produced nodes?
I was wondering about avoiding the need to call prepare() by having it
automatically do the cycle-checking at the first get_ready() call and then
raising
Dennis Sweeney added the comment:
> depends on an already-yielded node
I mean "creates a new not-yet-yielded dependency for an already-yielded node".
--
___
Python tracker
<https://bugs.pytho
Change by Dennis Sweeney :
--
pull_requests: +30310
pull_request: https://github.com/python/cpython/pull/32239
___
Python tracker
<https://bugs.python.org/issue47
Dennis Sweeney added the comment:
https://docs.python.org/3/library/inspect.html#inspect.isfunction says this:
"""
inspect.isfunction(object)
Return True if the object is a Python function, which includes functions
created by a lambda expression.
"""
Emphasis o
Dennis Sweeney added the comment:
I believe this is a duplicate of this issue: https://bugs.python.org/issue45542
--
nosy: +Dennis Sweeney
___
Python tracker
<https://bugs.python.org/issue47
Change by Dennis Sweeney :
--
title: Bug or bad performance -> chained comparisons slower than using `and`
___
Python tracker
<https://bugs.python.org/issu
Dennis Sweeney added the comment:
Feel free to comment on that issue if you have any ideas about how to address
the concerns there.
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Using multiple comparison operators can cause perfor
Dennis Sweeney added the comment:
https://bugs.python.org/issue47221 was opened as a duplicate of this.
Unless there are any new ideas for getting around the concerns here, I think
this can be closed.
--
status: open -> pending
___
Python trac
Dennis Sweeney added the comment:
For reference, chaining is about 1.18x slower in this microbenchmark on GCC:
./python -m pyperf timeit -s "x = 100" "if 10 < x < 30: print('no')"
--duplicate=10
.
Mean +- std dev: 21.3 ns +- 0.2 ns
.
New submission from Dennis Sweeney :
What error message?
--
nosy: +Dennis Sweeney
___
Python tracker
<https://bugs.python.org/issue47226>
___
___
Python-bug
Dennis Sweeney added the comment:
Buildbots are passing, so I'm closing this. Thanks for the catch and fix!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.pyth
Dennis Sweeney added the comment:
Possibly related to the new atomic grouping support from GH-31982?
--
nosy: +Dennis Sweeney, serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue47
Dennis Sweeney added the comment:
I don't think changing @wraps is what you want. Even if you manually set
`wrapper.__isabstractmethod__ = False`, you won't reach `print('f is
called!')`, since f() is overridden by the child. And if you do that, the ABC
wouldn't
Dennis Sweeney added the comment:
> the ABC wouldn't have any abstract methods,
I was wrong about this since the @abstractmethod decorator adds 'f' to the
__abstractmethods__ set of the ABC, but the rest of my comment stands.
--
Dennis Sweeney added the comment:
Can you explain why you think this is the wrong behavior, and what operating
system and version of Python you're using?
from https://docs.python.org/3/library/time.html#time.perf_counter
Return the value (in fractional seconds) of a performance co
Dennis Sweeney added the comment:
Did you try adding updated=()?
@functools.wraps(_internal_main_operation, updated=())
def external_main_operation(self, *args, **kwargs):
--
___
Python tracker
<https://bugs.python.org/issue43
Dennis Sweeney added the comment:
> other attributes will not be copied
The signature of wraps() is
wraps(wrapped, assigned=('__module__', '__name__', '__qualname__',
'__doc__', '__annotations__'), updated=('__dict__',
Dennis Sweeney added the comment:
typing.cast doesn't actually do anything, it only exists as a hint for
type-checkers.
As William noted, using the 3-argument type(...) as you showed will only return
a type, not a mcs.
I think you may want super().__new__(mcs, name, bases, name
Dennis Sweeney added the comment:
It's well-known that regular expressions can take exponential time. You can try
searching this bug tracker for "re exponential". Common suggestions are to try
a third-party module, or to write better regexes where possible. Note that the
im
Dennis Sweeney added the comment:
I ran into the same issue on Windows 10 and git bisected it to the same first
bad commit, fcb55c0037baab6f98f91ee38ce84b6f874f034a
The issue persists after rm .\Parser\__pycache__\*
My .\Tools directory has no __pycache__.
--
nosy: +Dennis Sweeney
Dennis Sweeney added the comment:
I notice this in _bootstrap_external.py: the magic number did not get changed,
only the comment:
# Python 3.10a2 3433 (RERAISE restores f_lasti if oparg != 0)
# Python 3.10a6 3434 (PEP 634: Structural Pattern Matching)
# Python 3.10a7 3435 Use
Change by Dennis Sweeney :
--
pull_requests: +23913
pull_request: https://github.com/python/cpython/pull/25172
___
Python tracker
<https://bugs.python.org/issue27
Dennis Sweeney added the comment:
I could not successfully build even with deletion of __pycache__ in subfolders.
I finally got the build to succeed after changing the magic number, so I opened
GH-25069.
--
___
Python tracker
<ht
Dennis Sweeney added the comment:
Correction: I opened GH-25172
--
___
Python tracker
<https://bugs.python.org/issue43719>
___
___
Python-bugs-list mailin
Change by Dennis Sweeney :
--
nosy: +Dennis Sweeney
nosy_count: 1.0 -> 2.0
pull_requests: +23962
pull_request: https://github.com/python/cpython/pull/25225
___
Python tracker
<https://bugs.python.org/issu
Dennis Sweeney added the comment:
Looks like we both opened PRs in the same minute.
The MAGIC constant didn't get updated, but perhaps that can just be included in
the Minor Corrections PR.
I'd bet a CI check could be added to check that if the opcodes change th
Dennis Sweeney added the comment:
I can open a PR this evening, but I think this is close to the issue:
PyIter_Next() already silences StopIteration, so checking for it afterward
fails.
diff --git a/Objects/iterobject.c b/Objects/iterobject.c
index f0c6b79917..95f4659dc9 100644
--- a
Change by Dennis Sweeney :
--
keywords: +patch
pull_requests: +23976
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25238
___
Python tracker
<https://bugs.python.org/issu
Dennis Sweeney added the comment:
That change fixes that bug, but I think there may be another bug involving when
a custom async iterator is passed rather than an async generator. This is at
the limit of my knowledge, so any guidance would be appreciated. The test I
wrote in the PR
Dennis Sweeney added the comment:
A bug was reported in anext(): https://bugs.python.org/issue43751
--
nosy: +Dennis Sweeney
___
Python tracker
<https://bugs.python.org/issue31
Dennis Sweeney added the comment:
Okay, the PR should fix those problems now.
I am still apprehensive about whether all of the corner cases are covered, so
reviews are welcome, as are suggestions of more test cases.
--
___
Python tracker
<ht
Dennis Sweeney added the comment:
Running kill_subprocess.py on Windows 10, I get these results:
Python 3.7.2 (tags/v3.7.2:9a3ffc0492)
- raises NotImplementedError in base_events.py, _make_subprocess_transport
Python 3.8.2 (tags/v3.8.2:7b3ab59)
- Success
Python 3.9.0 (tags/v3.9.0
Change by Dennis Sweeney :
--
nosy: +Dennis Sweeney
nosy_count: 8.0 -> 9.0
pull_requests: +24304
pull_request: https://github.com/python/cpython/pull/25584
___
Python tracker
<https://bugs.python.org/issu
Dennis Sweeney added the comment:
I opened PR 25584 to fix this current behavior:
>>> v
Traceback (most recent call last):
File "", line 1, in
NameError: name 'v' is not defined. Did you mean: 'id'?
>>> vv
Traceback (most recent call last)
Dennis Sweeney added the comment:
Some research of other projects:
LLVM [1][2]
---
- Compute Levenshtein
- Using O(n) memory rather than O(n^2)
- Uses UpperBound = (len(typo) + 2) // 3
GCC [3]
---
- Uses Damerau-Levenshtein distance
- Counts transpositions like "
Change by Dennis Sweeney :
--
pull_requests: +24466
pull_request: https://github.com/python/cpython/pull/25776
___
Python tracker
<https://bugs.python.org/issue38
Dennis Sweeney added the comment:
PR 25776 is a work in progress for what it might look like to do a few things:
- Make case-swaps half the cost of any other edit
- Refactor Levenshtein code to not use memory allocator, and to bail early on
no match.
- Add comments to Levenshtein distance
New submission from Dennis Sweeney :
After bpo-38530, I get this in the python shell:
Python 3.10.0b1 (tags/v3.10.0b1:ba42175, May 3 2021, 20:22:30) [MSC v.1928 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more info
Change by Dennis Sweeney :
--
nosy: +pablogsal
___
Python tracker
<https://bugs.python.org/issue44026>
___
___
Python-bugs-list mailing list
Unsubscribe:
Dennis Sweeney added the comment:
I'm not sure if this helps, but this is the relevant tree of callers:
suggestions.c: _Py_Offer_Suggestions() (the expected behavior) is only
referenced by
pythonrun.c: print_exception(), which is only referenced by
pythonrun.c: print_exception_recu
Dennis Sweeney added the comment:
PyErr_Display() grabs the current sys.stderr and writes to that, but it looks
like IDLE never gets to call PyErr_Display().
--
___
Python tracker
<https://bugs.python.org/issue44
Dennis Sweeney added the comment:
It looks like Lib/idlelib/run.py : print_exception() re-implements the
traceback, rather than relying on sys.excepthook
--
___
Python tracker
<https://bugs.python.org/issue44
Dennis Sweeney added the comment:
Indeed, this change enables the feature for IDLE, though I'm not sure what it
breaks.
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index 07e9a2bf9c..319b16f311 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -569,7 +569,7 @@ def ru
Dennis Sweeney added the comment:
Another idea: do what test_exceptions() does:
try:
f()
except NameError as exc:
with support.captured_stderr() as err:
sys.__excepthook__(*sys.exc_info())
self.assertNotIn("a1", er
Dennis Sweeney added the comment:
I unfortunately don't have the time/internet access this week to do a PR.
--
___
Python tracker
<https://bugs.python.org/is
Dennis Sweeney added the comment:
I think the docs are correct. For example:
>>> import subprocess
>>> subprocess.run("ls", check=True, stdout=subprocess.PIPE).stdout
>>> subprocess.check_output("ls")
--
nosy: +Dennis Sweeney
___
New submission from Dennis Sweeney :
Problem: Random.choices() never returns sequence entries at large
odd indices. For example:
>>> import random
>>> [x % 2 for x in random.choices(range(2**53), k=20)]
[0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1]
&
Dennis Sweeney added the comment:
Your suspicion looks correct, random() is faster:
.\python.bat -m pyperf timeit -s "from random import choices"
"choices(range(100), k=10_000)"
Before int_choices.diff: Mean +- std dev: 1.49 ms +- 0.09 ms
After int_choices.diff: Mean
Dennis Sweeney added the comment:
I tried some debugging code:
diff --git a/Python/ceval.c b/Python/ceval.c
index f745067069..a8668dbac2 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4864,6 +4864,18 @@ get_exception_handler(PyCodeObject *code, int index)
return res
Change by Dennis Sweeney :
--
pull_requests: +24662
pull_request: https://github.com/python/cpython/pull/26012
___
Python tracker
<https://bugs.python.org/issue40
Dennis Sweeney added the comment:
How are you trying to start the shell? Does "shell window" mean IDLE? What
operating system are you using? What do you mean by "it glitches"?
--
nosy: +Dennis Sweeney
___
Python tracker
<
Dennis Sweeney added the comment:
I'm getting the following FutureWarning on a certain regular expression. I
think it just needs "[]" to become "\[\]".
0:05:36 load avg: 0.00 [ 53/427] test_check_c_globals
...\Tools\c-analyzer\c_common\tables.py:236: FutureWarning
New submission from Dennis Sweeney :
This patch ensures keyword-passing happens in linear time, fulfilling the
26-year-old TODO comment in ceval.c:
XXX speed up searching for keywords by using a dictionary
from time import perf_counter
from itertools import repeat
def bench(N):
reps
Change by Dennis Sweeney :
--
keywords: +patch
pull_requests: +24817
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26200
___
Python tracker
<https://bugs.python.org/issu
Dennis Sweeney added the comment:
Good catch -- with interning, the cutoff is more like 20-50, so it's probably
not worth optimizing for.
Before:
1 --> 1.67e-07
2 --> 1.77e-07
3 --> 1.90e-07
4 --> 2.05e-07
5 --> 2.14e-07
6 --> 2.35e-07
7 --> 2.51e-07
8 --&g
Dennis Sweeney added the comment:
How is proposed_function("abcd", max_repeat=3) any different from what you can
currently spell as combinations("aaabbbcccddd") ? Or, more generally,
def proposed_function(it, repeats)
repeated = chain.from_iterable([x] * repeat for
Dennis Sweeney added the comment:
The parser rejects this ambiguity and requires parentheses:
[
xxx
for item in collection
if (xxx := mutator(item)) is not None
]
Example ambiguity:
>>> [x for item in "abcdefabc" if x := item.upper() not in "ABC"
Dennis Sweeney added the comment:
Being in different modules is irrelevant. Attribute names that start with
double underscores and don't end with double underscores are "mangled" by the
compiler to include the class name as well:
>>> class MyClass:
.
Dennis Sweeney added the comment:
An attribute name starting with a single underscore is just a warning to users
of your code that "this attribute is supposed to be private, access it at your
own risk."
Everything below is from
https://docs.python.org/3/tutorial/classes.html
New submission from Dennis Sweeney :
Anecdotally, a few people I've talked to have expected that match-case
statements would improve performance in the same way that switch-cases
sometimes do in C-like languages. While this is impossible in general without
changing semantics (since
Dennis Sweeney added the comment:
At first I thought of matches with only the int/str/None cases and then I saw
the easy generalization, but yeah, each contiguous block seems better.
One solution to the code hashability/lookup speed apparent dilemma: writing the
equivalent of this in C
Dennis Sweeney added the comment:
I agree that we should benchmark for what the value of "two" should be ;) .
Maybe only match statements with >=20 consecutive simple cases end up being
worth it. I would assume that if "case 1, case 2, ..., case 20" are all in a
row
Dennis Sweeney added the comment:
FWIW PEP 603 includes a graph (Figure 2) of dict.get versus hamt.get
performance as the mappings grow, and it seems the hamt is roughly 1.4x slower
on inputs of sizes between 10 and 1000.
--
___
Python tracker
Dennis Sweeney added the comment:
Very interesting -- that is shorter than I thought also!
If we really wanted to optimize the tar out of this, we could probably find a
way to re-use just the PyDictKeysObject to find the index into a C-array of
integer jump targets and not have to worry
Dennis Sweeney added the comment:
Hi Brandt,
I would welcome your collaboration/mentorship in whatever capacity makes sense.
I sent an email to bra...@python.org from sweeney.dennis...@gmail.com.
--
___
Python tracker
<https://bugs.python.
Dennis Sweeney added the comment:
>From https://devguide.python.org/compiler/#source-code-to-ast:
> Basic blocks themselves are a block of IR that has a single entry point but
> possibly multiple exit points.
In particular, compile.c's label_exception_targets has the assert
Dennis Sweeney added the comment:
For some prior art,
https://www.wolframalpha.com/input/?i=%28-8%29+%5E+%281%2F3%29 says it defaults
to using "the principal root" over "the real-valued root"
Also, I think the relevant property is that the exponent is not an integer;
b
101 - 200 of 516 matches
Mail list logo