[issue31779] assertion failures and a crash when using an uninitialized struct.Struct object

2021-10-19 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, 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



[issue31779] assertion failures and a crash when using an uninitialized struct.Struct object

2019-05-20 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
versions:  -Python 3.6

___
Python tracker 

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



[issue31779] assertion failures and a crash when using an uninitialized struct.Struct object

2018-09-15 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

What are the drawbacks of moving all code from __init__ to __new__, at least in 
master branch (3.8)? IMO it's much more robust than playing whack-a-mole both 
with ref/memleaks caused by repeated calls to __init__ and absence of 
initialization checks in all methods.

--
nosy: +berker.peksag, izbyshev, mark.dickinson, meador.inge, serhiy.storchaka
versions: +Python 2.7, Python 3.6, Python 3.8

___
Python tracker 

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



[issue31779] assertion failures and a crash when using an uninitialized struct.Struct object

2017-10-13 Thread Oren Milman

Change by Oren Milman :


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

___
Python tracker 

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



[issue31779] assertion failures and a crash when using an uninitialized struct.Struct object

2017-10-13 Thread Oren Milman

New submission from Oren Milman :

The following code causes an assertion failure:
import _struct
struct_obj = _struct.Struct.__new__(_struct.Struct)
struct_obj.iter_unpack(b'foo')

This is because Struct_iter_unpack() (in Modules/_struct.c) assumes that
Struct.__init__() was called, and so it does `assert(self->s_codes != NULL);`.

The same happens in (almost) every method of Struct, and in s_get_format(), so
in all them, too, we would get an assertion failure in case of an uninitialized
Struct object.
The exception is __sizeof__(), which doesn't have an `assert`, and simply
crashes while trying to iterate over `self->s_codes`.


I would open a PR to fix this soon.

--
components: Extension Modules
messages: 304328
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: assertion failures and a crash when using an uninitialized struct.Struct 
object
type: crash
versions: Python 3.7

___
Python tracker 

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