classification
Title: imp.reload can fail for sub-modules
Type: behavior Stage: patch review
Components: Interpreter Core Versions: Python 3.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: Jim.Jewett, brett.cannon, eric.snow, paul_ollis
Priority: high Keywords: patch

Created on 2012-04-14 18:55 by paul_ollis, last changed 2013-02-01 22:28 by brett.cannon. This issue is now closed.

Files
File name Uploaded Description Edit
patch01-tests.diff paul_ollis, 2012-04-14 18:57 review
patch01-code.diff paul_ollis, 2012-04-14 19:04 review
Messages (5)
msg158273 - (view) Author: Paul Ollis (paul_ollis) * Date: 2012-04-14 18:55
Code like this::

    import collections.abc
    imp.reload(collections.abc)

Raises the following exception:

    SystemError: Negative size passed to PyUnicode_New

This occurs on the latest mercurial checkout (76302).
msg158274 - (view) Author: Paul Ollis (paul_ollis) * Date: 2012-04-14 18:57
Patch adding a test to reproduce the issue.
msg158275 - (view) Author: Paul Ollis (paul_ollis) * Date: 2012-04-14 19:04
Patch that fixes the issue.
msg158493 - (view) Author: Jim Jewett (Jim.Jewett) * (Python triager) Date: 2012-04-16 19:20
(Note that the two patches are not cumulative; both would need to be applied.)
msg181125 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-02-01 22:28
This is no longer a problem:

>>> import imp
>>> import collections
>>> import collections.abc
<module 'collections.abc' from '/Users/bcannon/Developer/repo/cpython/py3k/Lib/collections/abc.py'>
History
Date User Action Args
2013-02-01 22:28:01brett.cannonsetstatus: open -> closed
assignee: brett.cannon
resolution: out of date
messages: + msg181125
2012-04-16 19:20:29Jim.Jewettsetnosy: + Jim.Jewett

messages: + msg158493
stage: patch review
2012-04-14 21:22:35eric.snowsetnosy: + eric.snow
2012-04-14 19:20:06pitrousetpriority: normal -> high
nosy: + brett.cannon
2012-04-14 19:04:17paul_ollissetfiles: + patch01-code.diff

messages: + msg158275
2012-04-14 18:57:55paul_ollissetfiles: + patch01-tests.diff
keywords: + patch
messages: + msg158274
2012-04-14 18:55:42paul_olliscreate