[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue42024] Exception ignored in: .remove at 0x7f6a325f2ea0>

2020-10-13 Thread jayesh


jayesh  added the comment:

Dear Team,

are you sure if we upgrade to python 3.8.6 then we will not get these warnings?

For 3.5.4, if this bug is fixed then why i am getting these warnign messages?.

Thanks

--
status: pending -> open

___
Python tracker 

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



[issue42031] os.makedirs() introduces high memory usage for explorer.exe

2020-10-13 Thread Kevin Kuan


New submission from Kevin Kuan :

Hi,
I would like to report bug for os.makedirs().
I am running this script on Windows 10 1909 (most win10 work), python 3.8.1.

 
os.makedirs() is making explorer.exe huge amount of memory and crashing the 
system after only 3 hours.
After changing that line to subprocess.run('mkdir ...') memory usage is reduced 
significantly.After changing all shutil functions as well, memory usage will 
not grow. 

(This is my first time community contribution. If anything, please let me know.)
Kevin Kuan 
(kevin.kuan.tr...@gmail.com)


---script.txt--
import time
import logging
import uuid
import subprocess

REPEAT = 10

def new_target_folder():
TARGET_BASE,
str(uuid.uuid4().hex)
)
os.makedirs(target)
return target


def delete_folder(target):
if os.path.exists(target):
shutil.rmtree(target)



def copy_samples(target):
shutil.copytree(
SOURCE_FOLDER, 
os.path.join(target, 'file_copy_clean_samples')


def copy_file_test():
for i in range(REPEAT):
t = new_target_folder()
copy_samples(t)
delete_folder(t)

--after.txt--
import os
import shutil
import time
import logging
import uuid
import subprocess

REPEAT = 10

SOURCE_FOLDER = os.path.abspath(
os.path.join(
__file__,
'..',
'..',
'_VolumeTestSamples',
'file_copy_clean_samples',
)
)

TARGET_BASE = os.path.join(
os.environ['USERPROFILE'],
r'Desktop',
r'sample_file_copy',
str(uuid.uuid4().hex)
)

PAUSE = 1


def run_for_one_week(func, pause):
time_start = time.time()
while True:
time_now = time.time()
logging.debug('{}'.format(time_now))
if time_now - time_start > 1 * 7 * 24 * 60 * 60:
break
func()
time.sleep(pause)


def new_target_folder():
target = os.path.join(
TARGET_BASE,
str(uuid.uuid4().hex)
)
subprocess.run(
['mkdir', target],
shell=True
)
return target


def delete_folder(target):
if os.path.exists(target):
subprocess.run(
['rmdir', '/s', '/q', target],
shell=True
)


def copy_samples(target):
subprocess.run(
['echo', 'D', '|', 'xcopy', '/s', '/y', SOURCE_FOLDER, target],
shell=True
)


def copy_file_test():
for i in range(REPEAT):
t = new_target_folder()
print (t)
copy_samples(t)
delete_folder(t)


if __name__ == '__main__':
r = logging.getLogger()
r.setLevel(logging.DEBUG)
run_for_one_week(copy_file_test, PAUSE)

--
components: Windows
files: Image20201014125025.png
messages: 378603
nosy: kevin.kuan.trend, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.makedirs() introduces high memory usage for explorer.exe
versions: Python 3.8
Added file: https://bugs.python.org/file49519/Image20201014125025.png

___
Python tracker 

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



[issue38912] test_asyncio altered the execution environment

2020-10-13 Thread Justin Arthur


Justin Arthur  added the comment:

The "'NoneType' object has no attribute 'close'" error is likely caused by a 
race against the loop calling the test protocol object's connection_made 
callback. I was able to reproduce this case occasionally on macOS and it's 
likely platform-agnostic. Given server/connection cleanup isn't context-managed 
or finally-driven on the affected tests, raising the NoneType error will skip 
cleanup and we see additional exceptions from unclosed networking components 
being garbage collected.

Tests using this test protocol pattern were either waiting for the callback 
already or were waiting on network i/o that happens long after connection 
establishment with the exception of:
- `test_create_server_ssl_verified`
- `test_create_unix_server_ssl_verified`

PR 22691 ensures those two tests wait for the connect callbacks as well.

This may not address the env changed error from recent msg378481, as the 
initial error is not necessarily disclosed in that log.

--

___
Python tracker 

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



[issue38912] test_asyncio altered the execution environment

2020-10-13 Thread Justin Arthur


Change by Justin Arthur :


--
nosy: +JustinTArthur
nosy_count: 5.0 -> 6.0
pull_requests: +21662
pull_request: https://github.com/python/cpython/pull/22691

___
Python tracker 

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



[issue42023] Argparse: Add a "display" arg

2020-10-13 Thread paul j3


paul j3  added the comment:

I'm not following this request either, especially the colored part.

However, I can imagine adding a variable that gives the user full control over 
the action-invocation.  In:

argparse.HelpFormatter._format_action_invocation method.

Currently it accepts the metavar (but not the tuple version) for a positional, 
but for optionals constructs:

  -s ARGS, --long ARGS

This can be quite long and ugly if the ARGS is a long choices, or there are 
many flag alternatives.  A number of SO users have asked for something simpler, 
usually with just on flag or

  -s, --long ARGS

There may even be a bug/issue(s) related to this already.

--

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread Tim Peters


Tim Peters  added the comment:

> There's no discomfort at all to me if, e.g., it stored
> 32-bit counts and is indexed by the last 6 bits of the
> character.  That's a measly 256 bytes in all.

Or, for the same space, 16-bit counts indexed by the last 7 bits. Then there's 
no aliasing for 7-bit ASCII, which is still very common in my world ;-)  
Needles over 64K characters aren't.

Which is a weird rule of thumb that's served me well, although for no solid 
reason I can detect:  when faced with a universe of tradeoff possibilities for 
which it appears impossible to get a handle on "the typical" case, optimize for 
_your_ cases. Then at least one user will be delighted in the end :-)

--

___
Python tracker 

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



[issue42023] Argparse: Add a "display" arg

2020-10-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> and the metavar arg isn't really helpful.

Is your issue with *metavar* that it changes the help() output in two places?

--

