[issue33714] module can set an exception in tp_clear

2019-10-08 Thread Petr Viktorin


Petr Viktorin  added the comment:

Indeed, it can be closed.
Thanks Serhiy for the better error message!

--
resolution:  -> fixed
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



[issue33714] module can set an exception in tp_clear

2019-10-08 Thread miss-islington


miss-islington  added the comment:


New changeset d7c387384a27f37e4e3fa7890c859212c56b45b2 by Miss Islington (bot) 
(Serhiy Storchaka) in branch 'master':
bpo-33714: Output an exception raised in module's m_clear(). (GH-16592)
https://github.com/python/cpython/commit/d7c387384a27f37e4e3fa7890c859212c56b45b2


--
nosy: +miss-islington

___
Python tracker 

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



[issue33714] module can set an exception in tp_clear

2019-10-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +16181
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/16592

___
Python tracker 

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



[issue33714] module can set an exception in tp_clear

2019-10-04 Thread Ashley Whetter


Ashley Whetter  added the comment:

I've just realised that this issue was specific to tp_clear on a module and not 
on objects. tp_clear on modules has already been fixed in 
https://bugs.python.org/issue33622.
I think this is closable.

--

___
Python tracker 

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



[issue33714] module can set an exception in tp_clear

2019-10-04 Thread Ashley Whetter


Ashley Whetter  added the comment:

I've attached a reproduction case. Here's the setup.py that I used:

```
from distutils.core import Extension, setup

extension = Extension("breaky", ["breaky.c"])

setup(
name="tp_clear",
version="0.1.0",
ext_modules=[extension],
)
```

which I built and ran with:
```
python setup.py build_ext --inplace
python -c "import breaky, gc; a = breaky.Breaky(); a = 1"
```

--
nosy: +AWhetter
Added file: https://bugs.python.org/file48642/breaky.c

___
Python tracker 

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



[issue33714] module can set an exception in tp_clear

2018-09-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

I'm not sure what tp_clear should do in this situation.
Other than propagating the exception to the GC, the most reasonable behavior 
seems to be to write the exception to stderr and ignore it -- but I think 
having the GC do that would be more robust.

IOW, I think raising an exception from tp_clear is reasonable, and if that 
caused (causes?) a crash, it's a bug.

--

___
Python tracker 

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



[issue33714] module can set an exception in tp_clear

2018-05-31 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +petr.viktorin

___
Python tracker 

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



[issue33714] module can set an exception in tp_clear

2018-05-31 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue33714] module can set an exception in tp_clear

2018-05-31 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The tp_clear handler of the module object calls a custom clear function if the 
PyModuleDef.m_clear field is set. This function can set an exception which will 
be leaked to the garbage collector. An exception in tp_clear is not expected 
and caused a crash in the garbage collector. In the master branch it will cause 
just writing a traceback to stderr (see issue33622), but in any case it would 
be better to handle the failure locally in the module's tp_clear.

--
components: Interpreter Core
messages: 318289
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: module can set an exception in tp_clear
type: crash
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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