Skip to content

Commit 4f22523

Browse files
authored
Merge pull request #326 from python/master
Sync Fork from Upstream Repo
2 parents ec06423 + fdcd53f commit 4f22523

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

Doc/c-api/exceptions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ an error value).
358358
.. c:function:: int PyErr_ResourceWarning(PyObject *source, Py_ssize_t stack_level, const char *format, ...)
359359
360360
Function similar to :c:func:`PyErr_WarnFormat`, but *category* is
361-
:exc:`ResourceWarning` and pass *source* to :func:`warnings.WarningMessage`.
361+
:exc:`ResourceWarning` and it passes *source* to :func:`warnings.WarningMessage`.
362362
363363
.. versionadded:: 3.6
364364

Doc/whatsnew/3.9.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ running.
356356
sys
357357
---
358358

359-
Add a new :attr:`sys.platlitdir` attribute: name of the platform-specific
359+
Add a new :attr:`sys.platlibdir` attribute: name of the platform-specific
360360
library directory. It is used to build the path of platform-specific dynamic
361361
libraries and the path of the standard library. It is equal to ``"lib"`` on
362362
most platforms. On Fedora and SuSE, it is equal to ``"lib64"`` on 64-bit
@@ -407,7 +407,7 @@ Build and C API Changes
407407
=======================
408408

409409
* Add ``--with-platlibdir`` option to the ``configure`` script: name of the
410-
platform-specific library directory, stored in the new :attr:`sys.platlitdir`
410+
platform-specific library directory, stored in the new :attr:`sys.platlibdir`
411411
attribute. See :attr:`sys.platlibdir` attribute for more information.
412412
(Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis and Victor Stinner in :issue:`1294959`.)
413413

Misc/NEWS.d/next/Build/2020-02-06-18-08-25.bpo-1294959.AZPg4R.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Add ``--with-platlibdir`` option to the configure script: name of the
2-
platform-specific library directory, stored in the new :attr:`sys.platlitdir`
2+
platform-specific library directory, stored in the new :attr:`sys.platlibdir`
33
attribute. It is used to build the path of platform-specific dynamic libraries
44
and the path of the standard library. It is equal to ``"lib"`` on most
55
platforms. On Fedora and SuSE, it is equal to ``"lib64"`` on 64-bit platforms.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:c:func:`PyDescr_NewMethod` and :c:func:`PyCFunction_NewEx` now include the
2+
method name in the SystemError "bad call flags" error message to ease debug.

Objects/descrobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,8 @@ PyDescr_NewMethod(PyTypeObject *type, PyMethodDef *method)
888888
vectorcall = method_vectorcall_O;
889889
break;
890890
default:
891-
PyErr_SetString(PyExc_SystemError, "bad call flags");
891+
PyErr_Format(PyExc_SystemError,
892+
"%s() method: bad call flags", method->ml_name);
892893
return NULL;
893894
}
894895

Objects/methodobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
5656
vectorcall = cfunction_vectorcall_O;
5757
break;
5858
default:
59-
PyErr_SetString(PyExc_SystemError, "bad call flags");
59+
PyErr_Format(PyExc_SystemError,
60+
"%s() method: bad call flags", ml->ml_name);
6061
return NULL;
6162
}
6263

Python/pylifecycle.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ extern grammar _PyParser_Grammar; /* From graminit.c */
6565
/* Forward declarations */
6666
static PyStatus add_main_module(PyInterpreterState *interp);
6767
static PyStatus init_import_site(void);
68-
static PyStatus init_set_builtins_open(PyThreadState *tstate);
68+
static PyStatus init_set_builtins_open(void);
6969
static PyStatus init_sys_streams(PyThreadState *tstate);
7070
static PyStatus init_signals(PyThreadState *tstate);
7171
static void call_py_exitfuncs(PyThreadState *tstate);
@@ -1025,7 +1025,7 @@ init_interp_main(PyThreadState *tstate)
10251025
return status;
10261026
}
10271027

1028-
status = init_set_builtins_open(tstate);
1028+
status = init_set_builtins_open();
10291029
if (_PyStatus_EXCEPTION(status)) {
10301030
return status;
10311031
}
@@ -1888,7 +1888,7 @@ create_stdio(const PyConfig *config, PyObject* io,
18881888

18891889
/* Set builtins.open to io.OpenWrapper */
18901890
static PyStatus
1891-
init_set_builtins_open(PyThreadState *tstate)
1891+
init_set_builtins_open(void)
18921892
{
18931893
PyObject *iomod = NULL, *wrapper;
18941894
PyObject *bimod = NULL;
@@ -2056,9 +2056,8 @@ _Py_FatalError_DumpTracebacks(int fd, PyInterpreterState *interp,
20562056
Return 1 if the traceback was displayed, 0 otherwise. */
20572057

20582058
static int
2059-
_Py_FatalError_PrintExc(int fd)
2059+
_Py_FatalError_PrintExc(PyThreadState *tstate)
20602060
{
2061-
PyThreadState *tstate = _PyThreadState_GET();
20622061
PyObject *ferr, *res;
20632062
PyObject *exception, *v, *tb;
20642063
int has_tb;
@@ -2220,7 +2219,7 @@ fatal_error(const char *prefix, const char *msg, int status)
22202219
int has_tstate_and_gil = (tss_tstate != NULL && tss_tstate == tstate);
22212220
if (has_tstate_and_gil) {
22222221
/* If an exception is set, print the exception with its traceback */
2223-
if (!_Py_FatalError_PrintExc(fd)) {
2222+
if (!_Py_FatalError_PrintExc(tss_tstate)) {
22242223
/* No exception is set, or an exception is set without traceback */
22252224
_Py_FatalError_DumpTracebacks(fd, interp, tss_tstate);
22262225
}

0 commit comments

Comments
 (0)