Title: Python 2.7 leaks a packages module object on SyntaxError
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 2.7
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: Segev Finer
Priority: normal Keywords: patch

Created on 2018-01-09 21:12 by Segev Finer, last changed 2020-01-12 00:50 by cheryl.sabella. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5142 closed Segev Finer, 2018-01-09 21:21
Messages (1)
msg309736 - (view) Author: Segev Finer (Segev Finer) * Date: 2018-01-09 21:12
With the file hello/

    ham = 123

I get the following:

    Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import hello
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "hello\", line 2
    SyntaxError: invalid syntax
    >>> import hello
    >>> print hello
    <module 'hello' from 'hello'>
    >>> print dir(hello)
    ['__doc__', '__file__', '__name__', '__package__', '__path__']

I'd expect to get the SyntaxError twice, which is indeed what happens on at least Python 3.6 (Possibly earlier Python 3 versions).

Originally found here &

I'm going to submit a PR with a fix.
Date User Action Args
2020-01-12 00:50:52cheryl.sabellasetstatus: open -> closed
resolution: wont fix
stage: patch review -> resolved
2018-01-09 21:21:22Segev Finersetkeywords: + patch
stage: patch review
pull_requests: + pull_request5001
2018-01-09 21:12:50Segev Finercreate