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

2020-10-17 Thread Tim Peters
Tim Peters added the comment: I don't think we have any idea how the OP stumbled into this. Looks like it "just happened". The case you construted is quadratic-time, but not quite as bad: BaB BB Fails at once, because 'a' doesn't match the

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

2020-10-17 Thread Tim Peters
Tim Peters added the comment: Yup, they act essentially the same, but yours jumps into the quicksand earlier ;-) I'm fond of this one: """ HUGE = 10**7 BIG = 10**6 bigxs = 'x' * BIG haystack = 'x' * HUGE needle = bigxs + 'y' + bigxs "

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

2020-10-18 Thread Tim Peters
Tim Peters added the comment: Dennis, I think that's expected, right? Two-way on its own can exploit nothing about individual characters - it only preprocesses the needle to break the possibility for quadratic-time behavior due to periods in the needle. It sounds like you switche

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

2020-10-18 Thread Tim Peters
Tim Peters added the comment: I confess I _assumed_ all along that you were generalizing the current code's Sunday trick to 7-bit equivalence classes (up from 32 bits total) and 64K possible shift counts (up from just 2 total possibilities: 1 or len(needle)+1). The Sunday trick cou

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

2020-10-22 Thread Tim Peters
Tim Peters added the comment: Note that Sunday doesn't care (at all) where mismatches occur. The "natural" way to add Sunday: follow pure C-P unless/until it finds a mismatching position. Pure C-P then computes a specific shift. Nothing about that changes. But something

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

2020-11-06 Thread Tim Peters
Tim Peters added the comment: I'm sorry I haven't been able to give more time to this. I love what's been done, but am just overwhelmed :-( The main thing here is to end quadratic-time disasters, without doing significant damage in other cases. Toward that end it would be fin

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

2020-11-06 Thread Tim Peters
Tim Peters added the comment: But that also suggests a different approach: start with the current code, but add introspection to switch to your enhancement of C&P if the current code is drifting out of linear-time territory. -- ___ Python tra

[issue42336] Make PCbuild/build.bat build x64 by default

2020-11-12 Thread Tim Peters
Tim Peters added the comment: +1. If you're feeling more ambitious, it would also be good to change build.bat and rt.bat to use the same "which platform?" spellings and with the same defaults. -- nosy: +tim.peters ___ Python

[issue42456] Logical Error

2020-11-24 Thread Tim Peters
Tim Peters added the comment: There's no bug here. "&" is the bitwise Boolean logical-and operator on integers. For example, >>> 1 & 2 0 >>> 1 & 3 1 It binds more tightly than the "==" equality-testing operator. To get the result you w

[issue13879] Argparse does not support subparser aliases in 2.7

