This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fim
Recipients benjamin.peterson, fim
Date 2018-11-04.18:24:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1541355862.81.0.788709270274.issue35160@psf.upfronthosting.co.za>
In-reply-to
Content
Ok, I understand your point about PyObject_New not initializing custom fields (although it looks like something is initializing the memory since it's not random, it's either 0x0 or 0x1).

However, if that's the expected behavior, it's not very clear why there's a difference between the default values when invoking the same commands in different ways or between different python versions, eg:

Python3.8
=========

Python 3.8.0a0 (heads/master-dirty:f98c1623ec, Nov  4 2018, 17:16:57) 
[GCC 5.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import custom; custom.Custom()
weird pointer has value of: 0x0
<custom2.Custom object at 0x7f19fd456630>
>>> import custom;                
>>> custom.Custom()
weird pointer has value of: 0x1
deallocating weird pointer
<custom2.Custom object at 0x7f19fd4566f0>
>>> 
deallocating weird pointer
zsh: segmentation fault  ../cpython/python

Python 3.6
==========

Python 3.6.5 (default, Nov  4 2018, 18:20:36) 
[GCC 5.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import custom; custom.Custom()
weird pointer has value of: 0x0
deallocating weird pointer
<custom2.Custom object at 0x7f3d627d6b40>
>>> import custom  
>>> custom.Custom()
weird pointer has value of: 0x0
deallocating weird pointer
<custom2.Custom object at 0x7f3d627d6b70>


Is there any discussions or documentation I can refer to, in order to better understand this behavior or why it was changed since python 3.7? 

Thanks!
History
Date User Action Args
2018-11-04 18:24:22fimsetrecipients: + fim, benjamin.peterson
2018-11-04 18:24:22fimsetmessageid: <1541355862.81.0.788709270274.issue35160@psf.upfronthosting.co.za>
2018-11-04 18:24:22fimlinkissue35160 messages
2018-11-04 18:24:22fimcreate