Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-1635741: Port _locale extension module to multiphase initialization (PEP 489) #18358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 11, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix format bug
  • Loading branch information
shihai1991 committed Feb 18, 2020
commit 2a4ac1b0b56eec2f1050499c876491e4cabefd1c
13 changes: 7 additions & 6 deletions 13 Modules/_localemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
if (category < LC_MIN || category > LC_MAX)
{
PyErr_SetString(get_locale_state(self)->Error,
"invalid locale category");
"invalid locale category");
return NULL;
}
#endif
Expand All @@ -116,7 +116,7 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
if (!result) {
/* operation failed, no setting was changed */
PyErr_SetString(get_locale_state(self)->Error,
"unsupported locale setting");
"unsupported locale setting");
return NULL;
}
result_object = PyUnicode_DecodeLocale(result, NULL);
Expand All @@ -127,7 +127,7 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
result = setlocale(category, NULL);
if (!result) {
PyErr_SetString(get_locale_state(self)->Error,
"locale query failed");
"locale query failed");
return NULL;
}
result_object = PyUnicode_DecodeLocale(result, NULL);
Expand Down Expand Up @@ -644,7 +644,7 @@ PyIntl_bindtextdomain(PyObject* self, PyObject*args)
return 0;
if (!strlen(domain)) {
PyErr_SetString(get_locale_state(self)->Error,
"domain must be a non-empty string");
"domain must be a non-empty string");
return 0;
}
if (dirname_obj != Py_None) {
Expand Down Expand Up @@ -745,8 +745,9 @@ _locale_exec(PyObject *m)
PyModule_AddIntMacro(m, LC_ALL);
PyModule_AddIntMacro(m, CHAR_MAX);

get_locale_state(m)->Error = PyErr_NewException("locale.Error", NULL, NULL);
if (get_locale_state(m)->Error == NULL) {
_locale_state *state = get_locale_state(m);
state->Error = PyErr_NewException("locale.Error", NULL, NULL);
encukou marked this conversation as resolved.
Show resolved Hide resolved
if (state->Error == NULL) {
return -1;
}
if (PyModule_AddObject(m, "Error", get_locale_state(m)->Error) < 0) {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.