Skip to content

bpo-42157: unicodedata avoids references to UCD_Type #22990

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 1 commit into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 2 additions & 4 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,8 @@ Porting to Python 3.10
(Contributed by Inada Naoki in :issue:`36346`.)

* The private ``_PyUnicode_Name_CAPI`` structure of the PyCapsule API
``unicodedata.ucnhash_CAPI`` moves to the internal C API. Moreover,
the structure gets a new ``state`` member which must be passed to the
``getcode()`` and ``getname()`` functions.
(Contributed by Victor Stinner in :issue:`1635741`.)
``unicodedata.ucnhash_CAPI`` moves to the internal C API.
(Contributed by Victor Stinner in :issue:`42157`.)

Deprecated
----------
Expand Down
24 changes: 7 additions & 17 deletions Include/internal/pycore_ucnhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,15 @@ extern "C" {

typedef struct {

/* Size of this struct */
int size;

// state which must be passed as the first parameter to getname()
// and getcode()
void *state;

/* Get name for a given character code. Returns non-zero if
success, zero if not. Does not set Python exceptions.
If self is NULL, data come from the default version of the database.
If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */
int (*getname)(void *state, PyObject *self, Py_UCS4 code,
char* buffer, int buflen,
/* Get name for a given character code.
Returns non-zero if success, zero if not.
Does not set Python exceptions. */
int (*getname)(Py_UCS4 code, char* buffer, int buflen,
int with_alias_and_seq);

/* Get character code for a given name. Same error handling
as for getname. */
int (*getcode)(void *state, PyObject *self,
const char* name, int namelen, Py_UCS4* code,
/* Get character code for a given name.
Same error handling as for getname(). */
int (*getcode)(const char* name, int namelen, Py_UCS4* code,
int with_named_seq);

} _PyUnicode_Name_CAPI;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The private ``_PyUnicode_Name_CAPI`` structure of the PyCapsule API
``unicodedata.ucnhash_CAPI`` moves to the internal C API.
Patch by Victor Stinner.
Loading