You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
codecs.charmap_build is untested and undocumented #48181
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2008-09-22.12:06:14.954>labels= ['type-bug', 'library', 'docs']
title='codecs.charmap_build is untested and undocumented'updated_at=<Date2019-03-15.22:35:04.722>user='https://bugs.python.org/fijal'
AFAIR, this code was added by Martin as optimization.
The function is a direct interface to PyUnicode_BuildEncodingMap() which
builds either a dictionary or EncodingMap object for use by the charmap
codec.
There are numerous undocumented implementation objects that are either private and probably should start with _ but do not, or are semi-private and perhaps left public for the expert user willing to read code. But, being undocumented, it is hard to tell. codecs.charmap_build strikes me as rather private, hence should not be documented. So I would be inclined to close this.
I see charmap_build used in encodings too, so it may be useful to make it officially public for the use of third-party encodings.
BreamoreBoy commented on Jun 13, 2014
BreamoreBoymannequin
Mannequin
More actions
msg120987 states the opposite to msg112747 so what do we do with this issue?
MojoVampire commented on Jun 13, 2014
MojoVampiremannequin
Mannequin
More actions
I've found it rather ugly to even understand from the lack of code comments for the C level API it's wrapping. If nothing else, comments explaining the usage and purpose might be helpful.
BreamoreBoy commented on Mar 2, 2015
BreamoreBoymannequin
Mannequin
More actions
I do not see much purpose in documenting and testing this one function alone. I think that all functions in _codecsmodule.c should be looked at to see if they are private or public, but I'm certainly not volunteering to do it.
The function is an integral part of how to build charmap codecs
and a direct Python API to the Unicode C API PyUnicode_BuildEncodingMap().
I guess the main reason that it's undocumented is the fact that
most charmap codecs are generated using gencodec.py, which uses
the API, so people hardly notice that it's undocumented.
In any case, +1 on documenting the function. I may find some time
next week to write up something.
BTW: Testing of the API is mostly done indirectly by the charmap
codec tests.
Activity
fijal commentedon Sep 22, 2008
Although it doesn't start with _ and is definitely necessary as codecs
call it.
malemburg commentedon Oct 20, 2008
AFAIR, this code was added by Martin as optimization.
The function is a direct interface to PyUnicode_BuildEncodingMap() which
builds either a dictionary or EncodingMap object for use by the charmap
codec.
It is primarily used by the gencodec.py script.
terryjreedy commentedon Aug 4, 2010
There are numerous undocumented implementation objects that are either private and probably should start with _ but do not, or are semi-private and perhaps left public for the expert user willing to read code. But, being undocumented, it is hard to tell. codecs.charmap_build strikes me as rather private, hence should not be documented. So I would be inclined to close this.
merwok commentedon Nov 12, 2010
I see charmap_build used in encodings too, so it may be useful to make it officially public for the use of third-party encodings.
BreamoreBoy commentedon Jun 13, 2014
msg120987 states the opposite to msg112747 so what do we do with this issue?
MojoVampire commentedon Jun 13, 2014
I've found it rather ugly to even understand from the lack of code comments for the C level API it's wrapping. If nothing else, comments explaining the usage and purpose might be helpful.
BreamoreBoy commentedon Mar 2, 2015
I do not see much purpose in documenting and testing this one function alone. I think that all functions in _codecsmodule.c should be looked at to see if they are private or public, but I'm certainly not volunteering to do it.
2 remaining items
malemburg commentedon Jul 9, 2022
eamanu commentedon Jul 10, 2022
@malemburg great. Let me know if I can help in something :-)
gh-48181: Document `codecs.charmap_build` (#135997)
pythongh-48181: Document `codecs.charmap_build` (pythonGH-135997)
pythongh-48181: Document `codecs.charmap_build` (pythonGH-135997)
[3.14] gh-48181: Document `codecs.charmap_build` (GH-135997) (#136123)
[3.13] gh-48181: Document `codecs.charmap_build` (GH-135997) (#136124)
StanFromIreland commentedon Jun 30, 2025
Closing since the docs have been merged and as for tests, as you said before:
pythongh-48181: Document `codecs.charmap_build` (python#135997)
pythongh-48181: Document `codecs.charmap_build` (python#135997)
pythongh-48181: Document `codecs.charmap_build` (python#135997)
pythongh-48181: Document `codecs.charmap_build` (python#135997)
pythongh-48181: Document `codecs.charmap_build` (python#135997)