Skip to content
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

json docstrings on 3.x still use 'unicode' and 'str' #53333

Closed
ezio-melotti opened this issue Jun 26, 2010 · 2 comments
Closed

json docstrings on 3.x still use 'unicode' and 'str' #53333

ezio-melotti opened this issue Jun 26, 2010 · 2 comments
Assignees
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir

Comments

@ezio-melotti
Copy link
Member

BPO 9087
Nosy @birkenfeld, @etrepum, @ezio-melotti

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 = 'https://github.com/etrepum'
closed_at = <Date 2010-08-02.20:16:23.662>
created_at = <Date 2010-06-26.18:04:31.118>
labels = ['library', 'docs']
title = "json docstrings on 3.x still use 'unicode' and 'str'"
updated_at = <Date 2010-08-02.20:16:23.660>
user = 'https://github.com/ezio-melotti'

bugs.python.org fields:

activity = <Date 2010-08-02.20:16:23.660>
actor = 'georg.brandl'
assignee = 'bob.ippolito'
closed = True
closed_date = <Date 2010-08-02.20:16:23.662>
closer = 'georg.brandl'
components = ['Documentation', 'Library (Lib)']
creation = <Date 2010-06-26.18:04:31.118>
creator = 'ezio.melotti'
dependencies = []
files = []
hgrepos = []
issue_num = 9087
keywords = []
message_count = 2.0
messages = ['108738', '112532']
nosy_count = 3.0
nosy_names = ['georg.brandl', 'bob.ippolito', 'ezio.melotti']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'needs patch'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue9087'
versions = ['Python 3.1', 'Python 3.2']

@ezio-melotti
Copy link
Member Author

In the json package there are still lot of docstrings that refer to 'unicode' and 'str' instead of 'str' and 'bytes' (AFAIU 'bytes' are not even allowed anymore in several places, so there should probably be only 'str' there).
A few examples:

  • in json/init.py:
    If skipkeys is true then dict keys that are not basic types (str, unicode, int, float, bool, None) will be skipped instead of raising a TypeError.
    If ensure_ascii is false, then the some chunks written to fp may be unicode instances, subject to normal Python str to unicode coercion rules.

  • in json/decoder.py:
    Decode a JSON document from s (a str or unicode beginning with a JSON document) and return a 2-tuple of the Python representation and the index in s where the document ended.

  • in json/encoder.py:
    If ensure_ascii is true, the output is guaranteed to be str objects with all incoming unicode characters escaped. If ensure_ascii is false, the output will be unicode object.

Note that the documentation (Doc/library/json.rst) seems already updated, so update the docstrings should be enough.

@ezio-melotti ezio-melotti added docs Documentation in the Doc dir stdlib Python modules in the Lib dir labels Jun 26, 2010
@birkenfeld
Copy link
Member

Fixed in r83560.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

2 participants