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

2020-10-11 Thread Tim Peters


Tim Peters  added the comment:

Impressive, Dennis! Nice work.

FYI, on the OP's original test data, your fastsearch() completes each search in 
under 20 seconds using CPython, and in well under 1 second using PyPy.

Unfortunately, that's so promising it can't just be dismissed offhandedly ;-)  
Looks like something quite worth pursuing here!

--

___
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-11 Thread Vladimir Matveev


Change by Vladimir Matveev :


--
pull_requests: +21639
pull_request: https://github.com/python/cpython/pull/22663

___
Python tracker 

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



[issue41739] test_logging: test_race_between_set_target_and_flush() leaks threads (threading_cleanup() failed to cleanup ...)

2020-10-11 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset f5393dc2a0ced7bf670ebc56b5fd10a3eb328d1a by Victor Stinner in 
branch '3.9':
bpo-41739: Fix test_logging.test_race_between_set_target_and_flush() (GH-22655) 
(GH-22656)
https://github.com/python/cpython/commit/f5393dc2a0ced7bf670ebc56b5fd10a3eb328d1a


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue41739] test_logging: test_race_between_set_target_and_flush() leaks threads (threading_cleanup() failed to cleanup ...)

2020-10-11 Thread miss-islington


Change by miss-islington :


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

___
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-11 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Just reuse this bpo issue.  I'll mark the PRs as "skip news"; don't worry about 
a new news blurb entry as it's all tied to the original one.

--
status: closed -> open

___
Python tracker 

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



[issue42007] Line continuation after Boolean operation

2020-10-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Sorry, I don't think this proposal has a chance.  

Python doesn't require statement terminators like ";" in C.  Accordingly, it 
needs to have a clean and consistent rule to close a statement.  The rule that 
has worked well for us it that a statement is terminated by a newline unless 
there is a line continuation character, or a colon to begin a new suite, or an 
open expression delimiter (parenthesis, square bracket or curly brace). 

Adding a special case exception to the rule might look nice but would 
complicate learning the language, and it would complicate the implementation as 
well.

--
nosy: +rhettinger

___
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-11 Thread Kyle Evans


Kyle Evans  added the comment:

Would you like that on a distinct issue, or is it ok to reuse this BPO since 
it's a location improvement of an API just introduced?

I've got a local branch now that:

1. moves the suppress IPH stuff into _Py_closerange
2. moves the definition into Python/fileutils.c
3. moves the declaration into Include/fileutils h

--

___
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-11 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +21637
pull_request: https://github.com/python/cpython/pull/22660

___
Python tracker 

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



[issue37449] Move ensurepip off of pkgutil and to importlib.resources

2020-10-11 Thread wim glenn


Change by wim glenn :


--
nosy: +wim.glenn
nosy_count: 4.0 -> 5.0
pull_requests: +21636
pull_request: https://github.com/python/cpython/pull/22659

___
Python tracker 

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



[issue41989] htmlparser unclosed script tag causes data loss

2020-10-11 Thread Waylan Limberg


Change by Waylan Limberg :


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

___
Python tracker 

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



[issue25567] shlex.quote doesn't work on bytestrings

2020-10-11 Thread Hassan Abouelela


Change by Hassan Abouelela :


--
nosy: +HassanAbouelela
nosy_count: 9.0 -> 10.0
pull_requests: +21634
pull_request: https://github.com/python/cpython/pull/22657

___
Python tracker 

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



[issue40213] contextlib.aclosing()

2020-10-11 Thread John Belmonte


Change by John Belmonte :


--
pull_requests: +21633
versions: +Python 3.10 -Python 3.9
pull_request: https://github.com/python/cpython/pull/21545

___
Python tracker 

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



[issue41739] test_logging: test_race_between_set_target_and_flush() leaks threads (threading_cleanup() failed to cleanup ...)

2020-10-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +21632
pull_request: https://github.com/python/cpython/pull/22656

___
Python tracker 

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



[issue41739] test_logging: test_race_between_set_target_and_flush() leaks threads (threading_cleanup() failed to cleanup ...)

2020-10-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 13ff396c019d548ba181cf22c6f39309a300723c by Victor Stinner in 
branch 'master':
bpo-41739: Fix test_logging.test_race_between_set_target_and_flush() (GH-22655)
https://github.com/python/cpython/commit/13ff396c019d548ba181cf22c6f39309a300723c


--

___
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-11 Thread STINNER Victor


STINNER Victor  added the comment:

Python/fileutils.c might be a better home for such helper function.

You might move _Py_BEGIN_SUPPRESS_IPH / _Py_END_SUPPRESS_IPH macros into 
_Py_closerange(), even if currently it makes no diffence. 
(_Py_BEGIN_SUPPRESS_IPH is specific to Windows, os.closerange() uses it, and 
_posixsubprocess doesn't need it since it's not used on Windows.)

See also the idea of reminding if the kernel supports the syscall or not:
https://github.com/python/cpython/pull/22651#pullrequestreview-506215041

--

___
Python tracker 

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



[issue42006] Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId

2020-10-11 Thread STINNER Victor


STINNER Victor  added the comment:

I don't want to hold fixing the code right now. If we decide to break the 
backward compatibility of the C API, a transition plan will likely take a few 
years anyway, whereas this issue should be first as soon as possible.

--

___
Python tracker 

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



[issue42006] Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId

2020-10-11 Thread STINNER Victor


STINNER Victor  added the comment:

PyDict_GetItem() behavior is an old wart. Would it make sense to plan a 
migration plan to slowly move towards PyDict_GetItem() behaving as 
PyDict_GetItemWithError()?

CPython is an old code base full of corner cases. But outside CPython, is it 
common to rely on the current PyDict_GetItem() behavior (ignore errors, can be 
called with an exception raised)?

(A) For example, would it make sense to start to emit a DeprecationWarning when 
it's called with an exception raised? Currently, the function calls 
_PyErr_Fetch(): checking if exc_type is non-NULL requires to add an if which 
would add a cost to all PyDict_GetItem() calls. But IMO it would be interesting 
to fix this function in the long term.

(B) Also, would it make sense to start to no longer ignore base exceptions like 
SystemExit, KeyboardInterrupt or MemoryError in PyDict_GetItem()?

How can we take a decision on that? Analyze the C code base of a bunch of 
popular C extension? Make the change and await to see how many people complain?

In the long term, I would prefer that PyDict_GetItem() behaves as other C 
functions: it should not be called with an exception raised (the caller has to 
store/restore the current exception), and raises an exception on error. I 
expect better performance for such more regular and simpler behavior.

--

___
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-11 Thread John Belmonte


John Belmonte  added the comment:

I think https://github.com/python/cpython/pull/1 should be reverted 
(considering the design issue, performance issue, and bugs), and lets have a 
proper design and review.

While just reading the code, I found an existing bug in Flag.  And the new 
__iter__ uses the buggy internal function, and so itself has bugs.

https://github.com/python/cpython/pull/1#issuecomment-706776441

--

___
Python tracker 

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



[issue42006] Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId

2020-10-11 Thread STINNER Victor


STINNER Victor  added the comment:

See also old issues about PyDict_GetItemWithError():

* bpo-20615
* bpo-30475
* bpo-35459

--

___
Python tracker 

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



[issue41739] test_logging: test_race_between_set_target_and_flush() leaks threads (threading_cleanup() failed to cleanup ...)

2020-10-11 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue41739] test_logging: test_race_between_set_target_and_flush() leaks threads (threading_cleanup() failed to cleanup ...)

2020-10-11 Thread STINNER Victor


STINNER Victor  added the comment:

I'm able to reproduce the issue if I reduce the sleep:

diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 4cd8c7e25d..fc395dc473 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -1177,7 +1177,7 @@ class MemoryHandlerTest(BaseTest):
 self.mem_hdlr.setTarget(target)
 
 for _ in range(10):
-time.sleep(0.005)
+time.sleep(1e-9)
 self.mem_logger.info("not flushed")
 self.mem_logger.warning("flushed")
 


With the command:

