[issue44555] Dictionary operations are LINEAR for any dictionary (for a particular code).

2021-07-02 Thread Daniel Fleischman
Daniel Fleischman added the comment: Please find attached a more complete example of the issue I am reporting. tl;dr: I can make `sum(d.values())` run in O(maximum_size_in_d's_history) instead of O(len(d)), even when len(d) == 1. The linked list approach would work in terms of making it

[issue44550] DIGITAL CLASSROOM

2021-07-02 Thread skoolbeep
New submission from skoolbeep : A digital classroom setup can be defined as a learning environment created with the help of electronic devices that run on software programmes. This means technology sets the tone of a digital classroom and facilitates access to networks and learning resources

[issue44555] Dictionary operations are LINEAR for any dictionary (for a particular code).

2021-07-02 Thread Daniel Fleischman
Daniel Fleischman added the comment: Thank you for your message! I'm not particularly looking for an implementation, I was just surprised by this behavior. It can get even worse. Consider this example: ``` d = large_dict() # remove all but one element of d, runs in quadratic time as

[issue43336] document whether io.TextIOBase.readline(size>0) will always read the full newline

2021-07-02 Thread Andrei Kulakov
Andrei Kulakov added the comment: I don't think it's incorrect right now, from the POV of internal data of the stream, there's 6 chars, from the POV of caller, 5 chars are read. So this can be interpreted as 2 chars are combined into 1 char read. On the other hand if TextIOBase was reading

[issue44555] Dictionary operations are LINEAR for any dictionary (for a particular code).

2021-07-02 Thread Dennis Sweeney
Dennis Sweeney added the comment: For what it's worth, using collections.OrderedDict gives constant-time behavior you're looking for. -- nosy: +Dennis Sweeney ___ Python tracker

[issue44556] ctypes unittest crashes with libffi 3.4.2

2021-07-02 Thread Zan
New submission from Zan : Running the unittests after upgrading libffi to latest version 3.4.2 and recompiling python, leads to several tests in Lib/ctypes/test/ to crash with Abort: trap 6. This does not happen with version 3.3 of libffi. Steps to reproduce: git clone

[issue43493] EmailMessage mis-folding headers of a certain length

2021-07-02 Thread Andrei Kulakov
Andrei Kulakov added the comment: I've looked into this and it seems to be somewhat intentional, as can be seen in this test case for example: test_headerregistry.py", line 1725, in test_fold_address_list + To: "Theodore H. Perfect" , + "My address is very long because my name is long" , +

[issue11343] Make errors due to full parser stack identifiable

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: The patch relates to the old parser. With the new parser the 100*(+100*) example works. If we go to 1000 instead of 100 we get "SyntaxError: too many nested parentheses". >From the discussion it seems that the idea of a new exception type for

[issue44552] incomplete documentation of __main__.py

2021-07-02 Thread Erik Carstensen
Erik Carstensen added the comment: thanks for the pointer and sorry for the noise! I'll review your text. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-07-02 Thread Erlend E. Aasland
Change by Erlend E. Aasland : -- pull_requests: +25562 pull_request: https://github.com/python/cpython/pull/27001 ___ Python tracker ___

[issue44555] Dictionary operations are LINEAR for any dictionary (for a particular code).

2021-07-02 Thread Daniel Fleischman
Daniel Fleischman added the comment: The linked list solution is not as easy to implement as I expected, because of insertions. :( -- ___ Python tracker ___

[issue44555] Dictionary operations are LINEAR for any dictionary (for a particular code).

2021-07-02 Thread Daniel Fleischman
New submission from Daniel Fleischman : The following code takes quadratic time on the size of the dictionary passed, regardless of the dictionary (explanation below): ``` def slow_dictionary(d): while len(d) > 0: # Remove first element key = next(iter(d)) del

[issue39759] os.getenv documentation is misleading

2021-07-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is not so uncommon to write: foo_rate = float(os.getenv("FOO_RATE", default_foo_rate)) where default_foo_rate is float. In any case the default value for the default parameter is not a string. -- nosy: +serhiy.storchaka

[issue44554] pdb.main is unnecessarily complicated

2021-07-02 Thread Jason R. Coombs
Change by Jason R. Coombs : -- keywords: +patch pull_requests: +25561 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26992 ___ Python tracker ___

[issue44388] venv API Docs for EnvBuilder.ensure_directories incorrectly describe behavior

2021-07-02 Thread miss-islington
miss-islington added the comment: New changeset 4bcef2bb48b3fd82011a89c1c716421b789f1442 by Matthew Clapp in branch 'main': bpo-44388: Update venv EnvBuilder.ensure_directories() docs. (GH-26663) https://github.com/python/cpython/commit/4bcef2bb48b3fd82011a89c1c716421b789f1442 --

[issue44554] pdb.main is unnecessarily complicated

2021-07-02 Thread Jason R. Coombs
New submission from Jason R. Coombs : While investigating issue44461, I observed some complexities to the current pdb.main implementation, some of which likely contributed to the bug being present. - variables are initialized to defaults

[issue44547] fraction.Fraction does not implement __int__.

2021-07-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In ideal world we would use __int__ for (1), and __trunc__ for (2). But for some historical reasons __index__ was introduced for (1) and __int__ is only used in the int constructor, although it falls back to __trunc__. I am wondering whether one of

[issue44534] unittest.mock.Mock.unsafe doc is garbled

2021-07-02 Thread Jack DeVries
Change by Jack DeVries : -- keywords: +patch nosy: +jack__d nosy_count: 2.0 -> 3.0 pull_requests: +25560 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27000 ___ Python tracker

[issue44552] incomplete documentation of __main__.py

2021-07-02 Thread Jack DeVries
Jack DeVries added the comment: This is documented in Doc/library/runpy.rst. Specifically, here: > For a simple script, the specified code is simply executed in a fresh module > namespace. For a valid sys.path entry (typically a zipfile or directory), the > entry is first added to the

[issue43950] Include column offsets for bytecode instructions

2021-07-02 Thread miss-islington
miss-islington added the comment: New changeset ec8759b060eff83ff466f42c5a96d83a685016ce by Batuhan Taskaya in branch 'main': bpo-43950: optimize column table assembling with pre-sizing object (GH-26997) https://github.com/python/cpython/commit/ec8759b060eff83ff466f42c5a96d83a685016ce

[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2021-07-02 Thread Guido van Rossum
Guido van Rossum added the comment: Oh no! Was there a test for this that I ignored? Thanks for cleaning up after me.-- --Guido (mobile) -- ___ Python tracker ___

[issue44544] Add full list of possible args to textwrap: wrap, fill, shorten

2021-07-02 Thread Jack DeVries
Change by Jack DeVries : -- keywords: +patch nosy: +jack__d nosy_count: 2.0 -> 3.0 pull_requests: +25559 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26999 ___ Python tracker

[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: New changeset 7a2d2ed1330e464ac186c09501ef51b8261f4292 by Irit Katriel in branch '3.10': [3.10] bpo-30256: [doc] Fix formatting error in news (GH-26994) (GH-26998) https://github.com/python/cpython/commit/7a2d2ed1330e464ac186c09501ef51b8261f4292 --

[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: New changeset 91db097358bcb00832e53d410035a8b7fcfdd9c3 by Miss Islington (bot) in branch '3.9': bpo-30256: [doc] Fix formatting error in news (GH-26994) (GH-26996) https://github.com/python/cpython/commit/91db097358bcb00832e53d410035a8b7fcfdd9c3 --

[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2021-07-02 Thread Irit Katriel
Change by Irit Katriel : -- pull_requests: +25558 pull_request: https://github.com/python/cpython/pull/26998 ___ Python tracker ___

[issue43950] Include column offsets for bytecode instructions

2021-07-02 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- pull_requests: +25557 pull_request: https://github.com/python/cpython/pull/26997 ___ Python tracker ___

[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2021-07-02 Thread Oscar Benjamin
Oscar Benjamin added the comment: I was contacted by someone interested in this so I've posted the last version above as a GitHub gist under the MIT license: https://gist.github.com/oscarbenjamin/4c1b977181f34414a425f68589e895d1 -- ___ Python

[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: New changeset 2560c612c89ea2534b90a266aabf76dc74d93a12 by Ken Jin in branch 'main': bpo-30256: [doc] Fix formatting error in news (GH-26994) https://github.com/python/cpython/commit/2560c612c89ea2534b90a266aabf76dc74d93a12 -- nosy: +iritkatriel

[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2021-07-02 Thread miss-islington
Change by miss-islington : -- pull_requests: +25556 pull_request: https://github.com/python/cpython/pull/26996 ___ Python tracker ___

[issue44547] fraction.Fraction does not implement __int__.

2021-07-02 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks, that's helpful. I guess what you _really_ want there is a duck-typed "tell me whether this value is integral and if so give me the corresponding Python int", but that's not currently easily available, so I suppose x == int(x) is the next-best thing.

[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2021-07-02 Thread Ken Jin
Change by Ken Jin : -- nosy: +kj nosy_count: 12.0 -> 13.0 pull_requests: +2 pull_request: https://github.com/python/cpython/pull/26994 ___ Python tracker ___

[issue44550] SPAM

2021-07-02 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- resolution: -> not a bug stage: -> resolved status: open -> closed title: DIGITAL CLASSROOM -> SPAM ___ Python tracker ___

[issue44550] SPAM

2021-07-02 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- Removed message: https://bugs.python.org/msg396854 ___ Python tracker ___ ___

[issue44553] types.Union should support GC

2021-07-02 Thread Ken Jin
Change by Ken Jin : -- keywords: +patch pull_requests: +25554 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26993 ___ Python tracker ___

[issue44553] types.Union should support GC

2021-07-02 Thread Ken Jin
New submission from Ken Jin : types.Union objects can contain reference cycles, therefore causing memory leaks. E.g.:: ``` import sys, gc from typing import TypeVar gc.collect() for _ in range(10): sys.gettotalrefcount() T = TypeVar('T') U = int | list[T] T.blah = U del T del U

[issue43950] Include column offsets for bytecode instructions

2021-07-02 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 98eee94421dcb42c15f2d7fc4cd21357722fbe2a by Pablo Galindo in branch 'main': bpo-43950: Add code.co_positions (PEP 657) (GH-26955) https://github.com/python/cpython/commit/98eee94421dcb42c15f2d7fc4cd21357722fbe2a --

[issue44552] incomplete documentation of __main__.py

2021-07-02 Thread Erik Carstensen
New submission from Erik Carstensen : I can find partial information on how Python treats __main__.py here: https://docs.python.org/3/library/__main__.html However, it is not documented how python handles __main__.py when passing the Python package to the interpreter without -m. If I have a

[issue44547] fraction.Fraction does not implement __int__.

2021-07-02 Thread Michael Amrhein
Michael Amrhein added the comment: The background is an implementation of __pow__ for a fixed-point decimal number: SupportsIntOrFloat = Union[SupportsInt, SupportsFloat] def __pow__(self, other: SupportsIntOrFloat, mod: Any = None) -> Complex: if isinstance(other, SupportsInt):

[issue44461] 'Pdb' object has no attribute 'botframe'

2021-07-02 Thread Jason R. Coombs
Change by Jason R. Coombs : -- pull_requests: +25553 pull_request: https://github.com/python/cpython/pull/26992 ___ Python tracker ___

[issue39759] os.getenv documentation is misleading

2021-07-02 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44551] Substraction: unprecise result

2021-07-02 Thread Eric V. Smith
Eric V. Smith added the comment: This is not a bug, but expected floating point behavior. See https://docs.python.org/3/tutorial/floatingpoint.html -- nosy: +eric.smith resolution: -> not a bug stage: -> resolved status: open -> closed type: -> behavior

[issue44551] Substraction: unprecise result

2021-07-02 Thread user_0101
New submission from user_0101 : ``` >>> 2.11-1.56 0.5498 ``` -- messages: 396862 nosy: user_0101 priority: normal severity: normal status: open title: Substraction: unprecise result versions: Python 3.8 ___ Python tracker

[issue44520] In Lib/urllib/parse.py quote_from_bytes, exception is thrown if bs = None

2021-07-02 Thread Eric V. Smith
Eric V. Smith added the comment: I agree this should be closed (and I'm closing it). I don't see any reason why this function should do something other than raise TypeError if given bs=None. If you want that behavior, write a small wrapper function. The "if not bs" check appears to be an

[issue44547] fraction.Fraction does not implement __int__.

2021-07-02 Thread Mark Dickinson
Mark Dickinson added the comment: > As another data point, complex supporting __int__ is a little bit of an > oddity, since all that __int__ method does is raise a TypeError. This was fixed in 3.10: #41974 -- ___ Python tracker

[issue44520] In Lib/urllib/parse.py quote_from_bytes, exception is thrown if bs = None

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: I meant: ... it will be true for bs which is an empty bytes(). You are thinking of b'' and None as if they are the same thing. They are not. If this was a check for None it would be "if bs is None" and not "if not bs". -- status: pending -> open

[issue44520] In Lib/urllib/parse.py quote_from_bytes, exception is thrown if bs = None

2021-07-02 Thread Irit Katriel
Change by Irit Katriel : -- status: open -> pending ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44547] fraction.Fraction does not implement __int__.

2021-07-02 Thread Mark Dickinson
Mark Dickinson added the comment: > Maybe typing.SupportsIndex Apologies: that already exists, of course. It was introduced in #36972. -- ___ Python tracker ___

[issue44520] In Lib/urllib/parse.py quote_from_bytes, exception is thrown if bs = None

2021-07-02 Thread Irit Katriel
Change by Irit Katriel : -- status: open -> pending ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44520] In Lib/urllib/parse.py quote_from_bytes, exception is thrown if bs = None

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: There is still a point in the "if not bs:" check, it will be true for bs which is an empty string. -- ___ Python tracker ___