2012-01-26 Thread Tim Willis
New submission from Tim Willis : Argparse documentation in 2.7 indicates support for an 'aliases' kwarg. (Fourth example down from http://docs.python.org/dev/library/argparse.html#sub-commands) While aliases work as expected in 3.2, use in 2.7 results in TypeError: __init_

[issue13884] IDLE 2.6.5 Recent Files undocks

2012-01-26 Thread Tim McGreevy
New submission from Tim McGreevy : When selecting from menu: File --> Recent Files the 'Recent Files' dropdown list undocks from the IDLE gui / File dropdown list. Even after selecting a past file, it remains open until closed manually. Ubuntu LUCID amd64 IDLE 2.6.5 TK ve

[issue13879] Argparse does not support subparser aliases in 2.7

2012-01-27 Thread Tim Willis
Tim Willis added the comment: Attaching a patch which merges aliases code from 3.2 back into 2.7. -- keywords: +patch Added file: http://bugs.python.org/file24339/argparse_aliases.patch ___ Python tracker <http://bugs.python.org/issue13

[issue13879] Argparse does not support subparser aliases in 2.7

2012-01-27 Thread Tim Willis
Tim Willis added the comment: adding package author to nosy list -- nosy: +bethard ___ Python tracker <http://bugs.python.org/issue13879> ___ ___ Python-bug

[issue13917] Python 2.7.2 and 3.2.2 execl crash

2012-02-01 Thread Tim Golden
Tim Golden added the comment: This is a duplicate of http://bugs.python.org/issue8036 (which I still haven't got around to applying...) -- nosy: +tim.golden ___ Python tracker <http://bugs.python.org/is

[issue13931] os.path.exists inconsistent between 32 bit and 64 bit

2012-02-03 Thread Tim Golden
Tim Golden added the comment: This is the Windows x64 file system redirector at work. I can't get through to msdn at the moment to get a link, but Google for those terms. -- nosy: +tim.golden ___ Python tracker <http://bugs.python.org/is

[issue13879] Argparse does not support subparser aliases in 2.7

2012-02-03 Thread Tim Willis
Tim Willis added the comment: The documentation appears to be up to date in the current 2.7 repository, so this can probably be marked as closed/fixed. -- ___ Python tracker <http://bugs.python.org/issue13

[issue13936] datetime.time(0, 0, 0) evaluates to False despite being a valid time

2012-02-03 Thread Tim Peters
Tim Peters added the comment: >From the docs, at: http://docs.python.org/library/datetime.html#time-objects """ in Boolean contexts, a time object is considered to be true if and only if, after converting it to minutes and subtracting utcoffset() (or 0 if that’s None),

[issue13936] datetime.time(0, 0, 0) evaluates to False despite being a valid time

2012-02-03 Thread Tim Peters
Tim Peters added the comment: It is odd, but really no odder than "zero values" of other types evaluating to false in Boolean contexts ;-) Closing as "invalid". -- resolution: -> invalid status: open -> closed ___

[issue11620] winsound.PlaySound() with SND_MEMORY should accept bytes instead of strings

2012-02-09 Thread Tim Lesher
Tim Lesher added the comment: This patch should both correct the incorrect acceptance of strings and the incorrect rejection of buffer objects when using SND_MEMORY. -- keywords: +patch Added file: http://bugs.python.org/file24470/11620-PlaySound.patch

[issue3905] subprocess failing in GUI applications on Windows

2012-02-13 Thread Tim Lesher
Changes by Tim Lesher : -- nosy: +tlesher ___ Python tracker <http://bugs.python.org/issue3905> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue14070] reload(module, ignore_pyc=True) flag

2012-02-20 Thread Tim McNamara
New submission from Tim McNamara : When developing Python code, I often find myself needing to run "rm *.pyc" so that the interpreter will ignore any new changes that I have made to source files. It's really frustrating when forgotten. Adding a flag to the reload builtin woul

[issue14070] Idea: Add a flag to reload from source, e.g. reload(module, ignore_pyc=True)

2012-02-21 Thread Tim McNamara
Changes by Tim McNamara : -- title: reload(module, ignore_pyc=True) flag -> Idea: Add a flag to reload from source, e.g. reload(module, ignore_pyc=True) ___ Python tracker <http://bugs.python.org/issu

[issue14070] Idea: Add a flag to reload from source, e.g. reload(module, ignore_pyc=True)

2012-02-21 Thread Tim McNamara
Tim McNamara added the comment: No no, I don't want to ignore source files. I want to be able to change a .py file, then reload in the Python shell and for the changes to be applied. At the moment, .pyc files within a project complicate