___
Python tracker 

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



[issue41904] datetime.datetime.today makes no sense and should be removed

2020-10-13 Thread Hassan Abouelela


Hassan Abouelela  added the comment:

> "How long is it until Christmas?" the answer should be different if I ask on 
> one minute past midnight on December 24 or one minute to midnight.

No disagreement there, but that doesn't change based on having the current 
precise time (the current implementation) vs the start of the current day (my 
recommendation), especially if you are just calculating the difference in days. 
In both cases, running it one minute before midnight would return the 23rd, 
running it one minute after would return the 24th.

The only difference between both is that a direct subtraction from the 
beginning of the day, with the current implementation, would result in 
one-point-something days, instead of one day. If that is the case, what is the 
point of having datetime.today? It should be, like the original issue 
suggested, phased out.

The benefit doesn't lie there, rather it lies in having direct access to 
date.today in a datetime format, so you can perform math on it with datetime 
objects. This, in my opinion, would be more consistent with other languages, 
and more importantly would make datetime.today logical, as it would be 
date.today in datetime form, instead of datetime.now.

> many (maybe a majority) of uses of datetime.today are conceptually better as 
> date.today, but not all of them.

In what cases would having the current time be better? Should those cases 
instead use datetime.now for legibility?

--

___
Python tracker 

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



[issue41939] 3.9.0 test_site warning: "urllib.requests._opener was modified by test_site"

2020-10-13 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the fix, Victor.

Sometime after filing this, I remembered that we had seen a similar problem 
some years ago and found bpo-21572 in which I had changed Lib/site.py to no 
longer use a release-dependent URL for the license file - which is why the 
check to skip if on a pre-release had been added previously to 
test_license_exists_at_url. So I should have removed the skip in test_site at 
the same time as it is no longer needed and hides problems like this until the 
final release.  PR 22688 and its backports remove the skip.

--

___
Python tracker 

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



[issue41939] 3.9.0 test_site warning: "urllib.requests._opener was modified by test_site"

2020-10-13 Thread miss-islington


miss-islington  added the comment:


New changeset 8b4642d3288e187faad24283c949ecf53fecad5b by Miss Skeleton (bot) 
in branch '3.8':
bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688)
https://github.com/python/cpython/commit/8b4642d3288e187faad24283c949ecf53fecad5b


--

___
Python tracker 

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



[issue41939] 3.9.0 test_site warning: "urllib.requests._opener was modified by test_site"

2020-10-13 Thread miss-islington


miss-islington  added the comment:


New changeset 881a13cad534cf3fe4474579c22235a15d3ba27b by Miss Skeleton (bot) 
in branch '3.9':
bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688)
https://github.com/python/cpython/commit/881a13cad534cf3fe4474579c22235a15d3ba27b


--

___
Python tracker 

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



[issue42029] Remove dynload_dl.c

2020-10-13 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 0cafcd3c56c9475913d8d4fd0223c297dbb70ac6 by Kevin Adler in branch 
'master':
closes bpo-42029: Remove dynload_dl (GH-22687)
https://github.com/python/cpython/commit/0cafcd3c56c9475913d8d4fd0223c297dbb70ac6


--
nosy: +benjamin.peterson
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue41939] 3.9.0 test_site warning: "urllib.requests._opener was modified by test_site"

2020-10-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21660
pull_request: https://github.com/python/cpython/pull/22689

___
Python tracker 

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



[issue41904] datetime.datetime.today makes no sense and should be removed

2020-10-13 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

On Wed, Oct 14, 2020 at 12:45:55AM +, Damian Yurzola wrote:

> And you also see people doing date math on datetime.date.today which 
> will result in different answers through out the day.

Yes? Is this a problem? If I ask the question "How long is it until 
Christmas?" the answer should be different if I ask on one minute past 
midnight on December 24 or one minute to midnight.

I daresay that you are correct that many (maybe a majority) of uses of 
datetime.today are conceptually better as date.today, but not all of 
them.

> I like HassanAbouelela's idea that datetime.datetime.today should 
> return an arbitrary fixed time rather than an arbitrary variable time.

But it's not an arbitrary variable time. It is just a high-resolution 
(down to the microsecond) version of "today", instead of the 
low-resolution (down to a single day) date.today.

--

___
Python tracker 

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



[issue41939] 3.9.0 test_site warning: "urllib.requests._opener was modified by test_site"

2020-10-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21661
pull_request: https://github.com/python/cpython/pull/22690

___
Python tracker 

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



[issue41939] 3.9.0 test_site warning: "urllib.requests._opener was modified by test_site"

2020-10-13 Thread Ned Deily


Ned Deily  added the comment:


New changeset 6a48518e8dac3521ff387ee67cdf33783114a257 by Ned Deily in branch 
'master':
bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688)
https://github.com/python/cpython/commit/6a48518e8dac3521ff387ee67cdf33783114a257


--

___
Python tracker 

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



[issue27351] Update ConfigParser doc: accepts iterables, not just lists

2020-10-13 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
title: Unexpected ConfigParser.read() behavior when passed fileobject -> Update 
ConfigParser doc: accepts iterables, not just lists
versions:  -Python 2.7

___
Python tracker 

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



[issue36439] Inconsistencies with datetime.fromtimestamp(t) when t < 0

2020-10-13 Thread Dobatymo


Dobatymo  added the comment:

> I've encountered an issue on anaconda python on windows 10 v1909 which I 
> suspect is related. It looks like no dates in 1970 can be converted to 
> datetime.timestamp():

Yeah... there is more related weirdness going on.

>>> datetime(1970, 1, 3).astimezone(timezone.utc)
datetime.datetime(1970, 1, 2, 16, 0, tzinfo=datetime.timezone.utc)
>>> datetime(1970, 1, 2).astimezone(timezone.utc)
Traceback (most recent call last):
  File "", line 1, in 
OSError: [Errno 22] Invalid argument
>>> datetime(1970, 1, 1, 16, 0, tzinfo=timezone.utc)
datetime.datetime(1970, 1, 1, 16, 0, tzinfo=datetime.timezone.utc)

--
nosy: +Dobatymo

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread Tim Peters


Tim Peters  added the comment:

Dennis, I'm delighted that the timing harness pointed out an actual glitch, and 
that it was so (seemingly) straightforward to identify the algorithmic cause. 
This gives me increased confidence that this project can be pushed to adoption, 
and your name will be hallowed in Python's history :-)

I have no problem with increasing the constant space. Fredrik was Python's 
Unicode pioneer too, so was naturally repelled by any scheme that required 
additional space proportional to the alphabet size. The "Bloom filter" is the 
tiny bit left of Daniel Sunday's algorithm, which actually has no such thing 
;-) Along the lines you suggested, Sunday precomputes a vector indexed by 
characters, each entry giving the distance to that character's rightmost index 
in the needle.  The "Bloom filter" throws that vector away and only saves 
hashes of the indices where the vector holds its maximum possible value.

Note that there's nothing magical about "right to left" in Sunday's algorithm 
(or, really, in our current use of the Bloom filter). Characters can be 
compared in any order, and when there's a mismatch, the skip vector can be 
indexed by the character one beyond the search window to often find a decent 
amount to skip.  Indeed, in apps where the expected frequency of characters is 
known, Sunday's algorithm is often adapted to compare the least-frequently 
expected needle character first.

The downside isn't really the space, but that stack space is uninitialized 
trash. Initializing it to a known value increases preprocessing overhead, 
albeit independent of needle length. So the relative overhead is higher the 
shorter the needle.

I agree expanding it beyond the tiny bit vector is likely to be significantly 
helpful.  There's no discomfort at all to me if, e.g., it stored 32-bit counts 
and is indexed by the last 6 bits of the character.  That's a measly 256 bytes 
in all.

It's also possible that a more capable "Sunday-ish vector" of this kind would 
render the current `skip` trick usually useless by comparison. Or not ;-)

--

___
Python tracker 

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



[issue21572] Use generic license web page rather than requiring release-specific license pages

2020-10-13 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +21659
pull_request: https://github.com/python/cpython/pull/22688

___
Python tracker 

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



[issue41939] 3.9.0 test_site warning: "urllib.requests._opener was modified by test_site"

2020-10-13 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +21658
pull_request: https://github.com/python/cpython/pull/22688

___
Python tracker 

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



[issue41904] datetime.datetime.today makes no sense and should be removed

2020-10-13 Thread Damian Yurzola


Damian Yurzola  added the comment:

I searched all of github and there seem to be ~350K entries for datetime.today
I think this supports steven.daprano point against removal.

I could not spot any major library in a quick cursory look.

However I do see many calls that look a lot like they should have been

datetime.date.today rather than datetime.datetime.today.

You see people basically dropping the hours, minutes, secs.

And you also see people doing date math on datetime.date.today which will 
result in different answers through out the day.

I like HassanAbouelela's idea that datetime.datetime.today should return   an 
arbitrary fixed time rather than an arbitrary variable time.

--

___
Python tracker 

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



[issue42030] Drop support for dynload_aix

2020-10-13 Thread Kevin


New submission from Kevin :

Python has supported using dynload_shlib (using dlopen) on AIX since 
https://github.com/python/cpython/commit/c19c5a62aef7dce0e8147655b0d2f087965fae75
 in 2003. While I have not found a definitive timeline of when AIX gained 
support for dlopen, I have found references going back to at least 2000. 
Considering this is now 20 years later and all supported AIX versions support 
dlopen, I suspect nobody has used or tested this code path in quite some time. 
I propose removing this support under PEP 11.

--
components: Interpreter Core
messages: 378588
nosy: kadler
priority: normal
severity: normal
status: open
title: Drop support for dynload_aix

___
Python tracker 

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



[issue42029] Remove dynload_dl.c

2020-10-13 Thread Kevin


Change by Kevin :


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

___
Python tracker 

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



[issue42029] Remove dynload_dl.c

2020-10-13 Thread Kevin


Kevin  added the comment:

Sorry, the correct link is 
https://github.com/python/cpython/commit/b9949dbe6c20537b7821f25fc1eeb4e7f3faabff

--

___
Python tracker 

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



[issue42029] Remove dynload_dl.c

2020-10-13 Thread Kevin


New submission from Kevin :

dynload_dl.c is no longer referenced anywhere in the code. It was used to 
support dynamic loading on IRIX 4 and DYNIX, but those platforms were dropped 
in 
https://github.com/cpython/cpython/commit/b9949dbe6c20537b7821f25fc1eeb4e7f3faabff.
 Considering that commit removes all references to dynload_dl, I suspect it was 
an oversight that it was not removed in that commit.

--
components: Interpreter Core
messages: 378586
nosy: kadler
priority: normal
severity: normal
status: open
title: Remove dynload_dl.c

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

That test needle happened to end with a G and not have another G until much 
earlier. The status quo took advantage of that, but the PR only takes advantage 
of the skip value for a certain middle character. Perhaps it could do both.

--

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

@Tim I got this again for that benchmark:

length=3442, value=ASXABCDHAB...: Mean +- std dev: 2.39 ms +- 0.01 ms

Unfortunately not a ghost.

--

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Another algorithmic possibility: Instead of the bitset, we could have a 
stack-allocated

uint8_t jump[32]; // maybe 64? Maybe uint16_t?

It would say this: If the last character lined up in the haystack is congruent 
to i mod (1 << 8), then jump ahead by (neede_len if jump[i]==255 else jump[i]), 
where jump[i] gives the distance between the end of the needle and the last 
occurrence in the needle of a character congruent to i.

Is this sort of constant-but-more-than-a-few-bytes stack-space an acceptable 
constant memory cost? If so, I believe that could be a big improvement.

There are also a bunch of little tweaks that could be done here: For example, 
should a hypothetical jump-table jump to line up the last character in the 
needle, or jump to line up the middle character in the needle? The max from two 
tables? Should we search for the last characters to be equal, or just make sure 
the last character is in the needle-bit-set (like in the PR)? Should there be a 
second bit-set for the right half of the string? Should there be a skip value 
computed for the last character as well as the middle character (middle 
character only in the PR)? etc. etc. I'll be sure to try some of these things.

--

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread Tim Peters


Tim Peters  added the comment:

Dennis, would it be possible to isolate some of the cases with more extreme 
results and run them repeatedly under the same timing framework, as a test of 
how trustworthy the _framework_ is? From decades of bitter experience, most 
benchmarking efforts end up chasing ghosts ;-)

For example, this result:

length=3442, value=ASXABCDHAB...  | 289 us  | 2.36 ms: 8.19x slower (+719%) 

Is that real, or an illusion?

Since the alphabet has only 26 letters, it's all but certain that a needle that 
long has more than one instance of every letter. So the status quo's "Bloom 
filter" will have every relevant bit set, rendering its _most_ effective 
speedup trick useless. That makes it hard (but not impossible) to imagine how 
it ends up being so much faster than a method with more powerful analysis to 
exploit.

--

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-10-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Heads up: I plant to land this next week in case someone could to do a review 
or has something against

--

___
Python tracker 

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



[issue30934] Document how to run coverage for repository idlelib files.

2020-10-13 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Tal, this is an existing issue about documenting how to run IDLE coverage.  It 
was left open to add something about the *nix equivalent of my Windows 
instructions.  I would like to finish this, with updates elsewhere in the text.

I'm dubious about Louie's patch (PR 2733) for multiple reasons: it starts with 
venv's, which I consider a separate issue; it gives the commands that might go 
in a script, but does not comprise a script itself; I cannot tell if it uses an 
IDLE specific .coverage.  Louie ceased IDLE involvement in Sept 2017, so I am 
closing his patch in favor of whatever you might contribute.

The .coveragerc copied into the README is missing some additions, and I plan to 
add some annotations to the original.  Do you think it better to have a copy in 
README.txt, or a separate .coveragerc file in idle_test?  Same question for 
cover.bat.

"5. Test Coverage" begins with "Install the coverage package into your Python 
3.6 site-packages directory."  That should be '3.x' or 'the most recent 
installed Python possible', so it is most likely to be compatible with current 
master branch python.  I should also mention that we only need coverage on 
master, and have other revisions in mind.

Cheryl mentioned above instructions for coverage of all IDLE tests.  I have the 
command, commented out, in my original cover.bat.  After retesting, I could add 
it, commented out, to the copy.

--
nosy: +taleinat -wohlganger
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6, Python 3.7

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

bench_table.txt gives my results (`ref` is Master, `change` is with PR 22679).
The change gives 342 faster cases and 275 slower cases, and 9 cases with no 
change.

I chose a random word of length 10**6 with a zipf character distribution for 
the haystack, then 20 random needles (also zipf) of each length and tested 
those same needles and haystack for both.

I ran then with this:

from lots_of_benches import needles, haystack
needles: list[str]
haystack: str

from pyperf import Runner
runner = Runner()

for needle in needles:
n = len(needle)
abbrev = needle if n <= 10 else f"{needle[:10]}..."
runner.timeit(
name=f"length={n}, value={abbrev}",
stmt=f"needle in haystack",
globals=globals(),
)

--
Added file: https://bugs.python.org/file49518/bench_table.txt

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread Tim Peters


Tim Peters  added the comment:

> For a bunch of cases it's slower, for some others it's faster.

I have scant real idea what you're doing, but in the output you showed 4 output 
lines are labelled "slower" but 18 are labelled "faster".

What you wrote just above appears to say the reverse (I'd call 18 "a bunch" 
compared to 4 "some others").

Could please state plainly which of {status quo, PR} is faster on an output 
line labelled "faster"?

My a priori guess was that the PR had the highest chance of being slower when 
the needle is short and is found in the haystack early on. Then preprocessing 
time accounts for a relatively higher percentage of the total time taken, and 
the PR's preprocessing is more expensive than the status quo's.

The alphabet size here is small (just 26 possible letters, from 
`ascii_uppercase`), so it's quite likely that a short needle _will_ be found 
early on in a long haystack.

--

___
Python tracker 

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



[issue42028] Regression in mimetypes for image/bmp

2020-10-13 Thread xpdseth


New submission from xpdseth :

Please check the following short examples of the issue:

Status: Downloaded newer image for python:3.7.4
Python 3.7.4 (default, Oct 17 2019, 05:59:21)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimetypes
>>> str(mimetypes.guess_extension('image/bmp'))
'.bmp'


Status: Downloaded newer image for python:3.7.5
Python 3.7.5 (default, Nov 23 2019, 05:59:34)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimetypes
>>> str(mimetypes.guess_extension('image/bmp'))
'None'
>>>

Status: Downloaded newer image for python:latest
Python 3.9.0 (default, Oct  6 2020, 21:52:53)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimetypes
>>> str(mimetypes.guess_extension('image/bmp'))
'None'


I believe the issue is introduced here by duplicating the bmp key in 
types_map/_types_map_default

'.bmp': 'image/bmp'
https://github.com/python/cpython/pull/14375/files#diff-aed43839a49bace08b60186baa4b27ad69ecd6b61f928bd696b4fb670750774fR490

 '.bmp': 'image/x-ms-bmp',
https://github.com/python/cpython/pull/14375/files#diff-aed43839a49bace08b60186baa4b27ad69ecd6b61f928bd696b4fb670750774fR502

--
components: Library (Lib)
messages: 378577
nosy: xpdseth
priority: normal
pull_requests: 21656
severity: normal
status: open
title: Regression in mimetypes for image/bmp
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread STINNER Victor


STINNER Victor  added the comment:

I compared PR 22679 using the commit 77f0a23e7a9fb247101b9b14a060c4ba1c4b87a5 
as the reference using random_bench.py.

For a bunch of cases it's slower, for some others it's faster.

My modified pyperf computes a geometric mean of: 0.70 (faster).

$ PYTHONPATH=~/myprojects/pyperf/ python3 -m pyperf compare_to ref.json 
pr22679.json -G
Slower (4):
- needle=8: 816 us +- 227 us -> 1.13 ms +- 0.60 ms: 1.38x slower (+38%)
- needle=16: 579 us +- 208 us -> 780 us +- 391 us: 1.35x slower (+35%)
- needle=7: 865 us +- 301 us -> 1.15 ms +- 0.70 ms: 1.33x slower (+33%)
- needle=9: 827 us +- 250 us -> 1.04 ms +- 0.53 ms: 1.26x slower (+26%)