$ ./python -m test test_logging -m test_race_between_set_target_and_flush -F 
-j10 --fail-env-changed 
(...)
0:00:03 load avg: 3.74 [ 18/1] test_logging failed (env changed)
Warning -- threading_cleanup() failed to cleanup 1 threads (count: 1, dangling: 
2)
Warning -- Dangling thread: 
Warning -- Dangling thread: <_MainThread(MainThread, started 139861194377024)>

--

___
Python tracker 

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



[issue41739] test_logging: test_race_between_set_target_and_flush() leaks threads (threading_cleanup() failed to cleanup ...)

2020-10-11 Thread STINNER Victor


STINNER Victor  added the comment:

Cool, my threading change works as expected! The name of the target function 
was logged.

https://buildbot.python.org/all/#/builders/509/builds/172

0:00:28 load avg: 3.58 [ 36/424/1] test_logging failed (env changed)
Warning -- threading_cleanup() failed to cleanup 2 threads (count: 2, dangling: 
3)
Warning -- Dangling thread: 
Warning -- Dangling thread: 
Warning -- Dangling thread: <_MainThread(MainThread, started 4396920310576)>

So leaked threads are running removeTarget() which come from 
MemoryHandlerTest.test_race_between_set_target_and_flush().

--
title: test_logging: threading_cleanup() failed to cleanup 1 threads (count: 1, 
dangling: 2) -> test_logging: test_race_between_set_target_and_flush() leaks 
threads (threading_cleanup() failed to cleanup ...)

___
Python tracker 

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



[issue42008] Internal Random class calling seed() with incorrect argument

2020-10-11 Thread Raymond Hettinger


New submission from Raymond Hettinger :

The C code in random_new() incorrectly calls random_seed() with an args tuple. 
Instead, it should use first element of the args tuple.

This matters because we've deprecated using PyObject_Hash() in random_seed().  
Once that is removed, _random.Random(someseed) won't work at all (there's a 
test for it).

# Public API is correct
>>> from random import Random
>>> r = Random()
>>> r.seed(8675309)
>>> r.random()
0.40224696110279223
>>> r = Random(8675309)
>>> r.random()
0.40224696110279223

# Private API is incorrect for Random(someseed)
>>> from _random import Random
>>> r = Random()
>>> r.seed(8675309)
>>> r.random()
0.40224696110279223
>>> r = Random(8675309)  
>>> r.random()
0.21095576307886765  <=== This is wrong

--
components: Extension Modules
keywords: easy (C)
messages: 378457
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Internal Random class calling seed() with incorrect argument
type: behavior
versions: Python 3.10, 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



[issue39101] IsolatedAsyncioTestCase freezes when exception is raised

2020-10-11 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +patch
nosy: +lisroach
nosy_count: 3.0 -> 4.0
pull_requests: +21630
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22654

___
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-11 Thread Vedran Čačić

Vedran Čačić  added the comment:

Of course, if it returns True only on _some_ bits combinations it doesn't make 
sense. I thought every element of a Boolean span would be _in_ the Foo.

But about "zero bit", I still think it's perfectly analogous to '' in 'abc'.

--

___
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-11 Thread John Belmonte


John Belmonte  added the comment:

> Just a comment, (1) is analogous to str. iter('abc') gives only 'a', 'b' and 
> 'c', while contains accepts '', 'ab', 'bc', and 'abc' too. At least in my 
> mind, it's a pretty strong analogy.

I don't agree.  The "zero" bit does not exist, so having __contains__ return 
True on `Foo(0) in x` is misaligned with the iterator.  And having __contains__ 
return True for specific compound values just because they happen to be 
explicitly defined, while returning False for others, is arbitrary.  
__contains__ seems to be of very little use, and moreover a trap for the 
unwary.  Assuming we have to live with that until Python 4, it's better to make 
an explicit iterator like `bits()` so that the API doesn't contradict itself.

--

___
Python tracker 

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



[issue41971] multiple tests in test_tools fail since Python 3.9

2020-10-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 4af672921949b8a10340d5e29b456091060cedeb by Miss Skeleton (bot) 
in branch '3.9':
bpo-41971: Fix test failure in test.test_tools.test_c_analyzer when mutating 
global state (GH-22652) (GH-22653)
https://github.com/python/cpython/commit/4af672921949b8a10340d5e29b456091060cedeb


