New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

The array of PyMethodDef for OrderedDict contains explicit definitions of 
methods like __delitem__, __eq__ and __init__. The purpose is aligning 
docstrings with Python implementation. But this doesn't work. Slot wrappers 
replace these descriptors. And docstings are standard docstrings for 
corresponding slot wrappers.

Thus this code doesn't work. And it looks dangerous, since functions are casted 
to incompatible function types. Even if they are never used, the compiler (gcc 
8) produces warnings (see issue33012). May be this is even undefined behavior. 
In that case the compiler can generate arbitrary code.

I suggest to remove these definitions.

----------
components: Extension Modules
messages: 313452
nosy: eric.snow, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Questionable code in OrderedDict definition
type: compile error
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to