Faster (18):
- needle=3442: 2.24 ms +- 1.17 ms -> 846 us +- 895 us: 2.65x faster (-62%)
- needle=301: 1.72 ms +- 1.13 ms -> 652 us +- 774 us: 2.64x faster (-62%)
- needle=5164: 2.51 ms +- 1.24 ms -> 991 us +- 972 us: 2.53x faster (-60%)
- needle=1529: 2.43 ms +- 1.14 ms -> 967 us +- 841 us: 2.51x faster (-60%)
- needle=2: 660 ns +- 1060 ns -> 263 ns +- 627 ns: 2.50x faster (-60%)
- needle=11621: 2.40 ms +- 1.02 ms -> 960 us +- 931 us: 2.50x faster (-60%)
- needle=679: 2.48 ms +- 1.11 ms -> 1.03 ms +- 0.95 ms: 2.42x faster (-59%)
- needle=1019: 2.48 ms +- 1.28 ms -> 1.08 ms +- 0.99 ms: 2.30x faster (-56%)
- needle=2294: 2.47 ms +- 1.17 ms -> 1.07 ms +- 0.93 ms: 2.30x faster (-56%)
- needle=452: 2.14 ms +- 0.99 ms -> 963 us +- 956 us: 2.23x faster (-55%)
- needle=17432: 2.24 ms +- 1.00 ms -> 1.12 ms +- 0.90 ms: 2.00x faster (-50%)
- needle=7747: 2.24 ms +- 1.18 ms -> 1.14 ms +- 0.99 ms: 1.97x faster (-49%)
- needle=26149: 2.29 ms +- 0.85 ms -> 1.33 ms +- 0.98 ms: 1.72x faster (-42%)
- needle=58837: 2.24 ms +- 1.00 ms -> 1.35 ms +- 0.94 ms: 1.66x faster (-40%)
- needle=88256: 2.40 ms +- 0.97 ms -> 1.52 ms +- 0.88 ms: 1.58x faster (-37%)
- needle=39224: 2.20 ms +- 1.00 ms -> 1.50 ms +- 0.92 ms: 1.46x faster (-32%)
- needle=88: 584 us +- 271 us -> 462 us +- 324 us: 1.26x faster (-21%)
- needle=1: 24.7 ns +- 2.4 ns -> 23.8 ns +- 2.1 ns: 1.04x faster (-4%)
Benchmark hidden because not significant (10): needle=3, needle=4, needle=5, 
needle=6, needle=10, needle=25, needle=38, needle=58, needle=133, needle=200

Geometric mean: 0.70 (faster)


22:12:11 vstinner@apu$ PYTHONPATH=~/myprojects/pyperf/ python3 -m pyperf 
compare_to ref.json pr22679.json --table -G
++-+--+
| Benchmark  | ref | pr22679  |
++=+==+
| needle=8   | 816 us  | 1.13 ms: 1.38x slower (+38%) |
++-+--+
| needle=16  | 579 us  | 780 us: 1.35x slower (+35%)  |
++-+--+
| needle=7   | 865 us  | 1.15 ms: 1.33x slower (+33%) |
++-+--+
| needle=9   | 827 us  | 1.04 ms: 1.26x slower (+26%) |
++-+--+
| needle=1   | 24.7 ns | 23.8 ns: 1.04x faster (-4%)  |
++-+--+
| needle=88  | 584 us  | 462 us: 1.26x faster (-21%)  |
++-+--+
| needle=39224   | 2.20 ms | 1.50 ms: 1.46x faster (-32%) |
++-+--+
| needle=88256   | 2.40 ms | 1.52 ms: 1.58x faster (-37%) |
++-+--+
| needle=58837   | 2.24 ms | 1.35 ms: 1.66x faster (-40%) |
++-+--+
| needle=26149   | 2.29 ms | 1.33 ms: 1.72x faster (-42%) |
++-+--+
| needle=7747| 2.24 ms | 1.14 ms: 1.97x faster (-49%) |
++-+--+
| needle=17432   | 2.24 ms | 1.12 ms: 2.00x faster (-50%) |
++-+--+
| needle=452 | 2.14 ms | 963 us: 2.23x faster (-55%)  |
++-+--+
| needle=2294| 2.47 ms | 1.07 ms: 2.30x faster (-56%) |
++-+--+
| needle=1019| 2.48 ms | 1.08 ms: 2.30x faster (-56%) |
++-+--+
| needle=679 | 2.48 ms | 1.03 ms: 2.42x faster (-59%) |
++-+--+
| needle=11621   | 2.40 ms | 960 us: 2.50x faster (-60%)  |
++-+--+
| needle=2   | 660 ns  | 263 ns: 2.50x faster (-60%)  |
++-+--+
| needle=1529| 2.43 ms | 967 us: 2.51x faster (-60%)  |
++-+--+
| needle=5164| 2.51 ms | 991 us: 2.53x faster (-60%)  |
++-+--+
| needle=301 | 1.72 ms | 652 us: 2.64x faster (-62%)  |

[issue41904] datetime.datetime.today makes no sense and should be removed

2020-10-13 Thread Hassan Abouelela


Hassan Abouelela  added the comment:

If having an arbitrary time returned from the function is an issue, why not use 
a fixed time, say 0 UTC, representing the start of the day. This would mean 
that datetime.today is date.today, with an (arguably) meaningless timestamp to 
make it a datetime object.

--
nosy: +HassanAbouelela

___
Python tracker 

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



[issue40422] Light refactor: create a common _Py_closerange API

2020-10-13 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Kyle Evans!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.9

___
Python tracker 

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



[issue40422] Light refactor: create a common _Py_closerange API

2020-10-13 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7992579cd27f14f472acc37aca537eec55f681ef by Kyle Evans in branch 
'master':
bpo-40422: Move _Py_closerange to fileutils.c (GH-22680)
https://github.com/python/cpython/commit/7992579cd27f14f472acc37aca537eec55f681ef


--

___
Python tracker 

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



[issue42027] /passive run of Windows installer fail silently on Win7

2020-10-13 Thread Colin


New submission from Colin :

As expected, Python 3.9.0 cannot be installed on Windows 7. 

