summaryrefslogtreecommitdiffstats
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-09-14 09:24:05 (GMT)
committerGitHub <noreply@github.com>2019-09-14 09:24:05 (GMT)
commit279f44678c8b84a183f9eeb85e0b086228154497 (patch)
tree9cacd41975bf15ab7a94fc5ba6a2df57f8e02ee5 /Modules/_pickle.c
parentd057b896f97e6d7447b9bf9246770c41cf205299 (diff)
downloadcpython-279f44678c8b84a183f9eeb85e0b086228154497.zip
cpython-279f44678c8b84a183f9eeb85e0b086228154497.tar.gz
cpython-279f44678c8b84a183f9eeb85e0b086228154497.tar.bz2
bpo-37206: Unrepresentable default values no longer represented as None. (GH-13933)
In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all.
Diffstat (limited to 'Modules/_pickle.c')
-rw-r--r--Modules/_pickle.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 9e82d14..7370be5 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -1142,7 +1142,7 @@ _Pickler_SetProtocol(PicklerObject *self, PyObject *protocol, int fix_imports)
{
long proto;
- if (protocol == NULL || protocol == Py_None) {
+ if (protocol == Py_None) {
proto = DEFAULT_PROTOCOL;
}
else {
@@ -4638,9 +4638,9 @@ Pickler_clear(PicklerObject *self)
_pickle.Pickler.__init__
file: object
- protocol: object = NULL
+ protocol: object = None
fix_imports: bool = True
- buffer_callback: object = NULL
+ buffer_callback: object = None
This takes a binary file for writing a pickle data stream.
@@ -4678,7 +4678,7 @@ static int
_pickle_Pickler___init___impl(PicklerObject *self, PyObject *file,
PyObject *protocol, int fix_imports,
PyObject *buffer_callback)
-/*[clinic end generated code: output=0abedc50590d259b input=9a43a1c50ab91652]*/
+/*[clinic end generated code: output=0abedc50590d259b input=bb886e00443a7811]*/
{
_Py_IDENTIFIER(persistent_id);
_Py_IDENTIFIER(dispatch_table);
@@ -7200,7 +7200,7 @@ _pickle.Unpickler.__init__
fix_imports: bool = True
encoding: str = 'ASCII'
errors: str = 'strict'
- buffers: object = NULL
+ buffers: object(c_default="NULL") = ()
This takes a binary file for reading a pickle data stream.
@@ -7228,7 +7228,7 @@ static int
_pickle_Unpickler___init___impl(UnpicklerObject *self, PyObject *file,
int fix_imports, const char *encoding,
const char *errors, PyObject *buffers)
-/*[clinic end generated code: output=09f0192649ea3f85 input=da4b62d9edb68700]*/
+/*[clinic end generated code: output=09f0192649ea3f85 input=ca4c1faea9553121]*/
{
_Py_IDENTIFIER(persistent_load);
@@ -7620,10 +7620,10 @@ _pickle.dump
obj: object
file: object
- protocol: object = NULL
+ protocol: object = None
*
fix_imports: bool = True
- buffer_callback: object = NULL
+ buffer_callback: object = None
Write a pickled representation of obj to the open file object file.
@@ -7658,7 +7658,7 @@ static PyObject *
_pickle_dump_impl(PyObject *module, PyObject *obj, PyObject *file,
PyObject *protocol, int fix_imports,
PyObject *buffer_callback)
-/*[clinic end generated code: output=706186dba996490c input=2f035f02cc0f9547]*/
+/*[clinic end generated code: output=706186dba996490c input=cfdcaf573ed6e46c]*/
{
PicklerObject *pickler = _Pickler_New();
@@ -7693,10 +7693,10 @@ _pickle_dump_impl(PyObject *module, PyObject *obj, PyObject *file,
_pickle.dumps
obj: object
- protocol: object = NULL
+ protocol: object = None
*
fix_imports: bool = True
- buffer_callback: object = NULL
+ buffer_callback: object = None
Return the pickled representation of the object as a bytes object.
@@ -7722,7 +7722,7 @@ into *file* as part of the pickle stream. It is an error if
static PyObject *
_pickle_dumps_impl(PyObject *module, PyObject *obj, PyObject *protocol,
int fix_imports, PyObject *buffer_callback)
-/*[clinic end generated code: output=fbab0093a5580fdf input=001f167df711b9f1]*/
+/*[clinic end generated code: output=fbab0093a5580fdf input=9f334d535ff7194f]*/
{
PyObject *result;
PicklerObject *pickler = _Pickler_New();
@@ -7757,7 +7757,7 @@ _pickle.load
fix_imports: bool = True
encoding: str = 'ASCII'
errors: str = 'strict'
- buffers: object = NULL
+ buffers: object(c_default="NULL") = ()
Read and return an object from the pickle data stored in a file.
@@ -7788,7 +7788,7 @@ static PyObject *
_pickle_load_impl(PyObject *module, PyObject *file, int fix_imports,
const char *encoding, const char *errors,
PyObject *buffers)
-/*[clinic end generated code: output=250452d141c23e76 input=29fae982fe778156]*/
+/*[clinic end generated code: output=250452d141c23e76 input=46c7c31c92f4f371]*/
{
PyObject *result;
UnpicklerObject *unpickler = _Unpickler_New();
@@ -7825,7 +7825,7 @@ _pickle.loads
fix_imports: bool = True
encoding: str = 'ASCII'
errors: str = 'strict'
- buffers: object = NULL
+ buffers: object(c_default="NULL") = ()
Read and return an object from the given pickle data.
@@ -7847,7 +7847,7 @@ static PyObject *
_pickle_loads_impl(PyObject *module, PyObject *data, int fix_imports,
const char *encoding, const char *errors,
PyObject *buffers)
-/*[clinic end generated code: output=82ac1e6b588e6d02 input=c6004393f8276867]*/
+/*[clinic end generated code: output=82ac1e6b588e6d02 input=9c2ab6a0960185ea]*/
{
PyObject *result;
UnpicklerObject *unpickler = _Unpickler_New();