Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d3c72a22
Commit
d3c72a22
authored
Mar 23, 2019
by
Inada Naoki
Committed by
GitHub
Mar 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36381: warn when no PY_SSIZE_T_CLEAN defined (GH-12473)
We will remove int support from 3.10 or 4.0.
parent
d60f658f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
5 deletions
+43
-5
Doc/whatsnew/3.8.rst
Doc/whatsnew/3.8.rst
+10
-0
Misc/NEWS.d/next/C API/2019-03-20-22-02-40.bpo-36381.xlzDJ2.rst
...EWS.d/next/C API/2019-03-20-22-02-40.bpo-36381.xlzDJ2.rst
+2
-0
Python/getargs.c
Python/getargs.c
+13
-2
Python/modsupport.c
Python/modsupport.c
+18
-3
No files found.
Doc/whatsnew/3.8.rst
View file @
d3c72a22
...
...
@@ -708,6 +708,16 @@ Changes in the Python API
set for regular user accounts.
Changes in the C API
--------------------
* Use of ``#`` variants of formats in parsing or building value (e.g.
:c:func:`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:`PyObject_CallFunction`,
etc.) without ``PY_SSIZE_T_CLEAN`` defined raises ``DeprecationWarning`` now.
It will be removed in 3.10 or 4.0. Read :ref:`arg-parsing` for detail.
(Contributed by Inada Naoki in :issue:`36381`.)
CPython bytecode changes
------------------------
...
...
Misc/NEWS.d/next/C API/2019-03-20-22-02-40.bpo-36381.xlzDJ2.rst
0 → 100644
View file @
d3c72a22
Raise ``DeprecationWarning`` when '#' formats are used for building or
parsing values without ``PY_SSIZE_T_CLEAN``.
Python/getargs.c
View file @
d3c72a22
...
...
@@ -681,7 +681,13 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
/* For # codes */
#define FETCH_SIZE int *q=NULL;Py_ssize_t *q2=NULL;\
if (flags & FLAG_SIZE_T) q2=va_arg(*p_va, Py_ssize_t*); \
else q=va_arg(*p_va, int*);
else { \
if (PyErr_WarnEx(PyExc_DeprecationWarning, \
"PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) { \
return NULL; \
} \
q=va_arg(*p_va, int*); \
}
#define STORE_SIZE(s) \
if (flags & FLAG_SIZE_T) \
*q2=s; \
...
...
@@ -2591,8 +2597,13 @@ skipitem(const char **p_format, va_list *p_va, int flags)
if
(
p_va
!=
NULL
)
{
if
(
flags
&
FLAG_SIZE_T
)
(
void
)
va_arg
(
*
p_va
,
Py_ssize_t
*
);
else
else
{
if
(
PyErr_WarnEx
(
PyExc_DeprecationWarning
,
"PY_SSIZE_T_CLEAN will be required for '#' formats"
,
1
))
{
return
NULL
;
}
(
void
)
va_arg
(
*
p_va
,
int
*
);
}
}
format
++
;
}
else
if
((
c
==
's'
||
c
==
'z'
||
c
==
'y'
||
c
==
'w'
)
...
...
Python/modsupport.c
View file @
d3c72a22
...
...
@@ -342,8 +342,13 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
++*
p_format
;
if
(
flags
&
FLAG_SIZE_T
)
n
=
va_arg
(
*
p_va
,
Py_ssize_t
);
else
else
{
if
(
PyErr_WarnEx
(
PyExc_DeprecationWarning
,
"PY_SSIZE_T_CLEAN will be required for '#' formats"
,
1
))
{
return
NULL
;
}
n
=
va_arg
(
*
p_va
,
int
);
}
}
else
n
=
-
1
;
...
...
@@ -390,8 +395,13 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
++*
p_format
;
if
(
flags
&
FLAG_SIZE_T
)
n
=
va_arg
(
*
p_va
,
Py_ssize_t
);
else
else
{
if
(
PyErr_WarnEx
(
PyExc_DeprecationWarning
,
"PY_SSIZE_T_CLEAN will be required for '#' formats"
,
1
))
{
return
NULL
;
}
n
=
va_arg
(
*
p_va
,
int
);
}
}
else
n
=
-
1
;
...
...
@@ -423,8 +433,13 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
++*
p_format
;
if
(
flags
&
FLAG_SIZE_T
)
n
=
va_arg
(
*
p_va
,
Py_ssize_t
);
else
else
{
if
(
PyErr_WarnEx
(
PyExc_DeprecationWarning
,
"PY_SSIZE_T_CLEAN will be required for '#' formats"
,
1
))
{
return
NULL
;
}
n
=
va_arg
(
*
p_va
,
int
);
}
}
else
n
=
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment