Remove Python -safecstrings option.
This option, if used, has not had any effect on Python 3 code since commit a863d3 9 years ago.
I think we can assume that it is not needed for Python 3.
Running the examples and test-suite (Python 2) doesn't change the code
paths with and without -safecstrings because only SWIG_OLDOBJ and SWIG_NEWOBJ
are used in the typemaps and the following code is thus unaltered by -safecstrings
(which sets SWIG_PYTHON_SAFE_CSTRINGS):
%#if defined(SWIG_PYTHON_SAFE_CSTRINGS)
if (*alloc != SWIG_OLDOBJ)
%#else
if (*alloc == SWIG_NEWOBJ)
%#endif
{
*cptr = %new_copy_array(cstr, len + 1, char);
*alloc = SWIG_NEWOBJ;
printf("safe strings: %s\n", *cptr ? *cptr : "NULLSTRING");
} else {
*cptr = cstr;
*alloc = SWIG_OLDOBJ;
}
Note: nosafecstrings was also the default and -O didn't actually change this.
This commit is contained in:
parent
b2aa01f492
commit
de26ebbad1
2 changed files with 5 additions and 32 deletions
|
|
@ -38,21 +38,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
|
|||
%#endif
|
||||
if (cptr) {
|
||||
if (alloc) {
|
||||
/*
|
||||
In python the user should not be able to modify the inner
|
||||
string representation. To warranty that, if you define
|
||||
SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
|
||||
buffer is always returned.
|
||||
|
||||
The default behavior is just to return the pointer value,
|
||||
so, be careful.
|
||||
*/
|
||||
%#if defined(SWIG_PYTHON_SAFE_CSTRINGS)
|
||||
if (*alloc != SWIG_OLDOBJ)
|
||||
%#else
|
||||
if (*alloc == SWIG_NEWOBJ)
|
||||
%#endif
|
||||
{
|
||||
if (*alloc == SWIG_NEWOBJ) {
|
||||
*cptr = %new_copy_array(cstr, len + 1, char);
|
||||
*alloc = SWIG_NEWOBJ;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue