Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
main
pyicu
Commits
3a4fd3f8
Commit
3a4fd3f8
authored
Jun 09, 2022
by
Andi Vajda
Browse files
added wrapper for u_cleanup/u_init sequence as ResourceBundle.resetICU()
parent
d599d1ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
common.h
View file @
3a4fd3f8
...
...
@@ -169,6 +169,7 @@ typedef intintobjargproc ssizessizeobjargproc;
#include <unicode/ucasemap.h>
#include <unicode/udata.h>
#include <unicode/ubidi.h>
#include <unicode/uclean.h>
#define VERSION_HEX(major, minor, patch) \
(((major) << 24) | ((minor) << 16) | ((patch) << 8))
...
...
locale.cpp
View file @
3a4fd3f8
...
...
@@ -248,6 +248,7 @@ static PyObject *t_resourcebundle_getIntVector(t_resourcebundle *self);
static
PyObject
*
t_resourcebundle_getLocale
(
t_resourcebundle
*
self
,
PyObject
*
args
);
static
PyObject
*
t_resourcebundle_resetICU
(
PyTypeObject
*
type
);
#ifndef PYPY_VERSION
static
PyObject
*
t_resourcebundle_setAppData
(
PyTypeObject
*
type
,
PyObject
*
args
);
...
...
@@ -272,6 +273,7 @@ static PyMethodDef t_resourcebundle_methods[] = {
DECLARE_METHOD
(
t_resourcebundle
,
getBinary
,
METH_NOARGS
),
DECLARE_METHOD
(
t_resourcebundle
,
getIntVector
,
METH_NOARGS
),
DECLARE_METHOD
(
t_resourcebundle
,
getLocale
,
METH_VARARGS
),
DECLARE_METHOD
(
t_resourcebundle
,
resetICU
,
METH_CLASS
|
METH_NOARGS
),
#ifndef PYPY_VERSION
DECLARE_METHOD
(
t_resourcebundle
,
setAppData
,
METH_CLASS
|
METH_VARARGS
),
#endif
...
...
@@ -1572,6 +1574,17 @@ static PyObject *t_resourcebundle_getLocale(t_resourcebundle *self,
return
PyErr_SetArgsError
((
PyObject
*
)
self
,
"getLocale"
,
args
);
}
// Use this with care, see docs for u_cleanup() and u_init() in uclean.h or at
// https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/uclean_8h.html
static
PyObject
*
t_resourcebundle_resetICU
(
PyTypeObject
*
type
)
{
u_cleanup
();
STATUS_CALL
(
u_init
(
&
status
));
Py_RETURN_NONE
;
}
#ifndef PYPY_VERSION
#if defined(_MSC_VER) || defined(__WIN32)
...
...
Andi Vajda
@vajda
mentioned in issue
#154
·
Jun 09, 2022
mentioned in issue
#154
mentioned in issue #154
Toggle commit list
Write
Preview
Supports
Markdown
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