python / cpython

The Python programming language
https://www.python.org
Other
63.66k stars 30.49k forks source link

subprocess.CalledProcessError uses errno incorrectly #42669

Closed d859f4a1-4638-4bbb-b410-da6569478fb3 closed 18 years ago

d859f4a1-4638-4bbb-b410-da6569478fb3 commented 18 years ago
BPO 1376309

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: ```python assignee = None closed_at = created_at = labels = [] title = 'subprocess.CalledProcessError uses errno incorrectly' updated_at = user = 'https://bugs.python.org/hoffman' ``` bugs.python.org fields: ```python activity = actor = 'astrand' assignee = 'astrand' closed = True closed_date = None closer = None components = ['None'] creation = creator = 'hoffman' dependencies = [] files = [] hgrepos = [] issue_num = 1376309 keywords = [] message_count = 3.0 messages = ['26999', '27000', '27001'] nosy_count = 2.0 nosy_names = ['astrand', 'hoffman'] pr_nums = [] priority = 'normal' resolution = 'duplicate' stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue1376309' versions = ['Python 2.5'] ```

d859f4a1-4638-4bbb-b410-da6569478fb3 commented 18 years ago

I have some code which uses subprocess.check_call(), which is buried in other code that catches an OSError, and does different things depending on OSError.errno. Since subprocess.CalledProcessError overloads errno for its own return code values, this leads to confusing error messages.

The return code is NOT an errno, and I do not think this field should be overloaded in this way. Additionally, since OSError exceptions generally have an errno attribute set, and exception-handling code expects this, I do not think that CalledProcessError should subclass from it.

d859f4a1-4638-4bbb-b410-da6569478fb3 commented 18 years ago

Logged In: YES user_id=987664

Ugh, this was supposed to be a bug, not a patch. Is there anyway to change this or should I just resumbit?

361bcbce-9d25-42c1-9b7c-dd935695d2e5 commented 18 years ago

Logged In: YES user_id=344921

Duplicate of 1223937.