--

___
Python tracker 

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



[issue33802] Regression in logging configuration

2020-10-11 Thread Kyle Evans


Change by Kyle Evans :


--
nosy: +kevans
nosy_count: 8.0 -> 9.0
pull_requests: +21629
pull_request: https://github.com/python/cpython/pull/22651

___
Python tracker 

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



[issue6721] Locks in the standard library should be sanitized on fork

2020-10-11 Thread Kyle Evans


Change by Kyle Evans :


--
nosy: +kevans
nosy_count: 28.0 -> 29.0
pull_requests: +21627
pull_request: https://github.com/python/cpython/pull/22651

___
Python tracker 

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



[issue36533] logging regression with threading + fork are mixed in 3.7.1rc2 (deadlock potential)

2020-10-11 Thread Kyle Evans


Change by Kyle Evans :


--
nosy: +kevans
nosy_count: 8.0 -> 9.0
pull_requests: +21628
pull_request: https://github.com/python/cpython/pull/22651

___
Python tracker 

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



[issue41971] multiple tests in test_tools fail since Python 3.9

2020-10-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy:  -miss-islington
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



[issue41971] multiple tests in test_tools fail since Python 3.9

2020-10-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 47ecfd8030c391779dd9d3b4b07e6b01a8392481 by Pablo Galindo in 
branch 'master':
bpo-41971: Fix test failure in test.test_tools.test_c_analyzer when mutating 
global state (GH-22652)
https://github.com/python/cpython/commit/47ecfd8030c391779dd9d3b4b07e6b01a8392481


--

___
Python tracker 

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



[issue41971] multiple tests in test_tools fail since Python 3.9

2020-10-11 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +21626
pull_request: https://github.com/python/cpython/pull/22653

___
Python tracker 

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



[issue27635] pickle documentation says that unpickling may not call __new__

2020-10-11 Thread Alexandre Vassalotti


Change by Alexandre Vassalotti :


--
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



[issue40423] Optimization: use close_range(2) if available

2020-10-11 Thread miss-islington


miss-islington  added the comment:


New changeset 1800c600801709958af66bebfa683a4e7570810f by Kyle Evans in branch 
'master':
bpo-40423: Optimization: use close_range(2) if available (GH-22651)
https://github.com/python/cpython/commit/1800c600801709958af66bebfa683a4e7570810f


--
nosy: +miss-islington

___
Python tracker 

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



[issue27635] pickle documentation says that unpickling may not call __new__

2020-10-11 Thread Irit Katriel


Irit Katriel  added the comment:

Ping (to close the issue).

--
nosy: +iritkatriel

___
Python tracker 

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



[issue38110] Use fdwalk() within os.closerange() impl if available

2020-10-11 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
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



[issue40423] Optimization: use close_range(2) if available

2020-10-11 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith

___
Python tracker 

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



[issue41971] multiple tests in test_tools fail since Python 3.9

2020-10-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue41971] multiple tests in test_tools fail since Python 3.9

2020-10-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Seems that the problem is that this check:

https://github.com/python/cpython/blob/master/Tools/c-analyzer/c_analyzer/common/files.py#L90

is done using a default value for "get_files":

https://github.com/python/cpython/blob/master/Tools/c-analyzer/c_analyzer/common/files.py#L63

But the import from source creates a new function for os.walk and therefore the 
comparison fails.

--

___
Python tracker 

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



[issue40423] Optimization: use close_range(2) if available

2020-10-11 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Ah, yeah ENOSYS is it.  I had to do this trick in older subprocess versions for 
something else.  Still visible here in the old 2.7 backport: 
https://github.com/google/python-subprocess32/blob/main/_posixsubprocess.c#L801

--

___
Python tracker 

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



[issue40423] Optimization: use close_range(2) if available

2020-10-11 Thread Kyle Evans


Change by Kyle Evans :


--
pull_requests: +21624
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22651

___
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-11 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
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



[issue40423] Optimization: use close_range(2) if available

2020-10-11 Thread Kyle Evans


