[issue13487] inspect.getmodule fails when module imports change sys.modules

2020-03-10 Thread Ned Deily
Ned Deily added the comment: New changeset 7058d2d96c5ca4dfc6c754c5cd737c6eb2a8fd67 by Ned Deily (Miss Islington (bot)) in branch '3.7': bpo-13487: Use sys.modules.copy() in inspect.getmodule() for thread safety. (GH-18786)

[issue13487] inspect.getmodule fails when module imports change sys.modules

2020-03-04 Thread Gregory P. Smith
Gregory P. Smith added the comment: If anyone else has a way to reproduce this issue, please run your tests with a 3.7/3.8/3.9 interpreter with the fix I committed applied and report back if you still see this failure on that line. I believe this to be fixed based on my own testing so I am

[issue13487] inspect.getmodule fails when module imports change sys.modules

2020-03-04 Thread miss-islington
miss-islington added the comment: New changeset 6b452ff97f70eca79ab956987cc04b6586feca00 by Miss Islington (bot) in branch '3.8': bpo-13487: Use sys.modules.copy() in inspect.getmodule() for thread safety. (GH-18786)

[issue13487] inspect.getmodule fails when module imports change sys.modules

2020-03-04 Thread miss-islington
miss-islington added the comment: New changeset a12381233a243ba7d5151ebf060feb57dd540bef by Miss Islington (bot) in branch '3.7': bpo-13487: Use sys.modules.copy() in inspect.getmodule() for thread safety. (GH-18786)

[issue13487] inspect.getmodule fails when module imports change sys.modules

2020-03-04 Thread Gregory P. Smith
Gregory P. Smith added the comment: Testing by changing list(sys.modules.items()) to sys.modules.copy().items() internally with a large integration test that was reliably flaky on this line before shows that the .copy().items() worked. The test is reliable again. So I've gone ahead and

[issue13487] inspect.getmodule fails when module imports change sys.modules

2020-03-04 Thread Gregory P. Smith
Gregory P. Smith added the comment: New changeset 85cf1d514b84dc9a4bcb40e20a12e1d82ff19f20 by Gregory P. Smith in branch 'master': bpo-13487: Use sys.modules.copy() in inspect.getmodule() for thread safety. (GH-18786)

[issue13487] inspect.getmodule fails when module imports change sys.modules

2020-03-04 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 10.0 -> 11.0 pull_requests: +18144 pull_request: https://github.com/python/cpython/pull/18787 ___ Python tracker

[issue13487] inspect.getmodule fails when module imports change sys.modules

2020-03-04 Thread miss-islington
Change by miss-islington : -- pull_requests: +18145 pull_request: https://github.com/python/cpython/pull/18788 ___ Python tracker ___

[issue13487] inspect.getmodule fails when module imports change sys.modules

2020-03-04 Thread Gregory P. Smith
Change by Gregory P. Smith : -- pull_requests: +18143 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/18786 ___ Python tracker ___

[issue13487] inspect.getmodule fails when module imports change sys.modules

2020-03-04 Thread Gregory P. Smith
Gregory P. Smith added the comment: Serhiy: Why is dict.copy() not thread safe? if what you say of list(dict) being safe, iterating over that and looking up the keys would work. But all of this is entirely non-obvious to the reader of the code. all of these _look_ like they should be

[issue13487] inspect.getmodule fails when module imports change sys.modules