[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2012-02-25 Thread Tim Golden
Tim Golden added the comment: On 25/02/2012 08:09, Ezio Melotti wrote: > Even if they know the meaning of "shallow" (which is not a really common word > AFAICT) FWIW it's pretty much the only way of saying what it means. I've no idea how many people used it last

[issue8070] Infinite loop in PyRun_InteractiveLoopFlags() if PyRun_InteractiveOneFlags() raises an error

2012-03-09 Thread Tim Lesher
Tim Lesher added the comment: Victor: would you object to ysj.ray's solution? I don't think it was an option when we last looked at this issue. -- ___ Python tracker <http://bugs.python.

[issue8070] Infinite loop in PyRun_InteractiveLoopFlags() if PyRun_InteractiveOneFlags() raises an error

2012-03-11 Thread Tim Lesher
Tim Lesher added the comment: Updated patch: use Py_FileSystemDefaultEncoding (if possible) when sys.stdin is (or becomes) invalid; if none, then fails without entering infinite loop. Docs for PyRun_InteractiveLoopFlags have been updated. -- Added file: http://bugs.python.org

[issue8070] Infinite loop in PyRun_InteractiveLoopFlags() if PyRun_InteractiveOneFlags() raises an error

2012-03-12 Thread Tim Lesher
Tim Lesher added the comment: Corrected const warning in previous patch. -- Added file: http://bugs.python.org/file24794/8070-use-default-encoding-2.patch ___ Python tracker <http://bugs.python.org/issue8

[issue8010] tkFileDialog.askopenfiles crashes on Windows 7

2012-03-12 Thread Tim Lesher
Changes by Tim Lesher : -- nosy: +tlesher ___ Python tracker <http://bugs.python.org/issue8010> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue14420] winreg SetValueEx DWord type incompatible with value argument

2012-03-27 Thread Tim Golden
Tim Golden added the comment: Brian - I think this is your area -- nosy: +brian.curtin, tim.golden ___ Python tracker <http://bugs.python.org/issue14420> ___ ___

[issue14452] SysLogHandler sends invalid messages when using unicode

2012-04-11 Thread Tim Golden
Tim Golden added the comment: It's used by some systems (Windows Notepad does this if you save as UTF8) to indicate that the byte stream *is* UTF8-encoded. It's not so much a BOM as a magic cookie. I can't speak for syslog, I'm afraid TJG

[issue37000] _randbelow_with_getrandbits function inefficient with powers of two

2019-05-22 Thread Tim Peters
Tim Peters added the comment: I believe the thrust of Mark's suggestion was that it would allow using `k = (n-1).bit_length()` even when n == 1, without special-casing n == 1. But you'd still be adding a new "subtract 1" operation, and would still change results in so

[issue33725] Python crashes on macOS after fork with no exec

2019-05-24 Thread Tim Smith
Change by Tim Smith : -- nosy: +tdsmith ___ Python tracker <https://bugs.python.org/issue33725> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37061] The strangest glitch I have ever seen - incorrect indenterror, even on commented out code.

2019-05-26 Thread Tim Peters
Tim Peters added the comment: As Steven said, there's an obvious indentation error in the file you actually attached. So nobody can _guess_ what your problem is. Please upload a file showing your actual problem. If I increase the indentation of the `print` Steven identified to matc

[issue37061] The strangest glitch I have ever seen - incorrect indenterror, even on commented out code.

2019-05-26 Thread Tim Peters
Tim Peters added the comment: Same kind of problem with the new upload, Bob. Line 38 is: print(Fore.GREEN,"Installed file ",e,Fore.WHITE) indented 8 spaces. Lines 39 and 40 are empty. Then line 41 is: if x>=len(files): # if x is more than or equal to the number of files in t

[issue37029] PyObject_Free is O(N) where N = # of arenas

2019-05-27 Thread Tim Peters
Change by Tim Peters : -- keywords: +patch pull_requests: +13516 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13612 ___ Python tracker <https://bugs.python.org/issu

[issue37029] PyObject_Free is O(N) where N = # of arenas

2019-05-27 Thread Tim Peters
Tim Peters added the comment: Created a PR and assigned myself to this bug. -- assignee: -> tim.peters ___ Python tracker <https://bugs.python.org/issu

[issue37093] http.client aborts header parsing upon encountering non-ASCII header names

2019-05-29 Thread Tim Burke
New submission from Tim Burke : First, spin up a fairly trivial http server: import wsgiref.simple_server def app(environ, start_response): start_response('200 OK', [ ('Some-Canonical', 'headers'), ('sOme-CRAz

[issue37029] PyObject_Free is O(N) where N = # of arenas

2019-05-30 Thread Tim Peters
Tim Peters added the comment: Added file arena.py. This adds some code to the OP's original test, to print out build time and teardown time, and display obmalloc stats. You'll need at least 80GB of RAM to run it - I don't have that much. Building the tree may take on the o

[issue37029] PyObject_Free is O(N) where N = # of arenas

2019-05-31 Thread Tim Peters
Tim Peters added the comment: Thank you so much, Inada! That's very good to hear :-) -- ___ Python tracker <https://bugs.python.org/issue37029> ___ ___

[issue37029] PyObject_Free is O(N) where N = # of arenas

2019-05-31 Thread Tim Peters
Tim Peters added the comment: New changeset 1c263e39c4ed28225a7dc8ca1f24953225ac48ca by Tim Peters in branch 'master': bpo-37029: keep usable_arenas in sorted order without searching (#13612) https://github.com/python/cpython/commit/1c263e39c4ed28225a7dc8ca1f2495

[issue37029] PyObject_Free is O(N) where N = # of arenas

2019-05-31 Thread Tim Peters
Change by Tim Peters : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue29882] Add an efficient popcount method for integers

2019-06-01 Thread Tim Peters
Tim Peters added the comment: I prefer that a negative int raise ValueError, but am OK with it using the absolute value instead (i.e., what it does now). -- ___ Python tracker <https://bugs.python.org/issue29

[issue35431] Add a function for computing binomial coefficients to the math module

2019-06-01 Thread Tim Peters
Tim Peters added the comment: Strongly prefer requiring 0 <= k <= n at first. This is a programming language: it will be applied to real problems, not to abstract proofs where some slop can be helpful in reducing the number of cases that need to be considered. The Twitter fel

[issue35431] Add a function for computing binomial coefficients to the math module

2019-06-02 Thread Tim Peters
Tim Peters added the comment: I'm not convinced, although I agree relaxing k <= n is less damaging than relaxing k >= 0. Python isn't aimed at mathematicians (although some 3rd-party packages certainly are, and they're free to define things however they like).

[issue33694] test_asyncio: test_start_tls_server_1() fails on Python on x86 Windows7 3.7 and 3.x

2019-06-02 Thread Tim Hoffmann
Change by Tim Hoffmann : -- pull_requests: +13627 pull_request: https://github.com/python/cpython/pull/8518 ___ Python tracker <https://bugs.python.org/issue33

[issue35431] Add a function for computing binomial coefficients to the math module

2019-06-02 Thread Tim Peters
Tim Peters added the comment: I'm going to repeat part of an earlier comment :-) """ Please resist pointless feature creep. The original report was about comb(n, k) for integer n and k with 0 <= k <= n and that's all. Everyone who commented appeared t

[issue35431] Add a function for computing binomial coefficients to the math module

2019-06-02 Thread Tim Peters
Tim Peters added the comment: I'm not fatally opposed to relaxing k <= n. David makes some good points about it, and - as Raymond already noted - "0" is consistent with the behavior of itertools.combinations(). The docs would need to change, though, because the factorial

[issue37132] Add a module for integer related math functions

2019-06-02 Thread Tim Peters
Tim Peters added the comment: Ya, I'm mostly with Raymond. `math` was originally a very thin wrapper around C's libm, but we've been moving away from that more and more for decades, and it's no longer the case anyway that the vast bulk of new Python programmers are inti

[issue35431] Add a function for computing binomial coefficients to the math module

2019-06-03 Thread Tim Peters
Tim Peters added the comment: Python needs a benevolent dictator ;-) I'd be happy for Mark, Raymond, or me to play that role here. If it were me, I'd drop the k <= n requirement: both arguments must be non-negative integers. Because a combinatorial (not factorial-, and

[issue37134] [EASY] Use PEP570 syntax in the documentation

2019-06-03 Thread Tim Peters
Tim Peters added the comment: I haven't looked at anything in this PR, so just popping in to confirm that the first time I saw stuff like: len(obj, /) in the docs I had no idea at all what it was trying to say. I thought it was a typo. Also the second, third, fourth, ..., times

[issue37029] PyObject_Free is O(N) where N = # of arenas

2019-06-03 Thread Tim Peters
Tim Peters added the comment: Thank you, Friedl! I appreciate the extra confirmation - and especially on even bigger test cases :-) -- ___ Python tracker <https://bugs.python.org/issue37

[issue37093] http.client aborts header parsing upon encountering non-ASCII header names

2019-06-03 Thread Tim Burke
Change by Tim Burke : -- keywords: +patch pull_requests: +13672 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/13788 ___ Python tracker <https://bugs.python.org/issu

[issue37166] inspect.findsource doesn't handle shortened files gracefully

2019-06-05 Thread Tim Hatch
New submission from Tim Hatch : inspect.findsource() can trigger IndexError when co_firstlineno is larger than len(linecache.getlines()). If you have a situation where the file that linecache finds doesn't match the imported module, then you're not guaranteed that co_firstlineno o

[issue37166] inspect.findsource doesn't handle shortened files gracefully

2019-06-05 Thread Tim Hatch
Change by Tim Hatch : -- type: -> behavior ___ Python tracker <https://bugs.python.org/issue37166> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue37168] Decimal divisions sometimes 10x or 100x too large

2019-06-05 Thread Tim Peters
Tim Peters added the comment: Also basic: run hardware CPU and memory stress diagnostics, and/or try running the same thing on a different machine. Hardware isn't infallible, and can fail in nearly arbitrary ways. For example, perhaps a smidgen of silicon has gone flaky, so that one

[issue37178] One argument form of math.perm()

2019-06-06 Thread Tim Peters
Tim Peters added the comment: I agree: perm(n) should return factorial(n). -- ___ Python tracker <https://bugs.python.org/issue37178> ___ ___ Python-bugs-list m

[issue37211] obmalloc: eliminate limit on pool size

2019-06-09 Thread Tim Peters
New submission from Tim Peters : On 64-bit Python, many object sizes essentially doubled over 32-bit Python, because Python objects are so heavy with pointers. More recently, forcing alignment to 16 bytes on 64-bit boxes boosted the memory requirements more modestly. But obmalloc's 25

[issue37211] obmalloc: eliminate limit on pool size

2019-06-09 Thread Tim Peters
Change by Tim Peters : -- keywords: +patch pull_requests: +13801 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13934 ___ Python tracker <https://bugs.python.org/issu

[issue37211] obmalloc: eliminate limit on pool size

2019-06-09 Thread Tim Peters
Change by Tim Peters : -- assignee: -> tim.peters ___ Python tracker <https://bugs.python.org/issue37211> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue37257] obmalloc: stop simple arena thrashing

2019-06-12 Thread Tim Peters
New submission from Tim Peters : Scenario: all arenas are fully used. A program then runs a loop like: while whatever: p = malloc(n) ... free(p) At the top, a new arena has to be created, and a single object is taken out of a single pool. At the bottom, that object is

[issue37257] obmalloc: stop simple arena thrashing

2019-06-12 Thread Tim Peters
Change by Tim Peters : -- type: -> performance ___ Python tracker <https://bugs.python.org/issue37257> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue37257] obmalloc: stop simple arena thrashing

2019-06-12 Thread Tim Peters
Change by Tim Peters : -- keywords: +patch pull_requests: +13903 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/14039 ___ Python tracker <https://bugs.python.org/issu

[issue37257] obmalloc: stop simple arena thrashing

2019-06-12 Thread Tim Peters
Tim Peters added the comment: New changeset d1c85a27ea9fe70163cad3443d5e534d94f08284 by Tim Peters in branch 'master': bpo-37257: obmalloc: stop simple arena thrashing (#14039) https://github.com/python/cpython/commit/d1c85a27ea9fe70163cad3443d5e53

[issue37257] obmalloc: stop simple arena thrashing

2019-06-12 Thread Tim Peters
Change by Tim Peters : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue32846] Deletion of large sets of strings is extra slow

2019-06-14 Thread Tim Peters
Tim Peters added the comment: Looks likely that the _major_ cause of the quadratic-time delete behavior was due to that obmalloc used a linear-time method to keep its linked list of usable arenas sorted in order of number of free pools. When a pool became unused, its arena's count of

[issue32846] Deletion of large sets of strings is extra slow

2019-06-14 Thread Tim Peters
Change by Tim Peters : -- stage: resolved -> commit review ___ Python tracker <https://bugs.python.org/issue32846> ___ ___ Python-bugs-list mailing list Un

[issue32846] Deletion of large sets of strings is extra slow

2019-06-14 Thread Tim Peters
Tim Peters added the comment: Raymond, please read my very recent comment one above yours. A (overall) quadratic-time algorithm (O(A**2) where A is the number of arenas) in obmalloc.c is (to my eyes) probably the _primary_ cause of the sloth here. That's been fixed for 3.8, but I

[issue32846] Deletion of large sets of strings is extra slow

2019-06-15 Thread Tim Peters
Tim Peters added the comment: Thanks, Terry! Based on your latest results, "quadratic time" isn't plausible here anymore, so I'm closing this. Nasty cache effects certainly played a role, but they were just a flea on the dog ;-) -- resolution: -> fix

[issue37295] Possible optimizations for math.comb()

2019-06-17 Thread Tim Peters
Tim Peters added the comment: In real life, I expect 99.999%+ of calls will be made with small arguments, so (1) is worth it. I like Mark's suggestion to use uint64_t so the acceptable range doesn't depend on platform. At least in the world I live in, 32-bit boxes are all b

[issue37341] str.format and f-string divergence

2019-06-19 Thread Tim Hatch
New submission from Tim Hatch : TL;DR f"{x+2}" and f"{x=}" do something sensible. "{x+2}".format(x=1) and "{x=}".format(x=1) raise KeyError. f"{0.1}" and "{0.1}".format(...) are different. Having had a feature request to be able t

[issue37341] str.format and f-string divergence

2019-06-19 Thread Tim Hatch
Tim Hatch added the comment: ok, I suppose it's just documentation then. -- assignee: -> docs@python components: +Documentation -Library (Lib) nosy: +docs@python ___ Python tracker <https://bugs.python.org

[issue37346] Documentation of os not using OSError subclasses

2019-06-20 Thread Tim Hoffmann
New submission from Tim Hoffmann : The documentation of `os` does not use the more specific `OSError` subclasses introduced in PEP 3151. -- assignee: docs@python components: Documentation messages: 346110 nosy: docs@python, timhoffm priority: normal severity: normal status: open title

[issue37346] Documentation of os not using OSError subclasses

2019-06-20 Thread Tim Hoffmann
Change by Tim Hoffmann : -- keywords: +patch pull_requests: +14090 stage: -> patch review pull_request: https://github.com/python/cpython/pull/14262 ___ Python tracker <https://bugs.python.org/issu

[issue37434] Segfault in typeobject.c at _PyObject_GC_UNTRACK(type)

2019-06-27 Thread Tim Lusk
New submission from Tim Lusk : I'm working on porting an application from Python 3.6.8 to 3.7.3 and am running into this segfault. I'm not able to pin point exactly what Python code is causing this as it's a very large enterprise application and I can't seem to pinpoint e

[issue37434] Segfault in typeobject.c at _PyObject_GC_UNTRACK(type)

2019-06-27 Thread Tim Lusk
Tim Lusk added the comment: Alright I was finally able to reproduce the issue with a small code snip and capture the stack in gdb. It looks like the issue has something to do with an exception thrown while importing a class (and possibly only when the class is a c_ext, but I haven&#

[issue37448] obmalloc: radix tree for tracking arena address ranges

2019-06-29 Thread Tim Peters
Change by Tim Peters : -- nosy: +tim.peters ___ Python tracker <https://bugs.python.org/issue37448> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37434] Segfault in typeobject.c at _PyObject_GC_UNTRACK(type)

2019-06-29 Thread Tim Peters
Tim Peters added the comment: I haven't used protobuf, but it's _generally_ true that crashes that occur for the first time in the presence of C or C++ extension modules are due to subtle (or not so subtle) mistakes in using the sometimes-delicate Python C API. So it's t

[issue37454] Clarify docs for math.log1p()

2019-07-01 Thread Tim Peters
Tim Peters added the comment: Mark's analysis is spot-on - good eye :-) Here under 3.7.3 [MSC v.1916 64 bit (AMD64)] on win32, in the original script it makes no difference at all for negative "small x" (where, as Mark said, `1 - random.random()` is exactly representable):

[issue37500] 3.8.0b2 no longer optimizes away "if 0:" ?

2019-07-05 Thread Tim Peters
Tim Peters added the comment: I hate this change :-( The code generated for something like this today: def f(): if 0: x = 1 elif 0: x = 2 elif 1: x = 3 elif 0: x = 4 else: x = 5 print(x) is the same as for: def f(): x = 3

[issue37500] 3.8.0b2 no longer optimizes away "if 0:" ?

2019-07-05 Thread Tim Peters
Tim Peters added the comment: There's "correctness" that matters and "correctness" that's merely pedantic ;-) CPython has acted the current way for about 15 years (since 2.4 was released), and this is the first time anyone has raised an objection. That'

[issue37500] 3.8.0b2 no longer optimizes away "if 0:" ?

2019-07-05 Thread Tim Peters
Tim Peters added the comment: > This is the expected result of fixing a bug that has been > open since 2008 It's the expected result of fixing a bug _by_ eliminating the optimization entirely. It's not an expected result of merely fixing the bug. It's quite obvious

[issue37500] 3.8.0b2 no longer optimizes away "if 0:" ?

2019-07-05 Thread Tim Peters
Tim Peters added the comment: > Using jumps is not removing the optimization > entirely, is just a weaker and more incomplete > way of doing the same. Sorry, I'm afraid I have no idea what that means. The generated code before and after was wildly different, as shown in

[issue37500] 3.8.0b2 no longer optimizes away "if 0:" ?

2019-07-05 Thread Tim Peters
Tim Peters added the comment: > we could say that it does not matter if > > def f(): > if 0: > yield > > should be or not a generator Slippery slope arguments play better if they're made _before_ a decade has passed after the slope was fully greased. There&

[issue37543] Optimize pymalloc for non PGO build

2019-07-10 Thread Tim Peters
Change by Tim Peters : -- nosy: +tim.peters ___ Python tracker <https://bugs.python.org/issue37543> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37537] Compute allocated blocks in _Py_GetAllocatedBlocks()

2019-07-10 Thread Tim Peters
Change by Tim Peters : -- nosy: +tim.peters ___ Python tracker <https://bugs.python.org/issue37537> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35621] asyncio.create_subprocess_exec() only works with main event loop

2019-07-18 Thread Tim Froehlich
Tim Froehlich added the comment: Is it possible to amend the documentation (https://docs.python.org/3.5/library/asyncio-subprocess.html, etc) to include a note that the loop parameter doesn't work? I'm impacted by this bug and lost a few hours to it. -- nosy: +Tim

[issue1346874] httplib simply ignores CONTINUE

2019-07-21 Thread Tim B
Change by Tim B : -- pull_requests: +14665 pull_request: https://github.com/python/cpython/pull/14880 ___ Python tracker <https://bugs.python.org/issue1346

[issue1346874] httplib simply ignores CONTINUE

2019-07-21 Thread Tim B
Change by Tim B : -- versions: +Python 3.9 ___ Python tracker <https://bugs.python.org/issue1346874> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1346874] httplib simply ignores CONTINUE

2019-07-21 Thread Tim B
Tim B added the comment: I've created a PR to potentially implement this in 3.9. Please take a look and review/test, if this issue is still relevant to you. -- nosy: +tbartlett0 ___ Python tracker <https://bugs.python.org/issu

[issue37727] error past 15 places

2019-07-30 Thread Tim Peters
Tim Peters added the comment: You'll see much the same in every programming language that supports your computer's floating-point hardware. Start by reading this gentle introduction: https://docs.python.org/3/tutorial/floatingpoint.html This bug tracker isn't a place for tu

[issue37787] Minimum denormal or ** bug

2019-08-07 Thread Tim Peters
Tim Peters added the comment: Python delegates exponentiation with a Python float result to the platform C's double precision `pow()` function. So this is just what the Windows C pow(2.0, -1075.0) returns. All native floating point operations are subject various kinds of error, and

[issue37004] SequenceMatcher.ratio() noncommutativity not well-documented

2019-08-07 Thread Tim Peters
Change by Tim Peters : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.or

[issue37787] Minimum denormal or ** bug

2019-08-07 Thread Tim Peters
Tim Peters added the comment: Since this depends on the platform libm implementation of pow(), I'm closing this as "won't fix". Steve, on the chance you're serious ;-) , there are implementations of the "constructive reals", which indeed act like infinit

[issue37807] Make hash() return a non-negative number

2019-08-10 Thread Tim Peters
Tim Peters added the comment: Well, I have no code that would benefit from this change. What's the point? Sure, I use _parts_ of hash codes at times, but, e.g., index = the_hash_code & SOME_LOW_BIT_MASK in Python couldn't care less about the sign of `the_hash_code`

[issue37807] Make hash() return a non-negative number

2019-08-11 Thread Tim Peters
Tim Peters added the comment: I agree: we "shouldn't have" documented anything about hash codes beyond the invariants needed to guarantee they work for their intended purpose, chiefly that x == y implies hash(x) == hash(y). Which leads to your other question ;-) That inva

[issue37831] bool(~True) == True

2019-08-12 Thread Tim Peters
Tim Peters added the comment: Mark, isn't `int()` the obvious way "to convert an integer-like thing to an actual int"? >>> int(True) 1 >>> int(False) 0 For the rest, I'm -True on making ~ do something magical for bools inconsistent with what

[issue37831] bool(~True) == True

2019-08-12 Thread Tim Peters
Tim Peters added the comment: I don't agree that "~" doesn't "work". If people are reading it as "not", they're in error. The Python docs say ~x means the bits of x inverted and that's what it does. There's no sense it whic

[issue37831] bool(~True) == True

2019-08-12 Thread Tim Peters
Tim Peters added the comment: BTW, I should clarify that I think the real "sin" here was making bool a subclass of int to begin with. For example, there's no sane reason at all for bools to support division, and no reason for a distinct type not to define "~&quo

[issue30681] email.utils.parsedate_to_datetime() should return None when date cannot be parsed

2017-06-15 Thread Tim Bell
New submission from Tim Bell: Python 3.6 documentation for email.utils.parsedate_to_datetime() says "Performs the same function as parsedate(), but on success returns a datetime." The docs for parsedate() say "If it succeeds in parsing the date...; otherwise None will b

[issue30681] email.utils.parsedate_to_datetime() should return None when date cannot be parsed

2017-06-15 Thread Tim Bell
Changes by Tim Bell : -- pull_requests: +2274 ___ Python tracker <http://bugs.python.org/issue30681> ___ ___ Python-bugs-list mailing list Unsubscribe:

<    4   5   6   7   8   9   10   11   12   13   >