[issue1243] option.dest not set when callback called with optparse

2008-01-04 Thread Raghuram Devarakonda
Raghuram Devarakonda added the comment: I was under the impression that no change is necessary but I will take a closer look and will see if something needs to be done. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1243

[issue1243] option.dest not set when callback called with optparse

2008-01-04 Thread Guido van Rossum
Guido van Rossum added the comment: Hm, perhaps I misinterpreted the discussion. If no patch is necessary, please close as won't fix or invalid. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1243 __

[issue1243] option.dest not set when callback called with optparse

2008-01-04 Thread Raghuram Devarakonda
Raghuram Devarakonda added the comment: Hm, perhaps I misinterpreted the discussion. If no patch is necessary, please close as won't fix or invalid. I spent some time looking at optparse code and OP's request. _check_dest has a clear comment that says dest will be set iff a store action is

[issue1243] option.dest not set when callback called with optparse

2008-01-04 Thread Raghuram Devarakonda
Raghuram Devarakonda added the comment: FWIW, the change to _check_dest to always set 'dest' breaks quite a few tests. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1243 __ ___

[issue1243] option.dest not set when callback called with optparse

2008-01-04 Thread Guido van Rossum
Guido van Rossum added the comment: Then let's leave well enough alone. I believe Greg Ward doesn't usually respond to queries about optparse, but I'm assigning it to him anyway in case his interest is piqued. But for now, let's close this. -- assignee: - gward nosy: +gward

[issue1243] option.dest not set when callback called with optparse

2008-01-03 Thread Christian Heimes
Changes by Christian Heimes: -- priority: - normal versions: -Python 2.3, Python 2.4 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1243 __ ___ Python-bugs-list

[issue1243] option.dest not set when callback called with optparse

2007-10-08 Thread Chris Withers
Chris Withers added the comment: I'm not sure I fully understand where the fix should go but I'll put a note in to look into this. In the meantime, a good workaround is to supply an explicit destination: parser.add_option('--myopt',action='callback',callback=mycallback,dest='myopt')

[issue1243] option.dest not set when callback called with optparse

2007-10-08 Thread Raghuram Devarakonda
Raghuram Devarakonda added the comment: I have never used callbacks but went through the docs/code and I am not sure if there is a bug here. _check_dest() creates 'dest' only if 'type' is specified for the 'callback' option. With callbacks, it can not guess the type as there is no 'store'

[issue1243] option.dest not set when callback called with optparse

2007-10-08 Thread Chris Withers
Chris Withers added the comment: But what type should I specify? I was using a callback to get a datetime object as an option... __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1243 __

[issue1243] option.dest not set when callback called with optparse

2007-10-08 Thread Raghuram Devarakonda
Raghuram Devarakonda added the comment: But what type should I specify? I was using a callback to get a datetime object as an option... If you are looking for a new type of option than what are already supported (string, int, long, choice, float and complex), you need to extend optparse

[issue1243] option.dest not set when callback called with optparse

2007-10-07 Thread Guido van Rossum
Guido van Rossum added the comment: Since you've done so much work debugging this, would you mind submitting a patch, including a unit test that confirms the desired behavior? -- nosy: +gvanrossum __ Tracker [EMAIL PROTECTED]

[issue1243] option.dest not set when callback called with optparse

2007-10-06 Thread Chris Withers
New submission from Chris Withers: The attached script demonstrates the bug. option.dest should be set, even if not explicitly supplied in the call to parser.add_option, by the time the callback is called. Unless dest='something' is specified in the call to add_option, you will get the