Kyle Evans  added the comment:

Ah, I will fix this and then submit a PR, thanks... hopefully it returns ENOSYS.

--
nosy: +kevans

___
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-11 Thread miss-islington


miss-islington  added the comment:


New changeset c230fde8475e4e5581e74a4235654d17ccf4cff8 by Kyle Evans in branch 
'master':
bpo-40422: create a common _Py_closerange API (GH-19754)
https://github.com/python/cpython/commit/c230fde8475e4e5581e74a4235654d17ccf4cff8


--
nosy: +miss-islington

___
Python tracker 

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



[issue41971] multiple tests in test_tools fail since Python 3.9

2020-10-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Adding Eric Snow as this seems to be something going on on the c_analyzer

--
nosy: +eric.snow

___
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-11 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> 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



[issue40423] Optimization: use close_range(2) if available

2020-10-11 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
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



[issue40423] Optimization: use close_range(2) if available

2020-10-11 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

for reference, very recent Linux kernels appear to have gained a close_range 
syscall.  http://lkml.iu.edu/hypermail/linux/kernel/2008.0/02649.html

Your diff isn't quite sufficient as is.  When depending on a syscall that has a 
function provided by libc, the libc function may exist (thus HAVE_CLOSE_RANGE 
will be true at Python compile time) but the system the process is running on 
may not support the system call.  So it'll return an EINVAL (or something like 
that) error.

Special handling of that error to add an `else {...}` falling back to the other 
codepath is necessary.

--
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



[issue26964] Incorrect documentation for `-u`-flag

2020-10-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> out of date
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



[issue41376] site.getusersitepackages() incorrectly claims that PYTHONNOUSERSITE is respected

2020-10-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
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



[issue41376] site.getusersitepackages() incorrectly claims that PYTHONNOUSERSITE is respected

2020-10-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 1006f63a8b4327e8a74eb978b175b5234bb46c6c by Miss Skeleton (bot) 
in branch '3.8':
bpo-41376: Fix the documentation of `site.getusersitepackages()` (GH-21602) 
(GH-22592)
https://github.com/python/cpython/commit/1006f63a8b4327e8a74eb978b175b5234bb46c6c


--
nosy: +pablogsal

___
Python tracker 

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



[issue26964] Incorrect documentation for `-u`-flag

2020-10-11 Thread Irit Katriel


Irit Katriel  added the comment:

I think this issue is out of date (the offending sentence is no longer there).

--
nosy: +iritkatriel

___
Python tracker 

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



[issue42007] Line continuation after Boolean operation

2020-10-11 Thread veganaiZe

veganaiZe  added the comment:

Actually, I can do it the second way.  I must have typo'd when testing (my 
apologies)...  But I'd still like to do it the first way. ☺

--

___
Python tracker 

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



[issue42007] Line continuation after Boolean operation

2020-10-11 Thread veganaiZe


New submission from veganaiZe :

I can't do something like this (regarding the `or`)...

if (not position.x == 0 and velocity == -1) or
(not position.x == 500 and velocity == 1)

Nor this...

if (not position.x == 0 and velocity == -1) or (
not position.x == 500 and velocity == 1)

I have to do something like this...

if (not position.x == 0 and velocity == -1) \
   or (not position.x == 500 and velocity == 1)

I would like to be able to do it the first way.

--
components: Interpreter Core
messages: 378441
nosy: veganaiZe
priority: normal
severity: normal
status: open
title: Line continuation after Boolean operation
type: enhancement
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



[issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch

2020-10-11 Thread Bug Reporter


Bug Reporter  added the comment:

I started by asking a question at 
https://askubuntu.com/questions/1281942/pythons-test-ssl-fails-starting-from-ubuntu-20-04-i-need-to-find-a-person-at-c

--

___
Python tracker 

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



[issue41993] Possible issues when remove not completely initialized module from sys.module

2020-10-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue41993] Possible issues when remove not completely initialized module from sys.module

2020-10-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +21623
pull_request: https://github.com/python/cpython/pull/22649

___
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-11 Thread Vedran Čačić

Vedran Čačić  added the comment:

Just a comment, (1) is analogous to str. iter('abc') gives only 'a', 'b' and 
'c', while contains accepts '', 'ab', 'bc', and 'abc' too. At least in my mind, 
it's a pretty strong analogy.

--

___
Python tracker 

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



[issue42006] Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId

2020-10-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue41971] multiple tests in test_tools fail since Python 3.9

2020-10-11 Thread Chih-Hsuan Yen


Chih-Hsuan Yen  added the comment:

Looks like those failures in test_tools happen only when test_check_c_globals 
is imported and a test in test_imp is run.

```
$ cat matchfile
test.test_tools.*
test.test_imp.ImportTests.test_load_from_source

$ ./python -m test --matchfile matchfile test_check_c_globals test_imp 
test_tools
0:00:00 load avg: 0.90 Run tests sequentially
0:00:00 load avg: 0.90 [1/3] test_check_c_globals
0:00:00 load avg: 0.90 [2/3] test_imp -- test_check_c_globals run no tests
0:00:00 load avg: 0.90 [3/3] test_tools
test test_tools failed -- multiple errors occurred; run in verbose mode for 
details
test_tools failed

== Tests result: FAILURE ==

1 test OK.

1 test failed:
test_tools

1 test run no tests:
test_check_c_globals

Total duration: 1.9 sec
Tests result: FAILURE
```

If I remove test_check_c_globals from the second command or 
test.test_imp.ImportTests.test_load_from_source from matchfile, test_tools does 
not fail.

--

___
Python tracker 

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



[issue42006] Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId

2020-10-11 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

There are design flaws in PyDict_GetItem(), PyDict_GetItemString() and 
_PyDict_GetItemId().

1. They suppress all exceptions raised internally. Most common of are 
MemoryError, KeyboardInterrupt and RecursionError whose raising is out of 
control of the programmer. When an exception is suppressed the function returns 
incorrect result. For example PyDict_GetItem() can return NULL for existing key 
if the user press Ctrl-C.

This situation seems impossible if the key and all keys in the dict are exact 
strings, but we cannot be sure.

2. PyDict_GetItem() preserves the current exception, and therefore can be used 
in handling exception but PyDict_GetItemString() and _PyDict_GetItemId() clear 
it if the creation of string object is failed (due to MemoryError or, less 
likely, UnicodeDecodeError). It can leads to very unexpected result.

Most of uses of PyDict_GetItem() etc were fixed in issue35459 and other issues. 
But some occurrences were left, in cases when there is no any error handling, 
either errors are not expected or all exceptions are suppressed in any case. It 
is mainly in the compiler and symtable (where we look up in just created 
dicts), in structseq.c and in the sys module.

The proposed PR (it can be split on several smaller PRs if needed, see also 
issue41993 and issue42002) removes all calls of PyDict_GetItem, 
PyDict_GetItemString and _PyDict_GetItemId, replacing them with calls of 
PyDict_GetItemWithError, _PyDict_GetItemStringWithError and 
_PyDict_GetItemIdWithError or other functions if appropriate.

_PyDict_GetItemId is no longer used and can be removed.

--
components: Extension Modules, Interpreter Core
messages: 378437
nosy: serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId
versions: Python 3.10

___
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-11 Thread John Belmonte


John Belmonte  added the comment:

Part of this issue (#1) was intended to be addressed by 
https://github.com/python/cpython/pull/1 which added an `__iter__` 
implementation to Flag and IntFlag.  (The PR did not reference this issue, and 
was already merged last month.)

However that PR seems problematic on several counts:
   1. `__iter__` diverges from the existing `__contains__`.  The latter 
includes 0 and compound values
   2. the implementation is fairly heavy
   3. len() on an enum instance is going to be O(n)

I've put post-merge comments on the PR.

I think it would be safer to have an explicitly named `bits()` iterator on flag 
instances, rather than use `__iter__()`.

--
keywords: +patch
message_count: 3.0 -> 4.0
pull_requests: +21621
stage:  -> patch review
versions: +Python 3.10 -Python 3.9
pull_request: https://github.com/python/cpython/pull/1

___
Python tracker 

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



[issue42002] Clean up initialization of the sys module

2020-10-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
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



[issue41993] Possible issues when remove not completely initialized module from sys.module

2020-10-11 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue41968] 3.9 IDLE documentation.