Running the installer displays a message clearly stating this. 

However, running the installer in passive mode (/passive) is expected to 
display errors that might occur. As stated in 
https://docs.python.org//3.9/using/windows.html#installing-without-ui

But this is not the case, nothing is displayed when launching the installer in 
passive mode.

I would expect the same message as in the UI.

--
components: Installation, Windows
messages: 378572
nosy: colin-b, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: /passive run of Windows installer fail silently on Win7
versions: Python 3.9

___
Python tracker 

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



[issue40956] Use Argument Clinic in sqlite3

2020-10-13 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

By the way, what's the preferred way to benchmark performance?

--

___
Python tracker 

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



[issue41756] Do not always use exceptions to return result from coroutine

2020-10-13 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset cfb0f57ff876ab3d04ff144f19eda58844981643 by Vladimir Matveev in 
branch 'master':
bpo-41756: Export PyGen_Send and wrap it in if-defs (#22677)
https://github.com/python/cpython/commit/cfb0f57ff876ab3d04ff144f19eda58844981643


--

___
Python tracker 

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



[issue41877] Check against misspellings of assert etc. in mock

2020-10-13 Thread Václav Brožek

Václav Brožek  added the comment:

Thank you all for the informative replies (and sorry for my long silence, I was 
sick).

I agree that the general solution (module-level assert) is worth doing, and I 
just added the current motivation to https://bugs.python.org/issue24651.

I still think that the cost associated with bad misspellings compared to the 
effort to extend the existing solution (adding patterns to [1]) is strongly in 
favour of extending the solution: the recent clean-up we had cost us many hours 
of work and involved several people (especially cases with potential or real 
bugs being discovered after the fixed typos). Adding a pattern to [1] seems 
much cheaper than the cost it saves.

The general solution is unlikely to be implemented soon, and even once it is, 
migrating existing code to use it seems unrealistic from the cost perspective. 
That's why I think that adding the newly found patterns to [1] makes sense.


[1] https://github.com/python/cpython/blob/master/Lib/unittest/mock.py#L634

--

___
Python tracker 

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



[issue24651] Mock.assert* API is in user namespace

2020-10-13 Thread Václav Brožek

Václav Brožek  added the comment:

As for the assert misspellings raising AttributeError -- that's not true of all 
of them, only those starting with "assret" or "assert" [1].

In my company, we recently cleaned up a bunch of other assert-misspellings, 
including cases where a real bug was masked in the code by that. That's why I 
filed https://bugs.python.org/issue41877.

IMO, the fact that the assert-misspellings issue is not completely fixed seems 
to increase the motivation to add a module-level assert.

While it's easy to add further misspellings to the check in [1], the general 
solution proposed in this ticket avoids a length whack-a-mole for code owners 
who would be able / willing to switch to a module-level assert.

[1] https://github.com/python/cpython/blob/master/Lib/unittest/mock.py#L634

--
nosy: +vabr2

___
Python tracker 

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



[issue42024] Exception ignored in: .remove at 0x7f6a325f2ea0>

2020-10-13 Thread Zachary Ware


Zachary Ware  added the comment:

Python 3.5 is now at end-of-life as of September 5, 2020 with the release of 
3.5.10, and will not be receiving any more changes.  3.5.4 itself has been 
obsolete since 3.5.5 was released in February 2018.

You'll need to update to at least Python 3.8.6 (which is the earliest version 
in bugfix support mode) to get anything changed in Python, but looking at the 
ansible issue you referenced, it seems likely that this has already been fixed.

--
nosy: +zach.ware
resolution:  -> out of date
status: open -> pending
type: compile error -> behavior

___
Python tracker 

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



[issue41917] Python 3.9rc2 fails to install matplotlib

2020-10-13 Thread Kapil Sinha


Kapil Sinha  added the comment:

It still fails. its two weeks after it was first reported. matplotlib is the 
reason I installed python. I guess I will rollback to older versions one by one 
to find which one works.

--
nosy: +kapil.sinha

___
Python tracker 

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



[issue32793] smtplib: duplicated debug message

2020-10-13 Thread Dong-hee Na


Dong-hee Na  added the comment:

@ZackerySpytz Thank you for work :)

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

___
Python tracker 

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



[issue32793] smtplib: duplicated debug message

2020-10-13 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 76b1913daf883b6592815d139f62f3a7fbe3c322 by Dong-hee Na in branch 
'3.8':
[3.8] bpo-32793: Fix a duplicate debug message in smtplib (GH-15341) (GH-22683)
https://github.com/python/cpython/commit/76b1913daf883b6592815d139f62f3a7fbe3c322


--

___
Python tracker 

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



[issue36318] Adding support for setting the "disabled" attribute of loggers from logging.config.dictConfig

2020-10-13 Thread Piotr Dobrogost


Piotr Dobrogost  added the comment:

I strongly agree with arguments given by the original poster. Stackoverflow's 
questions cited show the functionality of disabling logger is something people 
are looking for.
Disabling logger by setting high enough level seems to be a workaround at best 
(sys.maxsize - 
 really?). More in the spirit of an on/off toggle is a filter blocking all 
records but this clearly feels like another workaround for something which 
should have been (and in fact already is, albeit unofficially) a simple boolean 
flag.
Not hiding "disabled" property behind underscore might have been a good thing 
after all. Making it official and supported by dictConfig() would remove 
clearly expressed pain point of users of the logging module.

--

___
Python tracker 

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



[issue40956] Use Argument Clinic in sqlite3

2020-10-13 Thread Dong-hee Na


Dong-hee Na  added the comment:

> Also, see the comment from Victor here: 
> https://github.com/python/cpython/pull/22478#issuecomment-702201260

Okay got it

--

___
Python tracker 

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



[issue40956] Use Argument Clinic in sqlite3

2020-10-13 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Also, see the comment from Victor here: 
https://github.com/python/cpython/pull/22478#issuecomment-702201260

--

___
Python tracker 

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



[issue40956] Use Argument Clinic in sqlite3

2020-10-13 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

The primary reason is that it will be provide easy access to module state.

The first step in making sqlite3 support multiphase init was to create heap 
types. The second step is argument clinic. The third will be to use AC for 
module state. The last step will then be final multiphase support.

