This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients ezio.melotti, gvanrossum, lemburg, loewis, mrabarnett, tchrist, terry.reedy
Date 2011-10-09.13:20:55
SpamBayes Score 1.68834e-11
Marked as misclassified No
Message-id <>
Here is a new patch that stores the names of aliases and named sequences in the Private Use Area.

To summarize a bit, this is what we want:
        | 6.0.0 | 3.2.0 |
\N{...} |   A   |   -   |
.name   |   -   |   -   |
.lookup |  A,NS |   -   |

I.e., \N{...} should only support aliases, unicodedata.lookup should support aliases and named sequences, doesn't support either, and when 3.2.0 is used nothing is supported.

The function calls involved for these 3 functions are:

\N{...} and .lookup:


My patch adds an extra arg to _getcode and _getucname (I hope that's fine -- or are they public?).

_getcode is called by \N{...} and .lookup; both support aliases, so _getcode now resolves aliases by default.  Since only .lookup wants named sequences, _getcode now accepts an extra 'with_named_seq' arg and looks up named sequences only when its value is 1.  .lookup passes 1, gets the codepoint, and converts it to a sequence.  \N{...} passes 0 and doesn't get named sequences.

_getucname is called by .name and indirectly (through _cmpname) by .lookup and \N{...}.  Since _getcode takes care of deciding who gets aliases and sequences, _getucname now accepts an extra 'with_alias_and_seq' arg and looks up aliases and named sequences only when its value is 1.  _cmpname passes 1, gets aliases and named sequences and then lets _getcode decide what to do with them.  .name passes 0 and doesn't get aliases and named sequences.

All this happens on 6.0.0 only, when self != NULL (i.e. we are using 3.2.0) named sequences and aliases are ignored.

The patch doesn't include the changes to unicodename_db.h -- run to get them.
I also added more tests to make sure that the names added in the PUA don't leak, and that ucd_3_2_0 is not affected.
Date User Action Args
2011-10-09 13:21:00ezio.melottisetrecipients: + ezio.melotti, lemburg, gvanrossum, loewis, terry.reedy, mrabarnett, tchrist
2011-10-09 13:20:59ezio.melottisetmessageid: <>
2011-10-09 13:20:58ezio.melottilinkissue12753 messages
2011-10-09 13:20:58ezio.melotticreate