2020-10-11 Thread E. Paine


E. Paine  added the comment:

If you had a bad update, it is likely your registry is corrupt. If at all 
possible, I would recommend a Windows reinstall (it is quite likely other 
software has also been affected). However, in the past I have had similar 
problems and the Python installer does seem particularly susceptible to 
problems if corruption occurs (I resolved this without a Windows reinstall by 
uninstalling Python then deleting all registry entries related to it - though I 
would not recommend this more generally). I may take this up with Steve (in a 
separate issue) to see if we can make the installer more resilient.

--

___
Python tracker 

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



[issue41993] Possible issues when remove not completely initialized module from sys.module

2020-10-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 8287aadb75f6bd0154996424819334cd3839707c by Serhiy Storchaka in 
branch 'master':
bpo-41993: Fix possible issues in remove_module() (GH-22631)
https://github.com/python/cpython/commit/8287aadb75f6bd0154996424819334cd3839707c


--

___
Python tracker 

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



[issue41940] AMD64 Debian root 3.x: tests fail because downloaded files start with:

2020-10-11 Thread STINNER Victor


STINNER Victor  added the comment:

If someone wants to use HTTPS on pythontest.net, please open a new issue. I 
don't recall who operates this service. Ask Ernest or Benjamin maybe? See 
https://github.com/python/pythontestdotnet/ project. https://pythontest.net/ 
has an invalid certificate. Ernest might be able to set up a valid certificate.

For buildbot failures, I prefer to be able to close issues as soon as possible, 
since I manage tons of buildbot failures. Otherwise, I'm quickly overwhelmed.

The initial issue "AMD64 Debian root 3.x fails" is fixed ;-)

--

___
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-11 Thread Mark Shannon


Mark Shannon  added the comment:

What's the difference between removing it and making it properly private (i.e. 
static)?

It's an irrelevant detail whether the code is inlined or in a helper function.

--

___
Python tracker 

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



[issue41940] AMD64 Debian root 3.x: tests fail because downloaded files start with:

2020-10-11 Thread Chris Angelico


Chris Angelico  added the comment:

That ducks the immediate issue, but I think the underlying issue would still be 
worth solving. How hard would it be to fetch this via an encrypted connection? 
It's still not 100% secure, but it would be resilient against some of these 
sorts of issues.

--

___
Python tracker 

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



[issue42002] Clean up initialization of the sys module

2020-10-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset fa1d83db62a545580d9a1a585b2c1fb55961a5c3 by Serhiy Storchaka in 
branch 'master':
bpo-42002: Clean up initialization of the sys module. (GH-22642)
https://github.com/python/cpython/commit/fa1d83db62a545580d9a1a585b2c1fb55961a5c3


--

___
Python tracker 

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



[issue41991] Remove _PyObject_HasAttrId

2020-10-11 Thread STINNER Victor


STINNER Victor  added the comment:

Remark: the issue that you give in this issue is helpful. Next time, you may 
include such rationale directly in the commit message. IMO the Linux kernel is 
a great example on how commit message should be written: long commit message 
with tons of information, you don't need to go to an online website (like 
bugs.python.org) to get more context / the rationale.

--

___
Python tracker 

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



[issue34067] Problem with contextlib.nullcontext

2020-10-11 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue41940] AMD64 Debian root 3.x: tests fail because downloaded files start with:

2020-10-11 Thread STINNER Victor


STINNER Victor  added the comment:

Yeah, it seems like Chris's Internet issues are gone ;-)

--
resolution:  -> out of date
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



[issue41981] Errors building python 3.9.0 from source on Centos 7 with GCC 10

2020-10-11 Thread STINNER Victor


STINNER Victor  added the comment:

> In "config.log" you can see that "/bin/ld" did not found "-lpanelw".

Yep, that's what I wrote in my previous message :-)

I understand that you solved your issue, so I close this issue.

--
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



[issue41845] Promote PyObject_GenericGetDict to the stable API