Also, IMHO, AC greatly improves the body of methods (readability => 
maintainability, hardened parsing of arguments)

--

___
Python tracker 

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



[issue32793] smtplib: duplicated debug message

2020-10-13 Thread Dong-hee Na


Change by Dong-hee Na :


--
versions:  -Python 3.7

___
Python tracker 

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



[issue32793] smtplib: duplicated debug message

2020-10-13 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +21655
pull_request: https://github.com/python/cpython/pull/22683

___
Python tracker 

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



[issue32793] smtplib: duplicated debug message

2020-10-13 Thread Dong-hee Na


Dong-hee Na  added the comment:

3.7 only can be applied security fix.

https://cpython-devguide.readthedocs.io/#branchstatus

--
nosy: +corona10

___
Python tracker 

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



[issue40956] Use Argument Clinic in sqlite3

2020-10-13 Thread Dong-hee Na


Dong-hee Na  added the comment:

What's the purpose of using AC, did the change improve performance?
It can make hard to track the code history.

--
nosy: +corona10

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue41114] "TypeError: unhashable type" could often be more clear

2020-10-13 Thread Samuel Freilich


Samuel Freilich  added the comment:

python-ideas thread: 
https://mail.python.org/archives/list/python-id...@python.org/thread/B6OMGYIM47OVGOCZLEY3MEUJDFURJRDV/

The most minimal ideas from that seem to be:

1. Maybe link to the glossary from the error message (if links to documentation 
in error messages are permissible).

2. Add a glossary entry for "unhashable" for the sake of completeness (similar 
to how there are entries for both "immutable" and "mutable").

--

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread STINNER Victor


STINNER Victor  added the comment:

FYI after I saw bench_results.txt, I wrote a pyperf PR to add geometric mean, 
to more easily summarize a benchmark suite :-D
https://github.com/psf/pyperf/pull/79

--

___
Python tracker 

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



[issue38250] enum.Flag should be more set-like

2020-10-13 Thread John Belmonte


John Belmonte  added the comment:

I agree that a bit and one-bit flag are the same.

> only 'x' was in 'xyz', not 'xy

I don't understand the comparison, because str 'a in b' tests if 'a' is a 
subsequence of 'b'.  It is not a subset operation ('xz' in 'xyz' is false).

I can understand the argument that Flag has a subset operator (currently 
__contains__), and given that one-bit flags can be used freely with the subset 
operator, there is no reason to add a bit membership operator.

However, since flag values are arguably a set of enabled bits, I think the use 
of `in` for subset is a confusing departure from the `set` API.

--

___
Python tracker 

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



[issue42025] zoneinfo: wrong time difference across transition when tzinfo is equal

2020-10-13 Thread David Grellscheid


David Grellscheid  added the comment:

OK, having read 
https://blog.ganssle.io/articles/2018/02/aware-datetime-arithmetic.html, this 
bizarreness is actually intended behaviour. It goes completely against my 
intuitive understanding of how this should come out. No additions are involved, 
just subtractions and equalities.

Can we get some big warning boxes in the documentation about this? :)

--

___
Python tracker 

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



[issue42025] zoneinfo: wrong time difference across transition when tzinfo is equal

2020-10-13 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +p-ganssle

___
Python tracker 

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



[issue38250] enum.Flag should be more set-like

2020-10-13 Thread Vedran Čačić

Vedran Čačić  added the comment:

Again, I disagree. `str` used to work like this in Py2.0 (or somewhere around 
then), only 'x' was in 'xyz', not 'xy'. Then Guido came to his senses. :-)

This is not set theory, this is mereology. You don't differentiate between a 
digit and a one-digit number, a char and a one-char string, and in the same way 
you shouldn't differentiate between a bit and a one-bit flag.

--

___
Python tracker 

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



[issue38250] enum.Flag should be more set-like

2020-10-13 Thread John Belmonte


John Belmonte  added the comment:

It's completely undocumented, but today I noticed that Flag.__contains__() is 
actually a subset operation.


def __contains__(self, other):
...
return other._value_ & self._value_ == other._value_

It's an unfortunate departure from the `set` type, which uses `in` for 
membership test and issubset() / `<=` for subset test.

For set operations, the Flag individual bits should be considered the members 
of a set (not Flag compound values, which are themselves equivalent to a set).

--

___
Python tracker 

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



[issue42026] index function return first index for same element if repetitive in a list

2020-10-13 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue42026] index function return first index for same element if repetitive in a list

2020-10-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The index() method is working as expected.  This isn't a bug.

The easiest way to accomplish your goal is to use enumerate() with a list 
comprehension:

>>> po = [11,22,33,44,11,55,66,11,88]
>>> [i for i, value in enumerate(po) if value == 11]
[0, 4, 7]

--
nosy: +rhettinger

___
Python tracker 

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



[issue42004] Allow uploading files with SimpleHTTPRequestHandler

2020-10-13 Thread Jürgen Gmach

Jürgen Gmach  added the comment:

Disclaimer: I am not cpython maintainer - I just wanted to give a bit of 
context for using `cgi.FieldStorage`.

Personally, I'd rather not include this in the std, but create a small package 
for PyPI. But that's only me.

Wait until you get feedback from a cpython maintainer.

--

___
Python tracker 

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



[issue42025] zoneinfo: wrong time difference across transition when tzinfo is equal

2020-10-13 Thread David Grellscheid


David Grellscheid  added the comment:

Here's a third example, without fold= involved. The spring transition also does 
not work when the timezone in the difference is equal:

01:59:00 to 03:01:00 should be 2 minutes

All these should be 0:02:00 apart
1:02:00 Oslo_1   - Oslo_0
0:02:00 Berlin_1 - Oslo_0
0:02:00 Oslo_1   - Berlin_0
1:02:00 Berlin_1 - Berlin_0

--
title: zoneinfo: fold not taken into account in time difference when tzinfo is 
equal -> zoneinfo: wrong time difference across transition when tzinfo is equal
Added file: https://bugs.python.org/file49517/spring_bug.py

___
Python tracker 

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



[issue42025] zoneinfo: fold not taken into account in time difference when tzinfo is equal

