[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset a5552f023e1d8cbafee1e51d316cc581deb2295f by Serhiy Storchaka in 
branch 'master':
bpo-32240: Add the const qualifier to declarations of PyObject* array 
arguments. (#4746)
https://github.com/python/cpython/commit/a5552f023e1d8cbafee1e51d316cc581deb2295f


--

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-15 Thread Stefan Behnel

Stefan Behnel  added the comment:

Seems ok from Cython side. Could be a bit difficult to make an actual use of 
this, but at least it shouldn't break anything. And it's a reasonable 
constraint to enforce.

--

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This can affect Cython which uses the "fast call" convention.

--
nosy: +scoder

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This change is inspired by reviewing one PR in which an input array of 
PyObject* was modified inplace. Even if it was correct in that particular  
case, it looked unsafe (actually that code was wrong for other causes). Adding 
the const qualifier allows to distinguish input PyObject* array arguments from 
pointers to output PyObject* arguments.

--

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I don't like "PyConstObjectArray" or any other name. I will just obfuscate the 
C code. "PyObject * const *args" should be clear for every C programmer, but if 
I see "PyConstObjectArray" I need to search the definition of it in the header 
files. And it is easy to make a mistake by using "PyConstObjectArray *" instead 
of "PyConstObjectArray" since complex types usually are passed by pointer in C.

If you prefer, "PyObject * const *args" can be written as "PyObject * const 
args[]". This is an identical syntax, but the latter form is used more rarely.

--

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-07 Thread STINNER Victor

STINNER Victor  added the comment:

I hate this "obscure" C syntax "PyObject * const *args".

Technically, is it possible to define it as a type with a better name to give 
more context where the type would be defined?

For example, "PyConstObjectArray"?

--

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-07 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue32240] Add the const qualifier for PyObject* array arguments

2017-12-07 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

The proposed PR replaces argument declarations "PyObject **args" with "PyObject 
* const *args". In many cases this can be a pointer to the internal array of 
the tuple object. It is not safe to change it.

PyEval_EvalCodeEx() is the only public function affected by this change, but 
this change is backward compatible. All other affected code is a private C API.

--
messages: 307795
nosy: serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Add the const qualifier for PyObject* array arguments
type: enhancement
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