2020-10-11 Thread Zackery Spytz


Zackery Spytz  added the comment:

I have created PR 22646 to fix this issue.  Please consider taking a look.

--

___
Python tracker 

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



[issue41845] Promote PyObject_GenericGetDict to the stable API

2020-10-11 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 4.0 -> 5.0
pull_requests: +21619
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22646

___
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-11 Thread Stefan Behnel


Stefan Behnel  added the comment:

> Don't forget to remove PyGen_Send()

That's the function that allows sending data into a generator. It's also used 
internally by "PyIter_Send()". Are you really suggesting to remove it, or to 
make it underscore-private again? (As it was before.)

--

___
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-11 Thread Jürgen Gmach

Jürgen Gmach  added the comment:

There is PEP 594 (draft), which - when accepted - will remove cgi.FieldStorage

https://www.python.org/dev/peps/pep-0594/

https://discuss.python.org/t/pep-594-removing-dead-batteries-from-the-standard-library/1704

This comes from an idea to relief the burden of maintenance for the maintainers.



Some off-topic comments...

cgi.FieldStorage has quite some unresolved issues, partially open for many 
years, although there are also some pull requests, waiting for review.

While cgi.FieldStorage is certainly a niche thing, it is used by Zope, by 
Plone, by webob... 

The latter even has a 250 line compat module to accomodate for current bugs ( 
https://github.com/Pylons/webob/blob/5c062aef9397b27915c5cc2ed2f202bff7494eca/src/webob/compat.py
 ).

If you, Javier, are also a fan of cgi.FieldStorage want to improve the 
situation with cgi.FieldStorage, maybe you could help reviewing the open issues 
and the open pull requests for cpython?

--
nosy: +jugmac00

___
Python tracker 

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



[issue41971] multiple tests in test_tools fail since Python 3.9

2020-10-11 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy: +yan12125

___
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-11 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

> Offhand do you know what the _best_ timing for two-way search is in a 
> pattern-not-found case?

Looking at the glibc implementation, in the top-level "else" clause
(for when the string isn't completely periodic),
we have:

period = MAX (suffix, needle_len - suffix) + 1;

so period > needle_len / 2.

Then during each iteration of the j-loop (where j is the index into the 
haystack),
j is sometimes incremented by `period`, which would probably give O(n/m) best 
case.

Here's a sublinear example for the two-way algorithm:

N = 10**7
haystack = "ABC" * N
needle1 = "ABC" * (N // 10) + "DDD"
needle2 = "ABC" * 10 + "DDD"

=== Results ===
Pure Python Two-Way, shorter needle: 1.7142754
Pure Python Two-Way. Longer needle:  0.00188450667
Python builtin, shorter needle:  0.0310714082
Python builtin, longer needle:   0.0305660707

This case is surprisingly better than the builtin:

N = 10**7
haystack = "ABC" * N
needle1 = "DDD" + "ABC" * (N // 10)
needle2 = "DDD" + "ABC" * 10

=== Results ===
Pure Python Two-Way, shorter needle: 0.00208950774
Pure Python Two-Way. Longer needle:  0.00178789534
Python builtin, shorter needle:  0.0299981028
Python builtin, longer needle:   0.029634395

This was measured using the attached fastsearch.py. There are some 
manipulations in there like string slicing that would make more sense as 
pointer math in C, so especially accounting for that, I'm guessing it would be 
pretty competitive in a lot of cases.

A lot of the implementations look like they use a complete Boyer-Moore table to 
go sublinear in even more cases, which it seems we want to avoid. I'm not 
certain, but it's conceivable that the existing techniques of using just one 
one delta-value or the "Bloom filter" could be thrown in there to get some of 
the same improvements. Although that could be redundant -- I'm not sure.

--
Added file: https://bugs.python.org/file49507/fastsearch.py

___
Python tracker 

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



[issue42005] profile/cProfile CLI should catch BrokenPipeError

2020-10-11 Thread Ammar Askar


Ammar Askar  added the comment:

Related:

https://bugs.python.org/issue39828

--
nosy: +ammar2, vstinner

___
Python tracker 

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