[issue33919] Expose _PyCoreConfig structure to Python

2019-05-27 Thread STINNER Victor
STINNER Victor added the comment: So far, there is no clear agreement to expose C PyConfig structure in Python, so I close the issue. My PEP 587 has been accepted. I chose to not expose PyConfig in Python in the PEP. But I'm open to revisit this idea later, especially to move towards PEP

[issue33919] Expose _PyCoreConfig structure to Python

2019-05-14 Thread STINNER Victor
STINNER Victor added the comment: Update. I implemented _testinternalcapi.get_configs() which exports *all* Python configuration used to initialize Python. It contains the hash seed for example. The function is only written for tests. Moreover, I proposed the PEP 587 to expose the new

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-25 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: On Jun 23, 2018, at 20:21, Nick Coghlan wrote: > > Only exposing a `forced_hash_seed` (and hiding randomly generated ones as > `forced_hash_seed=None`) seems reasonable though, since those can already be > read from os.environ anyway. Only mirroring

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-23 Thread Nick Coghlan
Nick Coghlan added the comment: Back on the original hash seed topic: 1. The exact size of the seed ranges from 128 bits (SIPHash) to 32-bits depending on exactly which hash algorithm you're talking about (https://www.python.org/dev/peps/pep-0456/#hash-secret) 2. While PEP 456 doesn't

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-23 Thread Nick Coghlan
Nick Coghlan added the comment: I'm thoroughly open to co-author requests for PEP 432 - the "Let's implement it as a private API for Python 3.7 and see what we learn from the experience" plan worked beautifully, but it *also* means the PEP text is now woefully out of date with reality :)

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-23 Thread STINNER Victor
STINNER Victor added the comment: > We could make the hash_seed 64 bits. On my 64-bit Linux, _Py_HashSecret_t takes 24 bytes (192 bits). -- ___ Python tracker ___

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-22 Thread Barry A. Warsaw
Change by Barry A. Warsaw : -- keywords: +patch pull_requests: +7475 stage: needs patch -> patch review ___ Python tracker ___ ___

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-22 Thread Eric Snow
Change by Eric Snow : -- nosy: +emilyemorehouse, eric.snow ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-22 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: Although I guess that would require modifications to lcg_urandom(). I don't feel qualified to change that function. -- ___ Python tracker

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-22 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: We could make the hash_seed 64 bits. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-22 Thread STINNER Victor
STINNER Victor added the comment: Barry: generating a 32 bit seed gives less entropy and so makes Python easier to crash. If you need reproducible Python: generate a seed and set the env var before starting Python. Tox does that. Regrtest should do that. --

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-22 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: Nosying Nick. I agree there's some overlap with Python startup restructuring, but it feels kind of orthogonal too. I really am only exposing (some elements) of that structure to Python. What might be interesting though would be if we want to expose the

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-22 Thread STINNER Victor
STINNER Victor added the comment: Nick plans to finish his PEP 432 for Python 3.8 and make the API public. See with him? The PEP should document these structures but I was ahead and made changes which were not scheduled and the PEP is now outdated. --

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-22 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: I think there's another thing I'd like to change, and it seems like it's "just" an implementation detail. In _Py_HashRandomization_Init(), if use_hash_seed is 0, then we directly inject the random bits into the buffer, and then there's no hash_seed. I'd

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-22 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: Thanks for the hint! I had a feeling there had to be an API to get at it, but I couldn’t find it. Maybe we should start documenting the Python Secret Underscore API? :) On Jun 22, 2018, at 00:04, STINNER Victor wrote: > > _PyCoreConfig *core_config = >

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-22 Thread STINNER Victor
STINNER Victor added the comment: > I think the basic implementation problem is that by the time you get to > get_hash_info() in sysmodule.c, you no longer have access to the > _PyCoreConfig object, nor the _PyMain object that it's generally attached to. An interpreter now keeps a copy of

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-21 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: I think the basic implementation problem is that by the time you get to get_hash_info() in sysmodule.c, you no longer have access to the _PyCoreConfig object, nor the _PyMain object that it's generally attached to. --

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-20 Thread STINNER Victor
STINNER Victor added the comment: Is is still a secret seed if it's public? :) -- nosy: +vstinner ___ Python tracker ___ ___

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-20 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: On Jun 20, 2018, at 13:28, Christian Heimes wrote: > > Christian Heimes added the comment: > > hash_seed and use_hash_seed could be added to sys.hash_info. This would be > the first place I'd look for the information. After all I implemented it. :) That

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-20 Thread Christian Heimes
Christian Heimes added the comment: hash_seed and use_hash_seed could be added to sys.hash_info. This would be the first place I'd look for the information. After all I implemented it. :) -- nosy: +christian.heimes ___ Python tracker

[issue33919] Expose _PyCoreConfig structure to Python

2018-06-20 Thread Barry A. Warsaw
New submission from Barry A. Warsaw : The _PyCoreConfig structure in pystate.h has some interesting fields that I don't think are exposed anywhere else to Python-land. I was particularly interested recently in hash_seed and use_hash_seed. I'm thinking that it may be useful to expose this