[issue1772673] Replacing char* with const char*

2014-09-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 599a957038fa by Serhiy Storchaka in branch 'default':
Removed redundant casts to `char *`.
https://hg.python.org/cpython/rev/599a957038fa

--

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-10-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8bd69bd6e129 by Serhiy Storchaka in branch 'default':
Restore prototypes for the 'openpty' and 'forkpty' on BSDI (broken in issue 
#1772673).
http://hg.python.org/cpython/rev/8bd69bd6e129

--

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-10-19 Thread Ned Deily

Ned Deily added the comment:

Compile errors on OS X 10.8 with clang:

cc -Wno-unused-result -Werror=declaration-after-statement -g -O0 -Wall 
-Wstrict-prototypes -I. -IInclude -I../../source/Include-DPy_BUILD_CORE 
 -c ../../source/Modules/posixmodule.c -o Modules/posixmodule.o
In file included from ../../source/Modules/posixmodule.c:5959:
/usr/include/util.h:94:5: error: conflicting types for 'openpty'
int openpty(int *, int *, char *, struct termios *,
^
../../source/Include/pyport.h:676:12: note: previous declaration is here
extern int openpty(int *, int *, char *,
   ^
In file included from ../../source/Modules/posixmodule.c:5959:
/usr/include/util.h:97:7: error: conflicting types for 'forkpty'
pid_t   forkpty(int *, char *, struct termios *, struct winsize *);
^
../../source/Include/pyport.h:678:14: note: previous declaration is here
extern pid_t forkpty(int *, char *,
 ^
2 errors generated.
make: *** [Modules/posixmodule.o] Error 1

--
nosy: +ned.deily

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-10-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-10-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3055e61f1e66 by Serhiy Storchaka in branch 'default':
Issue #1772673: The type of `char*` arguments now changed to `const char*`.
http://hg.python.org/cpython/rev/3055e61f1e66

--
nosy: +python-dev

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-10-14 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +tim.peters

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-10-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch synchronized with tip.

--
Added file: http://bugs.python.org/file32124/const_char_3.patch

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-08-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-06-08 Thread Eli Bendersky

Changes by Eli Bendersky :


--
nosy:  -eli.bendersky

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch is outdated. Some function prototypes were changed in issue9369, some 
were changed before.

Here is a new patch. It adds const qualifier to following public functions:
PyObject_DelAttrString, PyObject_HasAttrString, PyObject_GetAttrString, 
PyObject_SetAttrString, PyObject_DelItemString, PyMapping_DelItemString, 
PyMapping_HasKeyString, PyMapping_GetItemString, PyMapping_SetItemString, 
PyFile_FromFd, PyImport_ExecCodeModule, PyImport_ExecCodeModuleEx, 
PyImport_ExecCodeModuleWithPathnames, PyImport_ImportFrozenModule, 
PyLong_FromString, PyOS_strtoul, PyOS_strtol, PyOS_Readline, 
PyMarshal_ReadObjectFromString, PyParser_ParseFile, PyParser_ParseFileFlags, 
PyParser_ParseFileFlagsEx, PyTokenizer_FromFile. It also changes prototypes of 
some internal functions and structures and fixes documentation for 
PyDict_DelItemString. Some of functions already were documented with const 
qualifier.

--
nosy: +brett.cannon, eric.snow, ncoghlan
stage: needs patch -> patch review
Added file: http://bugs.python.org/file30440/const_char_2.patch

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue9369.

--
dependencies: +const char* for PyObject_CallMethod and PyObject_CallFunction

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-05-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In C++ we may overload functions for backward compatibility:

PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
const char *, const char * const *, ...);
PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
const char *, const char * const *, va_list va);
...
#ifdef __cplusplus
inline int
PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *keywords,
const char *format, char * const *kwlist, ...)
{
int retval;
va_list va;
va_start(va, kwlist);
retval = PyArg_ParseTupleAndKeywords(args, keywords, format,
(const char * const *)kwlist, va_start);
va_end(va);
return retval;
}
#endif

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-05-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Antoine, I was referring to the discussion linked earlier
> (http://mail.python.org/pipermail/python-dev/2006-February/060689.html).

Ok, I've read it through. The problem is specifically with
pointers-to-pointers:
http://mail.python.org/pipermail/python-dev/2006-February/060849.html

And indeed, PyArg_ParseTupleAndKeywords() got its "const char **"
argument changed back to "char **". But the other consts have stayed
(such as the "const char *" argument to the same
PyArg_ParseTupleAndKeywords()).

So it looks like the patch, in essence, is legit.
(of course, in practice, it probably won't apply cleanly, since it's
very old; and perhaps it's incomplete too)

--

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-05-13 Thread Eli Bendersky

Eli Bendersky added the comment:

Antoine, I was referring to the discussion linked earlier 
(http://mail.python.org/pipermail/python-dev/2006-February/060689.html). Users 
of the C API needed to recompile their code and also add preprocessor hacks to 
make things compatible with C and C++, AFAIU.

--

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-05-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> For external APIs visible to user code, this can cause some
> compatibility problems and users may need to at the very least
> re-compile this code.

Can you explain exactly which compatibility problems this would cause?

Actually, the point is precisely to make life easier for third-party code, 
since "const char *" is more accepting than "char *".

--
nosy: +pitrou
stage:  -> needs patch
versions: +Python 3.4 -Python 2.7

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-05-13 Thread Eli Bendersky

Eli Bendersky added the comment:

For external APIs visible to user code, this can cause some compatibility 
problems and users may need to at the very least re-compile this code. So -1 
here.

For new external APIs, having const wherever appropriate should be considered 
on a case by case basis.

For internal code this is a good idea, but I wouldn't go mass-slashing all the 
code base now replacing char* by const char*. Presenting some examples where 
this makes sense in particular would be interesting though. +0

--
nosy: +eli.bendersky

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2009-05-14 Thread Daniel Diniz

Changes by Daniel Diniz :


--
dependencies: +replacing char* with const char* in sysmodule.c/.h
versions: +Python 2.7 -Python 2.6

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2008-02-24 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Douglas Greiman submitted many similar changes with his issue2135 patch.  
His patch also amends documentation, which is missing here.

I am adding dgreiman to the nosy list here to avoid duplication of 
effort.

I am -0 on the idea.

--
nosy: +belopolsky, dgreiman

_
Tracker <[EMAIL PROTECTED]>

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



[issue1772673] Replacing char* with const char*

2008-01-06 Thread Christian Heimes

Changes by Christian Heimes:


--
type:  -> rfe
versions: +Python 2.6

_
Tracker <[EMAIL PROTECTED]>

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



[issue1772673] Replacing char* with const char*

2007-12-17 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

There was once a rather long discussion about "const" in
PyArg_ParseTupleAndKeywords:
http://mail.python.org/pipermail/python-dev/2006-February/060689.html

If you don't read it to the end, here is the conclusion:
"""
It sounds like the right answer for Python is to change the signature
of PyArg_ParseTupleAndKeywords() back.  We'll fix it when C fixes its
const rules .
"""

"const char*" was accepted without opposition, though.

--
nosy: +amaury.forgeotdarc

_
Tracker <[EMAIL PROTECTED]>

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



[issue1772673] Replacing char* with const char*

2007-12-17 Thread Gustavo J. A. M. Carneiro

Gustavo J. A. M. Carneiro added the comment:

I was about to submit the very same patch :-)
I missed PyErr_NewException, but you missed the PyMapping_* methods ;)

Please look into this matter.  GCC 4.2 has arrived and it has a new
warning.  The code:

 char* kwlist[] = { "target", "encoding", NULL };

now gives a warning like:

"warning: deprecated conversion from string constant to ‘char*’"

at least when compiling in C++ mode...

This means that people have to declare it as "const char* kwlist", which
will then trigger another warning when calling
PyArg_ParseTupleAndKeywords with such a variable, because the prototype is:

PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
  const char *, char **,
...);

The "char **" should be "const char **".  ext-, any chance you could fix
that too?

--
nosy: +gustavo

_
Tracker <[EMAIL PROTECTED]>

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