2020-03-04 Thread Gregory P. Smith
Gregory P. Smith added the comment: fyi - we just had a test run into this (in a flaky manner - definitely a race condition) at work: ``` ... for f in inspect.stack(context=0) File "/inspect.py", line 1499, in stack return getouterframes(sys._getframe(1), context) File

[issue13487] inspect.getmodule fails when module imports change sys.modules

2017-09-16 Thread Patrik Simons
Patrik Simons added the comment: I cannot reproduce. In fact I cannot even get list(d.items()) to raise RuntimeError: dictionary changed size during iteration for any dict d. -- ___ Python tracker

[issue13487] inspect.getmodule fails when module imports change sys.modules

2017-09-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: dict.copy() is not thread-safe still (but it can be made thread-safe). list(dict) is thread-safe. It copies a list of keys only. -- nosy: +serhiy.storchaka ___ Python tracker

[issue13487] inspect.getmodule fails when module imports change sys.modules

2017-09-15 Thread Éric Araujo
Éric Araujo added the comment: Could you give code to reproducer the problem, if possible without third-party dependencies? -- resolution: fixed -> status: closed -> open versions: +Python 3.6, Python 3.7 -Python 3.2, Python 3.3 ___ Python tracker

[issue13487] inspect.getmodule fails when module imports change sys.modules

2017-09-05 Thread Thomas Dudziak
Thomas Dudziak added the comment: This bug seems to be still there. I had an application fail with this same error in inspect.getouterframes with Python 3.6.2. As far as I could trace it, during iteration over sys.modules _tracemalloc and tracemalloc were added, not quite sure from where

[issue13487] inspect.getmodule fails when module imports change sys.modules

2017-08-07 Thread Patrik Simons
Patrik Simons added the comment: list(sys.modules.items()) still raises RuntimeError: dictionary changed size during iteration when another thread imports a module. I would assume dict.copy() is thread-safe so a working fix could use sys.modules.copy().items() I hit this bug when printing

[issue13487] inspect.getmodule fails when module imports change sys.modules

2011-11-29 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- assignee: - eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13487 ___ ___ Python-bugs-list

[issue13487] inspect.getmodule fails when module imports change sys.modules

2011-11-29 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 2ef359d7a2e9 by Éric Araujo in branch '3.2': Fix inspect.getmodule to use a copy of sys.modules for iteration (#13487). http://hg.python.org/cpython/rev/2ef359d7a2e9 -- nosy: +python-dev

[issue13487] inspect.getmodule fails when module imports change sys.modules

2011-11-29 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Committed, thanks. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13487

[issue13487] inspect.getmodule fails when module imports change sys.modules

2011-11-28 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Maybe it can be caused by an installation happening during the loop. I agree with Erik’s reading of the comment and patch, and don’t think a test is needed. -- nosy: +eric.araujo stage: - patch review type: - behavior versions:

[issue13487] inspect.getmodule fails when module imports change sys.modules

2011-11-28 Thread Erik Tollerud
Erik Tollerud erik.tolle...@gmail.com added the comment: The package that triggers it for me is the py (http://pypi.python.org/pypi/py) package - when in gets imported, it does some trick with sys.modules that is in place to get around some pickling restriction, but that means sys.modules is

[issue13487] inspect.getmodule fails when module imports change sys.modules

2011-11-28 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: When a package is imported sys.modules changes... nothing special here. But it's true true that py.std, for example, is a lazy module with a special __getattr__ that will import submodules. Patch looks good to me as well. --

[issue13487] inspect.getmodule fails when module imports change sys.modules

2011-11-27 Thread Meador Inge
Changes by Meador Inge mead...@gmail.com: -- nosy: +meador.inge ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13487 ___ ___ Python-bugs-list

[issue13487] inspect.getmodule fails when module imports change sys.modules

2011-11-27 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: You are certainly right, but I wonder how this can happen. Are there modules which import something just by looking at them? Or is is some race condition due to another running thread? -- nosy: +amaury.forgeotdarc

[issue13487] inspect.getmodule fails when module imports change sys.modules

2011-11-26 Thread Erik Tollerud
New submission from Erik Tollerud erik.tolle...@gmail.com: The inspect.getmodule function crashes if packages are installed that futz with sys.modules while they are being tested for module status or the like. I'm not actually sure which packages are doing this, but the symptom is the for

[issue13487] inspect.getmodule fails when module imports change sys.modules

2011-11-26 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13487 ___ ___ Python-bugs-list