Issue 20181: Derby #12: Convert 50 sites to Argument Clinic across 4 files - Python tracker

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.

classification
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, larry, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2014-01-08 00:16 by larry, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
unicodedata_clinic.patch serhiy.storchaka, 2015-03-22 06:30 review
Pull Requests
URL Status Linked Edit
PR 14326 merged ZackerySpytz, 2019-06-23 19:03
Messages (11)
msg207637 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-08 00:16
This issue is part of the Great Argument Clinic Conversion Derby,
where we're trying to convert as much of Python 3.4 to use
Argument Clinic as we can before Release Candidate 1 on January 19.

This issue asks you to change the following bundle of files:
    Objects/bytearrayobject.c: 13 sites
    Modules/parsermodule.c: 13 sites
    Modules/unicodedata.c: 12 sites
    Modules/readline.c: 12 sites

Talk to me (larry) if you only want to attack part of a bundle.

For instructions on how to convert a function to work with Argument
Clinic, read the "howto":
    http://docs.python.org/dev/howto/clinic.html
msg208688 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2014-01-21 19:23
While converting Objects/stringlib/transmogrify.h as part of issue20180 (Derby #11), some changes to Objects/bytesobject.c and Objects/bytearrayobject.c were required. Those changes are included in the relevant patch attached to that issue.
msg208700 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2014-01-21 20:32
See nearly complete conversion of Objects/bytearrayobject.c in patch attached to issue20179.
msg224762 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-08-04 20:14
All the Derby patches should only go into trunk at this point.
msg238876 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-03-22 06:30
Here is a patch for unicodedata.
msg239232 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2015-03-25 07:46
I read it quickly.  It looks basically okay, but I have one issue to discuss right now.  Changing from the format unit 'O!' and calling "getuchar" to the format unit 'C' means a change in semantics.  The text in the exception will change.  Unfortunately, people do depend on that in real-world code.

It'd be nice if we could change those semantics; this won't ship until 3.5 so maybe it's okay.  I don't know.
msg239236 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-03-25 08:25
The only difference is in error message.

For now:

>>> unicodedata.name(123)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: must be str, not int
>>> unicodedata.name('123')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: need a single Unicode character as parameter

Patched:

>>> unicodedata.name(123)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: must be a unicode character, not int
>>> unicodedata.name('123')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: must be a unicode character, not str

If you think old messages were better, we can change standard error messages for 'C' format unit. We already changed standard and specialized error messages in 3.5 and earlier. In 3.4 it looks as:

>>> unicodedata.name(123)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: must be str, not int
>>> unicodedata.name('123')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: need a single Unicode character as parameter
msg240651 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2015-04-13 16:44
I finally talked to someone (Thomas Wouters) about this.  For something going into trunk that will be part of 3.5, this is fine.

Please include a mention that the exception's text messages changed in Misc/NEWS.  I can help you write this if you want.

I'll try and give this a full review later today or tomorrow, is that soon enough?
msg241348 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-04-17 18:29
New changeset c6d468e0ecc6 by Serhiy Storchaka in branch 'default':
Issue #20181: Converted the unicodedata module to Argument Clinic.
https://hg.python.org/cpython/rev/c6d468e0ecc6
msg346335 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2019-06-23 19:13
PR 14326 converts Modules/readline.c.

As the parser module is slated for removal in 3.9 (according to PEP 594), Modules/parsermodule.c should not be converted.
msg373560 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-07-12 16:01
New changeset b7047e59a40649d81061acf0044e74cfd426f064 by Zackery Spytz in branch 'master':
bpo-20181: Convert the readline module to the Argument Clinic (#14326)
https://github.com/python/cpython/commit/b7047e59a40649d81061acf0044e74cfd426f064