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
Title: Argument Clinic CConverter.__init__() overrides c_default and py_default
Type: behavior Stage: resolved
Components: Build Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: larry Nosy List: larry, nikratio, python-dev, rmsr
Priority: normal Keywords: patch

Created on 2014-01-19 05:39 by rmsr, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ac_overwritten_defaults.patch rmsr, 2014-01-19 05:39 don't overwrite c_default and py_default if not supplied to __init__ review
Messages (4)
msg208447 - (view) Author: Ryan Smith-Roberts (rmsr) * Date: 2014-01-19 05:39
The docs indicate that you can do:

class foo_converter(CConverter):
    ...
    c_default = 'bar()'
    py_default = 'Bar'

except that CConverter.__init__() unconditionally overwrites these values. Patch attached.
msg208449 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-19 05:54
New changeset 8f11493cf727 by Larry Hastings in branch 'default':
Issue #20299: Argument Clinic custom converters may now change the default
http://hg.python.org/cpython/rev/8f11493cf727
msg208450 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-19 05:55
Checked in.  Thanks for the report, and the patch!

I worked so quickly, I just realized, I didn't credit you in the NEWS
file for the fix.  Do you want me to fix that?
msg208452 - (view) Author: Ryan Smith-Roberts (rmsr) * Date: 2014-01-19 05:59
No, I'm happy. It isn't really news anyway, since the patch just brings reality inline with the docs :).
History
Date User Action Args
2022-04-11 14:57:57adminsetgithub: 64498
2014-01-19 05:59:46rmsrsetmessages: + msg208452
2014-01-19 05:55:35larrysetstatus: open -> closed
assignee: larry
resolution: fixed
stage: resolved
2014-01-19 05:55:23larrysetmessages: + msg208450
2014-01-19 05:54:38python-devsetnosy: + python-dev
messages: + msg208449
2014-01-19 05:47:48rmsrsetnosy: + nikratio
2014-01-19 05:39:40rmsrcreate