[issue32524] Python 2.7 leaks a packages __init__.py module object on SyntaxError

2020-01-11 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
resolution:  -> wont fix
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32524] Python 2.7 leaks a packages __init__.py module object on SyntaxError

2018-01-09 Thread Segev Finer

Change by Segev Finer :


--
keywords: +patch
pull_requests: +5001
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32524] Python 2.7 leaks a packages __init__.py module object on SyntaxError

2018-01-09 Thread Segev Finer

New submission from Segev Finer :

With the file hello/__init__.py:

ham = 123
spam()spam()

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 "", line 1, in 
  File "hello\__init__.py", line 2
spam()spam()
 ^
SyntaxError: invalid syntax
>>> import hello
>>> print 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 https://github.com/pallets/flask/issues/2423 & 
https://github.com/pallets/flask/pull/2588

I'm going to submit a PR with a fix.

--
components: Interpreter Core
messages: 309736
nosy: Segev Finer
priority: normal
severity: normal
status: open
title: Python 2.7 leaks a packages __init__.py module object on SyntaxError
type: behavior
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com