[issue44547] fraction.Fraction does not implement __int__.

2021-07-02 Thread Mark Dickinson
Mark Dickinson added the comment: I'm actually struggling to think of situations where typing.SupportsInt would be useful in its current form: if I'm writing a function that wants to do a duck-typed acceptance of integer-like things (for example because I want my function to work with NumPy

[issue44520] In Lib/urllib/parse.py quote_from_bytes, exception is thrown if bs = None

2021-07-02 Thread Олег Масло
Олег Масло added the comment: If you pass None to the quote_from_bytes function, then there is no point in the "if not bs" check, because it won't even reach it. This function is not with dynamic behavior, which violates python concepts. If you pass a string instead of bytes, it will throw

[issue44550] DIGITAL CLASSROOM

2021-07-02 Thread skoolbeep
New submission from skoolbeep : A digital classroom setup can be defined as a learning environment created with the help of electronic devices that run on software programmes. https://www.skoolbeep.com/blog/what-makes-up-a-good-digital-classroom/ -- messages: 396854 nosy: skoolbeep

[issue44549] BZip 1.0.6 Critical Vulnerability

2021-07-02 Thread siddhartha shankar mahato
New submission from siddhartha shankar mahato : Python (3.9.5 and 3.9.6 are using Bzip2 1.0.6 which has a known critical vulnerability. CVE-2019-12900 (BDSA-2019-1844) 9.8 Critical NVD CVE-2016-3189 (BDSA-2019-2036). Please upgrade the same to a stable version. -- components:

[issue34798] pprint ignores the compact parameter for dicts

2021-07-02 Thread Irit Katriel
Change by Irit Katriel : -- versions: -Python 3.9 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34798] pprint ignores the compact parameter for dicts

2021-07-02 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue34798] pprint ignores the compact parameter for dicts

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: New changeset 42c26282a123d14591e1aa31107e566b302a19ac by Miss Islington (bot) in branch '3.10': bpo-34798: [doc] clearer presentation of pprint.PrettyPrinter constru… (GH-26967) (GH-26990)

