◐ Shell
reader mode source ↗
Skip to content

bpo-28411: Support other mappings in PyInterpreterState.modules.#3593

Merged
ericsnowcurrently merged 30 commits into
python:masterfrom
ericsnowcurrently:sys-modules-any-mapping
Sep 15, 2017
Merged

bpo-28411: Support other mappings in PyInterpreterState.modules.#3593
ericsnowcurrently merged 30 commits into
python:masterfrom
ericsnowcurrently:sys-modules-any-mapping

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented Sep 14, 2017

Copy link
Copy Markdown
Member

The concrete PyDict_* API is used to interact with PyInterpreterState.modules in a number of places. This isn't compatible with all dict subclasses, nor with other Mapping implementations. This patch switches the concrete API usage to the corresponding abstract API calls.

We also add a PyImport_GetModule() function (and some other helpers) to reduce a bunch of code duplication.

Note that this code was already reviewed and merged as part of #1638. I reverted that and am now splitting it up into more focused parts.

https://bugs.python.org/issue28411

@ericsnowcurrently

Copy link
Copy Markdown
Member Author

FYI, I'm hunting down a refleak (probably in import.c):

$ ./python -m test -R 3:3 test_capi -m test.test_capi.SubinterpreterTest.test_subinterps
Run tests sequentially
0:00:00 load avg: 0.07 [1/1] test_capi
beginning 6 repetitions
123456
......
test_capi leaked [2, 2, 2] references, sum=6
test_capi leaked [1, 2, 1] memory blocks, sum=4
test_capi failed

1 test failed:
    test_capi

Total duration: 220 ms
Tests result: FAILURE

test_pickle hits it too. Once I track it down and fix it I'm planning on merging.

@ncoghlan ncoghlan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

I suspect your reference leaks are coming from the iterators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants