[issue35333] Rename private structs to use names closer to types

2018-11-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I don't know reasons against using the same name for the structure and the 
type. This can break extensions written before exposing the current Python C 
API in Python 1.5, but they should be already broken several times.

This is a cosmetic but large change. I suggest to ask on Python-Dev for the 
case if somebody has objections or better idea.

--

___
Python tracker 

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



[issue35333] Rename private structs to use names closer to types

2018-11-27 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +nascheme, serhiy.storchaka

___
Python tracker 

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



[issue35333] Rename private structs to use names closer to types

2018-11-27 Thread STINNER Victor


New submission from STINNER Victor :

To prevent a compiler warning/error (on clang), I had modify Include/object.h 
and Include/pystate.h:

* Replace "PyTypeObject" with "struct _typeobject"
* Replace "PyInterpreterState" with "struct _is"
* Replace "PyThreadState" with "struct _ts"

=> see commit 9bdd2de84c1af55fbc006d3f892313623bd0195c of bpo-35134.

I propose to rename "struct _ts" to "struct PyThreadState" or "struct 
_PyThreadState", and do a similar change for "struct _ts" and "struct 
_typeobject". My intent is to make the Include/object.h and Include/pystate.h 
less surprising.

Maybe "struct _frame" should also be renamed to "struct _PyFrameObject"?

--

Python header files use many "private" C structures (struct):

struct _addr_pair
struct _arena PyArena
struct _ceval_runtime_state
struct _dictkeysobject
struct _err_stackitem
struct _frame
struct _gc_runtime_state
struct _gil_runtime_state gil
struct _heaptypeobject
struct _is
struct _longobject
struct _object
struct _odictobject PyODictObject
struct _pending_calls
struct _pycontextobject
struct _pycontexttokenobject
struct _pycontextvarobject
struct _symtable_entry
struct _traceback
struct _ts
struct _typeobject
struct _warnings_runtime_state
struct _xid
struct _xidregitem

The following structures are documented:

* struct _frozen:
  https://docs.python.org/dev/c-api/import.html#c._frozen
* struct _inittab:
  https://docs.python.org/dev/c-api/import.html#c._inittab
* struct _node:
  https://docs.python.org/dev/c-api/veryhigh.html#c.PyParser_SimpleParseString

--
components: Interpreter Core
messages: 330564
nosy: vstinner
priority: normal
severity: normal
status: open
title: Rename private structs to use names closer to types
versions: Python 3.8

___
Python tracker 

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