[issue40282] random.getrandbits(0) should succeed

2020-04-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: About a hypothetical getrandbytes(), probably 90% of my uses of getrandbits() have been to generate random bytestrings. -- ___ Python tracker __

[issue40282] random.getrandbits(0) should succeed

2020-04-14 Thread Antoine Pitrou
Change by Antoine Pitrou : -- stage: -> needs patch ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue40282] random.getrandbits(0) should succeed

2020-04-14 Thread Antoine Pitrou
Change by Antoine Pitrou : -- components: +Library (Lib) ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue40282] random.getrandbits(0) should succeed

2020-04-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: Why not use secrets.token_bytes() or randrange(2**b).to_bytes()? Do you really need an API extension? -- nosy: +tim.peters ___ Python tracker _

[issue40282] random.getrandbits(0) should succeed

2020-04-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: I agree I don't *need* it per se. However, I suspect that for non-exports it would be easier than `getrandbits(nbytes * 8).to_bytes(nbytes, 'endian')`. As for `secrets.token_bytes()`, it's not really adequate for regular pseudo-random data generation when y

[issue40284] Add mapping methods to types.SimpleNamespace

2020-04-14 Thread Raymond Hettinger
New submission from Raymond Hettinger : types.SimpleNamespace() would be much more usable if it were more substitutable for dictionaries. In particular, it would be wonderful to be able to use object_hook=SimpleNamespace in json.load(): Current: catalog = json.load(f) print(catal

[issue40284] Add mapping methods to types.SimpleNamespace

2020-04-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: Only the magic methods need to be added: __getitem__, __setitem__, and __delitem__, __contains__, __len__, and __iter__. The non-dunder names risk incursion into user-space names. >>> SimpleNamespace(username1='value1', username2='value2') namespace(user

[issue40284] Add mapping methods to types.SimpleNamespace

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: I would prefer that SimpleNamespace remains as simple as it is: https://docs.python.org/dev/library/types.html#types.SimpleNamespace "A simple object subclass that provides attribute access to its namespace" If you want to add the mapping protocol, I suggest

[issue40284] Add mapping methods to types.SimpleNamespace

2020-04-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I would prefer that SimpleNamespace remains as simple as it is This doesn't affect the simplicity of the current API at all. If you don't need the feature, you won't even notice the extension. > If you want to add the mapping protocol, I suggest you to

[issue40282] random.getrandbits(0) should succeed

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: > That is feature creep and no user has requested it. Python already provides such function in the secrets module, so I'm not sure if what you mean that "no users has requested it". secrets.token_bytes() exists because there is a need for such function. sec

[issue40284] Add mapping methods to types.SimpleNamespace

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: > Providing this tool would instantly benefit a broad class of json users. I'm not saying that there is no need for such tool. I am just asking to leave SimpleNamespace unchanged. -- ___ Python tracker

[issue35569] OSX: Enable IPV6_RECVPKTINFO

2020-04-14 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- pull_requests: +18876 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/19526 ___ Python tracker ___

[issue40286] Add getrandbytes() method to random.Random

2020-04-14 Thread STINNER Victor
New submission from STINNER Victor : The random module lacks a getrandbytes() method which leads developers to be creative how to generate bytes: https://stackoverflow.com/questions/5495492/random-byte-string-in-python It's a common use request: * bpo-13396 in 2011 * bpo-27096 in 2016 * https

[issue40286] Add getrandbytes() method to random.Random

2020-04-14 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +18877 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19527 ___ Python tracker ___ _

[issue40282] random.getrandbits(0) should succeed

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: I created bpo-40286: Add getrandbytes() method to random.Random. -- ___ Python tracker ___ ___ Py

[issue40255] Fixing Copy on Writes from reference counting

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: This feature seems to be driven by Instagram use case. Are there other users who would benefit of that? Is it a common use case to load big data and then fork to use preloaded data? PR 19474 has a maintenance cost: * new configuration option * new macro * n

[issue40286] Add getrandbytes() method to random.Random

2020-04-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: If we have to have this, the method name should be differentiated from getrandbits() because the latter returns an integer. I suggest just random.bytes(n), the same as numpy. > Python already has three functions to generate random bytes: Now, there will

[issue37957] Allow regrtest to receive a file with test (and subtests) to ignore

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: New changeset b894b669c98cc365b84cbb8d20f531f1d0686f59 by Victor Stinner in branch '3.7': Update libregrtest from master (GH-19517) https://github.com/python/cpython/commit/b894b669c98cc365b84cbb8d20f531f1d0686f59 -- ___

[issue36842] Implement PEP 578

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: New changeset b894b669c98cc365b84cbb8d20f531f1d0686f59 by Victor Stinner in branch '3.7': Update libregrtest from master (GH-19517) https://github.com/python/cpython/commit/b894b669c98cc365b84cbb8d20f531f1d0686f59 -- nosy: +vstinner ___

[issue38502] regrtest: use process groups

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: New changeset b894b669c98cc365b84cbb8d20f531f1d0686f59 by Victor Stinner in branch '3.7': Update libregrtest from master (GH-19517) https://github.com/python/cpython/commit/b894b669c98cc365b84cbb8d20f531f1d0686f59 -- ___

[issue36670] regrtest: win_utils decodes typeperf output from the wrong encoding (test suite broken due to cpu usage feature on win 10/ german)

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: New changeset b894b669c98cc365b84cbb8d20f531f1d0686f59 by Victor Stinner in branch '3.7': Update libregrtest from master (GH-19517) https://github.com/python/cpython/commit/b894b669c98cc365b84cbb8d20f531f1d0686f59 -- ___

[issue37531] Fix regrtest timeout for subprocesses: regrtest -jN --timeout=SECONDS

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: New changeset b894b669c98cc365b84cbb8d20f531f1d0686f59 by Victor Stinner in branch '3.7': Update libregrtest from master (GH-19517) https://github.com/python/cpython/commit/b894b669c98cc365b84cbb8d20f531f1d0686f59 -- ___

[issue40284] Add mapping methods to types.SimpleNamespace

2020-04-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I'm not saying that there is no need for such tool. > I am just asking to leave SimpleNamespace unchanged. I really don't see the downside. It doesn't impair SimpleNamespace in any way. Why would we add another type with substantially the same capabili

[issue39481] Implement PEP 585 (Type Hinting Generics In Standard Collections)

2020-04-14 Thread Guido van Rossum
Guido van Rossum added the comment: New changeset d01628e411752ee6849f862cae66a1c69fe512b7 by Ethan Smith in branch 'master': bpo-39481: PEP 585 for dataclasses, mailbox, contextvars (GH-19425) https://github.com/python/cpython/commit/d01628e411752ee6849f862cae66a1c69fe512b7 -- ___

[issue40270] activate (or include) json1 extension in sqlite

2020-04-14 Thread Ammar Askar
Change by Ammar Askar : -- keywords: +patch nosy: +ammar2 nosy_count: 5.0 -> 6.0 pull_requests: +18878 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/19528 ___ Python tracker

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18879 pull_request: https://github.com/python/cpython/pull/19529 ___ Python tracker ___ __

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-2897: Deprecate structmember.h. -- ___ Python tracker ___ ___ Python-bugs-list maili

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: New changeset 62183b8d6d49e59c6a98bbdaa65b7ea1415abb7f by Victor Stinner in branch 'master': bpo-40268: Remove explicit pythread.h includes (#19529) https://github.com/python/cpython/commit/62183b8d6d49e59c6a98bbdaa65b7ea1415abb7f -- __

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18880 pull_request: https://github.com/python/cpython/pull/19530 ___ Python tracker ___ __

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: New changeset 4a21e57fe55076c77b0ee454e1994ca544d09dc0 by Victor Stinner in branch 'master': bpo-40268: Remove unused structmember.h includes (GH-19530) https://github.com/python/cpython/commit/4a21e57fe55076c77b0ee454e1994ca544d09dc0 -- __

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18881 pull_request: https://github.com/python/cpython/pull/19531 ___ Python tracker ___ __

[issue39481] Implement PEP 585 (Type Hinting Generics In Standard Collections)

2020-04-14 Thread Ethan Smith
Ethan Smith added the comment: I went through the list I generated and it seems that the ipaddress._BaseNetwork and mmap.mmap cases are the only one I saw that shouldn't be generic. I will submit a PR to revert those. The only item left after that which I know of is _lru_cache_wrapper. On Tue,

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: New changeset d9ea5cae1d07e1ee8b03540a9367c26205e0e360 by Victor Stinner in branch 'master': bpo-40268: Remove unused pycore_pymem.h includes (GH-19531) https://github.com/python/cpython/commit/d9ea5cae1d07e1ee8b03540a9367c26205e0e360 -- __

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18882 pull_request: https://github.com/python/cpython/pull/19532 ___ Python tracker ___ __

[issue39522] AST Unparser with unicode kinded constants

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: commit aade1cc453698e1bc48861b16955c2c2219ec521 Author: Batuhan Taşkaya Date: Tue Apr 14 21:55:01 2020 +0300 bpo-395222: Correctly unparse unicode prefix in ast_unparse.c (GH-19512) -- nosy: +vstinner ___ Pyt

[issue39522] AST Unparser with unicode kinded constants

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: Many buildbots failed. Example: https://buildbot.python.org/all/#/builders/500/builds/288 == FAIL: test_annotations (test.test_future.AnnotationsFutureTestCase) --

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: New changeset 361dcdcefc80f5729ed18ac0ef73327794fbf400 by Victor Stinner in branch 'master': bpo-40268: Remove unused osdefs.h includes (GH-19532) https://github.com/python/cpython/commit/361dcdcefc80f5729ed18ac0ef73327794fbf400 --

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18883 pull_request: https://github.com/python/cpython/pull/19533 ___ Python tracker ___ __

[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: PyType_FromSpec() and PyType_Spec API are not currently compatible with opaque PyObject. Example: --- #define PyObject_HEADPyObject ob_base; typedef struct { PyObject_HEAD ... } MyObject; static PyType_Spec type_spec = { .name = "MyObject",

[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: On python-dev, Ronald Oussoren asked to add support for the buffer protocol in PyType_FromSpec() and PyTypeSpec API: Ronald: > BTW. This will require growing the PyTypeSpec ABI a little, there are > features you cannot implement using that API for example th

[issue40287] SpooledTemporaryFile.seek returns None

2020-04-14 Thread amcinnes
New submission from amcinnes : The documentation says SpooledTemporaryFile "operates exactly as TemporaryFile() does". seek() would be expected to return the new absolute position; this is what it does for TemporaryFile, and is the documented behaviour of seek() in IOBase. But for SpooledTem

[issue39481] Implement PEP 585 (Type Hinting Generics In Standard Collections)

2020-04-14 Thread Guido van Rossum
Guido van Rossum added the comment: Thanks! -- --Guido (mobile) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
STINNER Victor added the comment: New changeset 4f98f465f14e7258c5b18a62c5aa114dbe1174d8 by Victor Stinner in branch 'master': bpo-40268: Remove unused imports in pylifecycle.c (GH-19533) https://github.com/python/cpython/commit/4f98f465f14e7258c5b18a62c5aa114dbe1174d8 -- _

[issue40268] Reorganize pycore_pystate.h header

2020-04-14 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18884 pull_request: https://github.com/python/cpython/pull/19536 ___ Python tracker ___ __

[issue40288] atexit module should not be loaded more than once per interpreter

2020-04-14 Thread STINNER Victor
New submission from STINNER Victor : Since Python 3.7, it's possible to load the atexit module more than once: commit 776407fe893fd42972c7e3f71423d9d86741d07c Author: Marcel Plch Date: Wed Dec 20 11:17:58 2017 +0100 bpo-31901: atexit callbacks should be run at subinterpreter shutdown (#

[issue40277] Improve repr for _tuplegetter objects

2020-04-14 Thread Ammar Askar
Change by Ammar Askar : -- keywords: +patch nosy: +ammar2 nosy_count: 1.0 -> 2.0 pull_requests: +18885 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19537 ___ Python tracker ___

[issue36780] Interpreter exit blocks waiting for futures of shut-down ThreadPoolExecutors

2020-04-14 Thread Kyle Stanley
Kyle Stanley added the comment: > Agreed, and that is precisely what I suggested in my previous comment. The > attached PR already deals with the executor-specific part of the wait, but it > would be straightforward to have it also affect the executor to create daemon > threads, and the flag

[issue40289] "highlighting" how to get Python's Scripts directory in the documentation

2020-04-14 Thread thautwarm
Change by thautwarm : -- assignee: -> docs@python components: +Documentation nosy: +docs@python versions: +Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker __

[issue40289] "highlighting" how to get Python's Scripts directory in the documentation

2020-04-14 Thread thautwarm
New submission from thautwarm : Currently it's barely impossible for us to search about "How to get where Scripts directory/folder is". If we google this, we can only get answers about '__file__', which is far from the expectation. The correct information lies on - https://github.com/python/

[issue28002] ast.unparse can't roundtrip some f-strings

2020-04-14 Thread Shantanu
Shantanu added the comment: Now that `ast.unparse` is being added to stdlib, I thought I'd bump this thread. The third party library `astunparse` (which attempts to support multiple Python versions while staying very close to Tools/parser/unparse.py) has an implementation that works for comp

[issue39522] AST Unparser with unicode kinded constants

2020-04-14 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I think that this was fixes by PR19525 and PR19523. For instance, the buildbot you mentioned is green when building those PRs: https://buildbot.python.org/all/#/builders/500/builds/289 -- ___ Python tracker

[issue39522] AST Unparser with unicode kinded constants

2020-04-14 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I checked and all current buildbot failures are related to the refleak in test_threading so I think this issue is fixed. I will close the issue, please reopen of I missed something or you would like to address something else :) -- resolution:

[issue40290] Add z_score to statistics.NormalDist

2020-04-14 Thread Raymond Hettinger
New submission from Raymond Hettinger : I've had a couple of requests for a z-score method, once to produce an actual z-score for output and another as a way of normalizing gaussian inputs for machine learning. Proposed: >>> iq = NormalDist(100, 15) >>> iq.zscore(142) 2.8 Same r

[issue40284] Add mapping methods to types.SimpleNamespace

2020-04-14 Thread Glenn Linderman
Glenn Linderman added the comment: Yes, I laud this effort. I don't care if it is called SimpleNamespace (which I didn't use because it was insufficient), or anything else, but it would be extremely handy to have this battery. I eventually found one called Dotable (or did I rename it to that

[issue40284] Add mapping methods to types.SimpleNamespace

2020-04-14 Thread Glenn Linderman
Glenn Linderman added the comment: Here's what I have. Maybe it would be better if parse and dump were under or dunder names, although I think parse was in the original implementation I found. Is this the derived from the same original as PyPI dotable? Not sure. -- Added file: https

[issue40291] socket library support for CAN_J1939

2020-04-14 Thread Karl Ding
New submission from Karl Ding : It would be nice to have support J1939 sockets. Support for J1939 landed as part of the SAE J1939 SocketCAN patches, which are available after the Linux 5.4rc1 kernel. This is another protocol family for SocketCAN, much like the existing support for ISOTP and B

[issue38583] The activate script in Windows is not correct for venvs created in git-bash

2020-04-14 Thread Mark Mikofski
Mark Mikofski added the comment: Would you consider just handling activate for windows directly in the lib/venv/__init__.py method "install_scripts(self, context, path)" https://github.com/python/cpython/blob/4f98f465f14e7258c5b18a62c5aa114dbe1174d8/Lib/venv/__init__.py#L382 if not srcfil

[issue40291] socket library support for CAN_J1939

2020-04-14 Thread Karl Ding
Change by Karl Ding : -- keywords: +patch pull_requests: +18886 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19538 ___ Python tracker ___ __

[issue40277] Improve repr for _tuplegetter objects

2020-04-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset a86b522d8f1c8b9c26b5550de221d2227158cf4d by Ammar Askar in branch 'master': bpo-40277: Add a repr() to namedtuple's _tuplegetter to aid with introspection (GH-19537) https://github.com/python/cpython/commit/a86b522d8f1c8b9c26b5550de221d22271

[issue40277] Improve repr for _tuplegetter objects

2020-04-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the PR :-) -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ _

<    1   2