Opened 4 years ago

Closed 7 weeks ago

#5714 task closed duplicate (duplicate)

Use Exception.args instead of iterating over it

Reported by: vperic Owned by: vperic
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 4 years ago by vperic

  • Author set to vperic
  • Branch set to branches/except-args-5714

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

comment:2 Changed 4 years ago by vperic

  • Keywords review added
  • Owner vperic deleted

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

comment:3 Changed 4 years ago by exarkun

  • Keywords review removed
  • Owner set to vperic

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

comment:4 Changed 7 weeks ago by rodrigc

  • Branch changed from branches/except-args-5714 to except-args-5714
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of 8344

Note: See TracTickets for help on using tickets.