summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-07-24 23:37:05 (GMT)
committerGitHub <noreply@github.com>2018-07-24 23:37:05 (GMT)
commit53b7d4e40208d91eb30ae28821213b2d8f2befc4 (patch)
treec3d58a8726b64126e7dfa863f09bc7fa168d38a0 /Objects
parent95d34c2a37f4c5046f6439abef881925d34fe4ac (diff)
downloadcpython-53b7d4e40208d91eb30ae28821213b2d8f2befc4.zip
cpython-53b7d4e40208d91eb30ae28821213b2d8f2befc4.tar.gz
cpython-53b7d4e40208d91eb30ae28821213b2d8f2befc4.tar.bz2
bpo-34170: Add _PyCoreConfig.bytes_warning (GH-8447)
Add more fields to _PyCoreConfig: * _check_hash_pycs_mode * bytes_warning * debug * inspect * interactive * legacy_windows_fs_encoding * legacy_windows_stdio * optimization_level * quiet * unbuffered_stdio * user_site_directory * verbose * write_bytecode Changes: * Remove pymain_get_global_config() and pymain_set_global_config() which became useless. These functions have been replaced by _PyCoreConfig_GetGlobalConfig() and _PyCoreConfig_SetGlobalConfig(). * sys.flags.dont_write_bytecode value is now restricted to 1 even if -B option is specified multiple times on the command line. * PyThreadState_Clear() now uses the config from the current interpreter rather than using global Py_VerboseFlag
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bytearrayobject.c11
-rw-r--r--Objects/bytesobject.c3
2 files changed, 8 insertions, 6 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 9d32965..4e2bb60 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -999,12 +999,13 @@ bytearray_repr(PyByteArrayObject *self)
static PyObject *
bytearray_str(PyObject *op)
{
- if (Py_BytesWarningFlag) {
- if (PyErr_WarnEx(PyExc_BytesWarning,
- "str() on a bytearray instance", 1))
- return NULL;
+ if (Py_BytesWarningFlag) {
+ if (PyErr_WarnEx(PyExc_BytesWarning,
+ "str() on a bytearray instance", 1)) {
+ return NULL;
}
- return bytearray_repr((PyByteArrayObject*)op);
+ }
+ return bytearray_repr((PyByteArrayObject*)op);
}
static PyObject *
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 943c329..648b2a5 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -1416,8 +1416,9 @@ bytes_str(PyObject *op)
{
if (Py_BytesWarningFlag) {
if (PyErr_WarnEx(PyExc_BytesWarning,
- "str() on a bytes instance", 1))
+ "str() on a bytes instance", 1)) {
return NULL;
+ }
}
return bytes_repr(op);
}