Opened 5 years ago

Closed 11 months ago

#5714 task closed duplicate (duplicate)

Use Exception.args instead of iterating over it

Reported by: Vladimir Perić Owned by: Vladimir Perić
Priority: normal Milestone: Python-3.x
Component: core Keywords: py3k
Cc: Branch: except-args-5714
branch-diff, diff-cov, branch-cov, buildbot
Author: vperic

Description

In Python 3, it is no longer possible to iterate over an exception, because the getitem method is no longer supported. The solution is to use args to access what we need.

Change History (4)

comment:1 Changed 5 years ago by Vladimir Perić

Author: vperic
Branch: branches/except-args-5714

(In [34596]) Create branch except-args-5714

comment:2 Changed 5 years ago by Vladimir Perić

Keywords: review added
Owner: Vladimir Perić deleted

This should be trivial enough, there were just 4 cases. Build results.

comment:3 Changed 5 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to Vladimir Perić

The errno attribute of these exception types is a better replacement than args[0].

comment:4 Changed 11 months ago by Craig Rodrigues

Branch: branches/except-args-5714except-args-5714
Resolution: duplicate
Status: newclosed

Duplicate of 8344

Note: See TracTickets for help on using tickets.