2020-10-13 Thread David Grellscheid


David Grellscheid  added the comment:

To make it clear that this issue is not covered by ...

"Two such instances that differ only by the value of the fold attribute will 
not be distinguishable by any means other than an explicit access to the fold 
value." (PEP 495)

I have modified the timestamps by one minute, so that they differ in more than 
just the fold attribute.

All these should be 1:01:00 apart
0:01:00 Oslo_1   - Oslo_0
1:01:00 Berlin_1 - Oslo_0
1:01:00 Oslo_1   - Berlin_0
0:01:00 Berlin_1 - Berlin_0

--
Added file: https://bugs.python.org/file49516/fold_bug_1minute.py

___
Python tracker 

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



[issue42026] index function return first index for same element if repetitive in a list

2020-10-13 Thread Chetan Palliwal


Chetan Palliwal  added the comment:

if an element in the list present more than 1 times in different order and we 
try to get the index of it python 3.6 is returning only the first index value 
for all places of that element in that list.

--
Added file: https://bugs.python.org/file49515/index-python-issue.JPG

___
Python tracker 

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



[issue42026] index function return first index for same element if repetitive in a list

2020-10-13 Thread Chetan Palliwal


New submission from Chetan Palliwal :

In [1]: po=[11,22,33,44,11,55,66,11,88]


In [2]: for lm in po:
   ...: if lm==11:
   ...: print("value is = {} and index is = {}".format(lm,po.index(lm)))
   ...: else:
   ...: print("value is = {} and index is = {}".format(lm,po.index(lm)))
   ...:
value is = 11 and index is = 0
value is = 22 and index is = 1
value is = 33 and index is = 2
value is = 44 and index is = 3
value is = 11 and index is = 0
value is = 55 and index is = 5
value is = 66 and index is = 6
value is = 11 and index is = 0
value is = 88 and index is = 8

--
components: Library (Lib)
messages: 378546
nosy: chetanpalliwal13
priority: normal
severity: normal
status: open
title: index function return first index for same element if repetitive in a 
list
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue40956] Use Argument Clinic in sqlite3

2020-10-13 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +berker.peksag, vstinner

___
Python tracker 

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



[issue40956] Use Argument Clinic in sqlite3

2020-10-13 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +21654
pull_request: https://github.com/python/cpython/pull/22478

___
Python tracker 

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



[issue42025] zoneinfo: fold not taken into account in time difference when tzinfo is equal

2020-10-13 Thread David Grellscheid


New submission from David Grellscheid :

I'm comparing two aware timestamps during a clock transition that differ only 
in their fold= value.

When taking the difference of two aware timestamps with the *same* tzinfo, the 
fold parameter is ignored. 

A difference between two timestamps with different tzinfo works correctly, with 
fold taken into account.

For the attached code I would expect all timedeltas to be the same, but I get:

0:00:00 Oslo_1   - Oslo_0
1:00:00 Berlin_1 - Oslo_0
1:00:00 Oslo_1   - Berlin_0
0:00:00 Berlin_1 - Berlin_0

--
components: Library (Lib)
files: fold_bug.py
messages: 378545
nosy: d.grellscheid
priority: normal
severity: normal
status: open
title: zoneinfo: fold not taken into account in time difference when tzinfo is 
equal
versions: Python 3.9
Added file: https://bugs.python.org/file49514/fold_bug.py

___
Python tracker 

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



[issue37903] IDLE Shell sidebar.

2020-10-13 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +21653
pull_request: https://github.com/python/cpython/pull/22682

___
Python tracker 

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



[issue42020] interpreter hangs forever on invalid input

2020-10-13 Thread denis


denis  added the comment:

I do confirm that different terminals react differently (xterm doesn't hang)

Definitely not a python bug

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

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread STINNER Victor


STINNER Victor  added the comment:

random_bench.py has really weird timings. Example:

(...)
Run 15: 1 warmup, 3 values, 2^15 loops
- warmup 1: 3.05 us (+504%)
- value 1: 42.8 ns (-92%)
- value 2: 1.18 us (+133%)
- value 3: 293 ns (-42%)
(...)
Run 21: 1 warmup, 3 values, 2^15 loops
- warmup 1: 167 us (+1073%)
- value 1: 162 ns (-99%)
- value 2: 39.1 us (+174%)
- value 3: 3.53 us (-75%)
needle=3: Mean +- std dev: 17.2 us +- 39.6 us

How is it possible that in the same process (same "Run"), timing changes 
between 42 ns and 1 180 ns? The std dev is really large.

--

___
Python tracker 

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



[issue41995] five possible Null Pointer Dereference bugs.

2020-10-13 Thread miss-islington


miss-islington  added the comment:


New changeset afe86066e748076f970ccd277fc64fc51bea189b by Miss Skeleton (bot) 
in branch '3.9':
bpo-41995: Fix null ptr deref in tracemalloc_copy_trace() (GH-22660)
https://github.com/python/cpython/commit/afe86066e748076f970ccd277fc64fc51bea189b


--

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-13 Thread STINNER Victor


STINNER Victor  added the comment:

> I used random_bench.py to compare PR 22679 to Master, and the results are in 
> bench_results.txt. Results were varied. I suppose this depends on what cases 
> we want to optimize for.

Lazy me: can you please use render results as a table? Use something like:

./python random_bench.py -o ref.json # master reference
# apply your change, rebuild Python
./python random_bench.py -o change.json # your change
python3 -m pyperf compare_to --table ref.json change.json

https://pyperf.readthedocs.io/en/latest/cli.html#compare-to-cmd

See also -G option.

--

___
Python tracker 

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



[issue41995] five possible Null Pointer Dereference bugs.

2020-10-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +21652
pull_request: https://github.com/python/cpython/pull/22681

___
Python tracker 

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



[issue41995] five possible Null Pointer Dereference bugs.

2020-10-13 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 66c28f50c76e4f23af7146e0e580457c5fd6bde7 by Yunlongs in branch 
'master':
bpo-41995: Fix null ptr deref in tracemalloc_copy_trace() (GH-22660)
https://github.com/python/cpython/commit/66c28f50c76e4f23af7146e0e580457c5fd6bde7


--

___
Python tracker 

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