classification
Title: Derby #12: Convert 50 sites to Argument Clinic across 4 files
Type: enhancement Stage: patch review
Components: Argument Clinic, Extension Modules Versions: Python 3.5
process
Status: open Resolution:
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 2019-06-23 19:13 by ZackerySpytz.

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 open ZackerySpytz, 2019-06-23 19:03
Messages (10)
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.
History
Date User Action Args
2019-06-23 19:13:40ZackerySpytzsetnosy: + ZackerySpytz
messages: + msg346335
2019-06-23 19:03:28ZackerySpytzsetstage: needs patch -> patch review
pull_requests: + pull_request14146
2018-06-14 17:29:35taleinatsetnosy: - taleinat
2015-04-17 18:29:36python-devsetnosy: + python-dev
messages: + msg241348
2015-04-13 16:44:16larrysetmessages: + msg240651
2015-03-25 08:25:28serhiy.storchakasetmessages: + msg239236
2015-03-25 07:46:59larrysetmessages: + msg239232
2015-03-22 06:30:53serhiy.storchakasetfiles: + unicodedata_clinic.patch

nosy: + serhiy.storchaka
messages: + msg238876

keywords: + patch
2015-02-25 15:28:10serhiy.storchakasetcomponents: + Argument Clinic
2014-08-04 20:14:31larrysetmessages: + msg224762
versions: + Python 3.5, - Python 3.4
2014-01-21 20:32:16taleinatsetmessages: + msg208700
2014-01-21 19:23:25taleinatsetnosy: + taleinat
messages: + msg208688
2014-01-08 01:36:37r.david.murraylinkissue20187 dependencies
2014-01-08 00:16:43larrycreate