[issue43832] asyncio + multiprocessing = core dump in sem_trywait

2021-07-02 Thread Andrew Svetlov
Change by Andrew Svetlov : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue34798] pprint ignores the compact parameter for dicts

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: New changeset 943e77d42d3f84b581f32c05f1fc8c05366b8ed3 by Irit Katriel in branch 'main': bpo-34798: [doc] clearer presentation of pprint.PrettyPrinter constru… (GH-26967) https://github.com/python/cpython/commit/943e77d42d3f84b581f32c05f1fc8c05366b8ed3

[issue34798] pprint ignores the compact parameter for dicts

2021-07-02 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 5.0 -> 6.0 pull_requests: +25552 pull_request: https://github.com/python/cpython/pull/26990 ___ Python tracker

[issue44520] In Lib/urllib/parse.py quote_from_bytes, exception is thrown if bs = None

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: The documentation states that this function accepts bytes: https://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote_from_bytes None is not of type bytes, so raising a TypeError is not unreasonable. It would certainly be wrong to return any

[issue44520] In Lib/urllib/parse.py quote_from_bytes, exception is thrown if bs = None

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: As I wrote on the PR, and again on this issue, a PR that makes a behavior change (like this one) is not complete without a unit test (which fails before the change and passes after the change, and can show what the bug being fixed is). You could add such a

[issue43518] textwrap.shorten does not always respect word boundaries

2021-07-02 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- assignee: -> serhiy.storchaka versions: +Python 3.11 -Python 3.8 ___ Python tracker ___ ___

[issue44520] In Lib/urllib/parse.py quote_from_bytes, exception is thrown if bs = None

2021-07-02 Thread Олег Масло
Олег Масло added the comment: What are the next actions? Do I need to do something or are we waiting for something? -- ___ Python tracker ___

[issue44547] fraction.Fraction does not implement __int__.

2021-07-02 Thread Mark Dickinson
Mark Dickinson added the comment: FWIW, there's some history here: there's a good reason that fractions.Fraction didn't originally implement __int__. Back in the Bad Old Days, many Python functions that expected an integer would accept anything whose type implemented __int__ instead, and